The AdxSmas strategy is designed to backtest trading decisions based on the combination of Average Directional Index (ADX) and Simple Moving Averages (SMAs). Here's a breakdown of what the strategy does:
It calculates the ADX indicator with a time period of 14 and adds it to the DataFrame. It calculates a short-term SMA with a time period of 3 and adds it to the DataFrame.
It calculates a long-term SMA with a time period of 6 and adds it to the DataFrame.
In the populate_buy_trend method, it generates a buy signal when the ADX value is greater than 25 and the short-term SMA crosses above the long-term SMA.
In the populate_sell_trend method, it generates a sell signal when the ADX value is less than 25 and the long-term SMA crosses above the short-term SMA. The strategy sets a minimal return on investment (ROI) of 0.1 and a stop loss of -0.25. It operates on 1-hour ticker intervals. Overall, the strategy aims to identify buying opportunities when there is a strong trend (ADX > 25) and a bullish crossover of SMAs, and sell positions when the trend weakens (ADX < 25) and a bearish crossover of SMAs occurs.