The SMAOnly strategy is a trading strategy that uses various technical indicators to generate buy and sell signals. Here's a breakdown of what the strategy does:
In the populate_indicators method:
Exponential Moving Averages (EMA) are calculated for different time periods (ma_buy_{val} and ma_sell_{val}) using the ta.EMA function. The Hull Moving Average (HMA) with a window of 50 is calculated using the qtpylib.hull_moving_average function.
The Simple Moving Average (SMA) with a time period of 9 is calculated using the ta.SMA function.
The EWO (Elliott Wave Oscillator) is calculated based on the EWO function, with parameters self.fast_ewo and self.slow_ewo.
The Relative Strength Index (RSI) is calculated for three different time periods (14, 4, and 20) using the ta.RSI function. In the populate_buy_trend method:
Buy conditions are defined using a list of conditions. The conditions include checks such as RSI fast being below 35, the closing price being below a certain percentage offset from the corresponding EMA (ma_buy_{self.base_nb_candles_buy.value}), EWO being above a certain threshold (self.ewo_high.value), RSI being below a specified value (self.rsi_buy.value), positive volume, and the closing price being below a certain percentage offset from the corresponding EMA (ma_sell_{self.base_nb_candles_sell.value}). If any of the conditions are met, a 'buy' signal is marked as 1 in the 'buy' column of the dataframe. In the populate_sell_trend method:
Sell conditions are defined using a list of conditions. The conditions include checks such as the closing price being above the Hull Moving Average (hma_50), the closing price being above a certain percentage offset from the corresponding EMA (ma_sell_{self.base_nb_candles_sell.value}), RSI being above 50, positive volume, and RSI fast being greater than RSI slow. If any of the conditions are met, a 'sell' signal is marked as 1 in the 'sell' column of the dataframe. Overall, the strategy uses moving averages, oscillators, and other indicators to identify potential buying and selling opportunities in the market based on specified conditions.