The MACDStrategy is a trading strategy that uses the MACD (Moving Average Convergence Divergence) and CCI (Commodity Channel Index) indicators to identify uptrends and downtrends in the market. The strategy aims to generate buy and sell signals based on these indicators. The uptrend is defined as follows:
MACD is above MACD signal
CCI is less than -50
The downtrend is defined as follows:
MACD is below MACD signal
CCI is greater than 100
The strategy calculates the MACD, MACD signal, MACD histogram, and CCI indicators using the input dataframe.
These indicators are then used to determine the buy and sell signals.
In the populate_buy_trend method, the strategy identifies a buy signal when the following conditions are met:
MACD is greater than MACD signal
CCI is less than or equal to -205.0
In the populate_sell_trend method, the strategy identifies a sell signal when the following conditions are met:
MACD is less than MACD signal
CCI is greater than or equal to 360.0
The strategy also specifies a minimal ROI (Return on Investment) and stoploss values, which can be overridden in the configuration file.
The timeframe used for the strategy is set to 5 minutes. Overall, the MACDStrategy uses the MACD and CCI indicators to determine the market trend and generate buy and sell signals based on those trends.