The strategy, named "CombinedBinHClucAndMADV6," is implemented as a class that inherits from the IStrategy class. It consists of two main functions: populate_indicators and populate_buy_trend, along with the populate_sell_trend function. In the populate_indicators function, the strategy first calculates informative indicators based on 1-hour data.
These indicators are merged into the main dataframe using the merge_informative_pair function.
Then, additional normal timeframe indicators are calculated and added to the dataframe.
The populate_buy_trend function defines the conditions for entering a buy trade. The strategy consists of multiple buy conditions separated by the logical OR operator. Each condition represents a different trading strategy. Here are the important parts of each strategy:
ClucMay72018 strategy:
The close price is above the 200-day exponential moving average (ema_200). The close price is above the 1-hour exponential moving average (ema_200_1h). The close price is below the "slow" exponential moving average (ema_slow). The close price is below 0.99 times the lower Bollinger Band (bb_lowerband). The 30-day average volume is greater than 40% of the volume 30 days ago. The current volume is greater than 0. ClucMay72018 strategy (alternative condition):
The close price is below the "slow" exponential moving average (ema_slow). The close price is below 0.975 times the lower Bollinger Band (bb_lowerband). The current volume is less than 4 times the previous volume. The 1-hour relative strength index (rsi_1h) is less than 15. The 30-day average volume is greater than 40% of the volume 30 days ago. The current volume is greater than 0. MACD Low buy strategy:
The close price is above the 200-day exponential moving average (ema_200). The close price is above the 1-hour exponential moving average (ema_200_1h). The MACD histogram (ema_26 - ema_12) is positive. The MACD histogram is greater than 2% of the opening price. The previous MACD histogram is greater than the previous opening price divided by 100. The current volume is less than 4 times the previous volume. The close price is below the lower Bollinger Band. The 30-day average volume is greater than 40% of the volume 30 days ago. The current volume is greater than 0. MACD Low buy strategy (alternative condition):
The MACD histogram is positive. The MACD histogram is greater than 3% of the opening price. The previous MACD histogram is greater than the previous opening price divided by 100. The current volume is less than 4 times the previous volume. The close price is below the lower Bollinger Band. The current volume is greater than 0. Miscellaneous strategy:
The close price is below the 5-day simple moving average (sma_5). The SSL indicator based on 1-hour data (ssl_up_1h and ssl_down_1h) indicates an upward trend. The "slow" exponential moving average (ema_slow) is greater than the 200-day exponential moving average (ema_200). The 1-hour 50-day exponential moving average (ema_50_1h) is greater than the 1-hour 200-day exponential moving average (ema_200_1h). The relative strength index (rsi) is less than the 1-hour relative strength index minus 43.276. The current volume is greater than 0. If any of the above conditions are met, a value of 1 is assigned to the "buy" column in the dataframe. The populate_sell_trend function defines the conditions for selling a position. In this case, the condition is when the close price is greater than 1.01 times the middle Bollinger Band and the volume is greater than 0. If these conditions are met, a value of 1 is assigned to the "sell" column in the dataframe. Overall, the strategy combines multiple buy conditions and a single sell condition to determine the trading signals based on various technical indicators and price patterns.