The CustomAlligatorV0 strategy is a trading strategy that uses various technical indicators to generate buy and sell signals. In the populate_indicators method, several indicators are calculated and added to the DataFrame:
"lips": Simple Moving Average (SMA) with a time period of 5
"smma_lips": Rolling mean of the "lips" indicator with a window size of 3
"teeth": SMA with a time period of 8
"smma_teeth": Rolling mean of the "teeth" indicator with a window size of 5
"jaw": SMA with a time period of 13
"smma_jaw": Rolling mean of the "jaw" indicator with a window size of 8
"diff_lips_teeth": Absolute difference between "smma_lips" and "smma_teeth"
"ema_200": Exponential Moving Average (EMA) with a time period of 200
"plus_di": Positive Directional Indicator (PLUS_DI) with a time period of 8
"minus_di": Negative Directional Indicator (MINUS_DI) with a time period of 8
In the populate_buy_trend method, the buy signal is determined based on the conditions:
The closing price is higher than the 200-day EMA
The "smma_lips" is lower than "smma_teeth" and "smma_jaw"
The "smma_teeth" is higher than "smma_jaw"
The closing price crossed above the "smma_teeth"
The "diff_lips_teeth" increased in the previous period
The "plus_di" is higher than "minus_di"
The volume is greater than 0
If all the conditions are met, the "buy" column in the DataFrame is set to 1. In the populate_sell_trend method, the sell signal is determined based on the conditions:
The closing price is lower than the 200-day EMA
The "smma_lips" is higher than "smma_teeth" and "smma_jaw"
The opening price crossed below the "smma_lips"
The "diff_lips_teeth" decreased in the previous period
The "plus_di" is greater than or equal to "minus_di"
The volume is greater than 0
If all the conditions are met, the "sell" column in the DataFrame is set to 1.
These methods populate the buy and sell signals in the DataFrame, which can then be used for backtesting the strategy.