The HarmonicDivergence strategy is a trading strategy that utilizes various technical indicators to generate buy and sell signals. Here is a breakdown of what the strategy does:
In the populate_indicators method, several technical indicators are calculated and added to the input DataFrame. These indicators include RSI (Relative Strength Index), Stochastic Oscillator, Rate of Change, Ultimate Oscillator, Awesome Oscillator, MACD (Moving Average Convergence Divergence), CCI (Commodity Channel Index), Chaikin Money Flow, On Balance Volume, MFI (Money Flow Index), ADX (Average Directional Index), ATR (Average True Range), Keltner Channels, Bollinger Bands, and various Exponential Moving Averages (EMA).
The populate_buy_trend method populates the buy signal for the DataFrame based on the calculated indicators.
The conditions for a buy signal include the presence of bullish divergences, certain band checks, and non-zero volume.
The populate_sell_trend method populates the sell signal for the DataFrame. The condition for a sell signal is non-zero volume. The current_stoploss method calculates the stop-loss price based on the current rate and the buy candle's low price minus the ATR (Average True Range). If the stop-loss is triggered, it returns the loss percentage. The current_takeprofit method calculates the take-profit price based on the current rate and the buy candle's high price plus the ATR. It returns a profit percentage of 1 if the take-profit is not reached. Various indicator checks are defined as separate methods. These checks evaluate different conditions using the DataFrame and return boolean values indicating whether the conditions are met or not. The checks include Keltner Channels, Bollinger Bands, EMA crossovers, and more. Overall, the HarmonicDivergence strategy combines multiple technical indicators to identify potential buy and sell signals in the market. It also provides methods to calculate stop-loss and take-profit levels for managing risk and profitability.