The MAOffsetsCombinedV0 strategy is a backtesting strategy that uses a combination of moving averages and offsets to identify buying and selling opportunities in trading data. Here is a breakdown of what the strategy does:
In the populate_indicators method:
The strategy calculates the minimum (bottom) and maximum (top) prices between the open and close prices of each candle. It calculates the average of the bottom and low prices (tail) and the average of the top and high prices (head).
It calculates the Trimmed Moving Average (TRIMA) for a range of values (MIN_CANDLES_BUY to MAX_CANDLES_BUY) using the trading data.
It calculates the Exponential Moving Average (EMA) for the tail values using a similar range of values.
It calculates the Elder's Force Index (EWO) using the trading data and the specified parameters fast_ewo and slow_ewo. It calculates the Relative Strength Index (RSI) using a time period of 4. In the populate_buy_trend method:
The strategy sets up conditions for buying opportunities. It iterates over a range of values (buy_1_min_nb_candles to buy_1_max_nb_candles) and checks the following conditions:
The close price is below the Trimmed Moving Average (trima_) multiplied by an offset value (get_low_offset). The EWO value is greater than a specified high value (buy_1_ewo_high). The RSI value is below a specified value (buy_1_rsi_fast). The volume is greater than 0. If the conditions are met, the strategy sets the 'buy' and 'buy_tag' columns of the corresponding rows to 1 and assigns a tag based on the range value. It performs a similar process for another range of values (buy_2_min_nb_candles to buy_2_max_nb_candles) using the EMA values instead of the Trimmed Moving Average. In the populate_sell_trend method:
The strategy sets all 'sell' column values to 0, indicating no selling opportunities. Overall, the strategy utilizes moving averages, offsets, and technical indicators like EWO and RSI to generate buy signals based on specific conditions. The 'buy_tag' column provides additional information about the range used for each buy signal. The strategy does not include explicit sell signals but focuses on identifying potential buying opportunities.