The "ElliotV4" strategy implemented in the code performs the following steps:
Indicator Population: The strategy starts by populating various technical indicators on the input dataframe. These indicators include ADX, PLUS_DM, PLUS_DI, MINUS_DM, MINUS_DI, AROON, AROONOSC, Awesome Oscillator (AO), Keltner Channels, Ultimate Oscillator (UO), Commodity Channel Index (CCI), RSI, Fisher Transform of RSI, Stochastic Oscillator (slowd and slowk), Stochastic Fast (fastd and fastk), Stochastic RSI (fastd_rsi and fastk_rsi), Moving Average Convergence Divergence (MACD), Money Flow Index (MFI), Rate of Change (ROC), Bollinger Bands, Parabolic SAR (SAR), Triple Exponential Moving Average (TEMA), Hilbert Transform - SineWave (htsine and htleadsine), and various candlestick patterns (CDLHAMMER, CDLINVERTEDHAMMER, CDLDRAGONFLYDOJI, CDLPIERCING, CDLMORNINGSTAR, CDL3WHITESOLDIERS, CDLHANGINGMAN, CDLSHOOTINGSTAR, CDLGRAVESTONEDOJI, CDLDARKCLOUDCOVER, CDLEVENINGDOJISTAR, CDLEVENINGSTAR, CDL3LINESTRIKE, CDLSPINNINGTOP, CDLENGULFING, CDLHARAMI, CDL3OUTSIDE, CDL3INSIDE). Some of these indicators are calculated using external libraries such as ta and qtpylib.
ElliotV4 Strategy: After populating the indicators, the strategy further performs calculations specific to the ElliotV4 strategy.
It calculates moving averages (MA) for buying and selling signals using the Exponential Moving Average (EMA) with different time periods.
It also calculates the Elliott Wave Oscillator (EWO) and RSI using the specified parameters. Buy Trend Population: In this step, the strategy determines the conditions for initiating a buy signal. It checks various conditions, including if the closing price is below the buy moving average multiplied by a specified low offset, if the EWO is above a specified high value, if the RSI is below a specified buy value, and if the volume is greater than zero. If any of the conditions are met, a "buy" signal is assigned to the corresponding row in the dataframe. Sell Trend Population: Similarly, the strategy determines the conditions for initiating a sell signal. It checks if the closing price is above the sell moving average multiplied by a specified high offset and if the volume is greater than zero. If the conditions are met, a "sell" signal is assigned to the corresponding row in the dataframe. The strategy combines the calculations of various technical indicators and specific conditions to generate buy and sell signals based on the defined rules.