1. Plan A (Trend-following): • Uses 50-period and 200-period SMAs to detect the direction of the trend. • Bullish Trend: If the current price is above the short-term SMA and the short-term SMA is above the long-term SMA. • Bearish Trend: If the current price is below the short-term SMA and the short-term SMA is below the long-term SMA. 2. Plan B (Momentum): • Uses MACD, RSI, and ADX to confirm momentum. • Bullish Momentum: If the MACD histogram is positive, ADX is above 20, and RSI is between 40 and 70. • Bearish Momentum: If the MACD histogram is negative, ADX is above 20, and RSI is between 30 and 60. 3. Combined Signal: • Buy Signal: If both Plan A (Bullish Trend) and Plan B (Bullish Momentum) are true. • Sell Signal: If both Plan A (Bearish Trend) and Plan B (Bearish Momentum) are true.
Plotting: • The 50-period SMA and 200-period SMA are plotted on the chart. • Buy and Sell Signals are shown with green (for buy) and red (for sell) labels on the chart. • Background color changes when the market is in a bullish or bearish trend.
Alerts: • Alerts are triggered when a buy or sell signal occurs, so you can get notified in real-time.