The Enchilada trading strategy is a backtesting strategy that involves the following key components:
populate_indicators: This method calculates and populates various indicators on the provided DataFrame. These indicators include:
volume_mean_slow: Rolling mean of volume over a 24-hour window. rmi-slow: RMI (Relative Momentum Index) with a length of 20 and momentum of 5.
rmi-fast: RMI with a length of 9 and momentum of 3.
sar: Parabolic SAR (Stop and Reverse) indicator.
max and min: Rolling maximum and minimum values of the high and low prices over a 12-hour window. upper and lower: Binary indicators based on whether the current value exceeds the previous maximum or falls below the previous minimum, respectively. up_trend and dn_trend: Binary indicators based on the rolling sum of upper and lower indicators over a 3-hour window. Additionally, it calculates the consensus scores for buying and selling using the TradingView library. populate_buy_trend: This method determines the conditions for a buy signal based on the provided DataFrame and trade information. The conditions include:
If there is an active trade:
The current peak ratio is greater than 0.8. The rmi-slow indicator is greater than or equal to 60. If there is no active trade:
TradingView consensus scores for buying on the current and previous timeframes are both greater than a certain threshold (X). The up_trend indicator is 1. The rmi-slow indicator is greater than or equal to 55. The current volume is less than 30 times the previous volume mean. The rmi-slow indicator is greater than or equal to the rolling mean of rmi-slow over a 3-hour window. The current closing price is greater than the previous closing price, and the previous closing price is greater than the closing price two time periods ago. The Parabolic SAR value is less than the current closing price, and the previous Parabolic SAR value is less than the previous closing price. populate_sell_trend: This method determines the conditions for a sell signal based on the provided DataFrame and trade information. The conditions include:
If there is an active trade:
The current profit is negative but greater than a specified stop loss. The dn_trend indicator is 1. The rmi-fast indicator is less than 50. The current volume is greater than 0. If there are other open trades:
The average profit ratio of those trades is greater than or equal to -0.005. If there are no active trades or other open trades:
The current volume is less than 0. get_current_price: This custom method retrieves the current price of a specified trading pair. Price protection and timeouts: These methods protect the trade entry price and handle timeouts using built-in Freqtrade functionality. The Enchilada_Slow class is an extension of the Enchilada class, likely with some modifications or additional methods specific to the "slow" version of the strategy.