The SqueezeOff strategy is a trading strategy that uses various technical indicators to generate buy and sell signals. Here is a breakdown of what the strategy does:
In the populate_indicators function, several technical indicators are calculated and added to the DataFrame:
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Triple Exponential Moving Average (TEMA)
EMA with a time period of 3
EMA with a time period of 5
Moving Average Convergence Divergence (MACD) and its components (macd, macdsignal, macdhist)
Money Flow Index (MFI)
Average Directional Index (ADX)
PLUS Directional Movement (+DM) and MINUS Directional Movement (-DM)
Difference between +DM and -DM (dm_delta)
Stop and Reverse (SAR)
Relative Strength Index (RSI)
Fisher Transform of RSI (fisher_rsi)
Bollinger Bands (bb_upperband, bb_mid, bb_lowerband)
Keltner Channel (kc_upper, kc_lower, kc_middle)
Donchian Channel (dc_upper, dc_lower, dc_mid, dc_dist, dc_hf, dc_chf, dc_clf, dc_lf)
Squeeze indicators (sqz_upper, sqz_lower, sqz_on, sqz_off)
Squeeze average (sqz_ave)
Delta of close price and squeeze average (sqz_delta)
Linear regression of sqz_delta (sqz_val)
In the populate_entry_trend function, the strategy determines the conditions for a buy signal based on the populated indicators. The conditions include:
sqz_val is less than 0
If enabled, ADX is greater than or equal to a specified threshold
If enabled, the difference between +DM and -DM is greater than 0
If enabled, MFI is greater than a specified threshold
If enabled, the close price is below the SAR indicator
If enabled, MACD is greater than the MACD signal
If enabled, the Fisher RSI is less than a specified threshold
If enabled, the Bollinger Bands gain is greater than or equal to a specified threshold
The squeeze transitioned from "off" to "on"
In the populate_exit_trend function, the strategy determines the conditions for a sell signal.
The conditions include:
If enabled, a sell signal is generated when the close price crosses below the lower Bollinger Band or Keltner Channel and remains below them
If enabled, a sell signal is generated when the close price is below both the lower Bollinger Band and Keltner Channel
The strategy calculates these buy and sell signals and adds them to the DataFrame.