Strategy MACD and RSI alert fixed
Feb 12, 2015

The Strategy MACD and RSI alert indicator provides a dual-confirmation trend detection system by combining Momentum (MACD) and Relative Strength (RSI) filters to identify shifts in market sentiment. This tool is designed to highlight trend transitions through visual bar coloring and dedicated alert conditions when both momentum and strength oscillators align.
Usage
The tool is primarily used to identify trend reversals or continuations where momentum and relative strength converge.
- Bullish Trend: A bullish state is identified when the RSI is above the user-defined overbought level (acting as a momentum threshold) and the MACD line is above the Signal line.
- Bearish Trend: A bearish state is identified when the RSI is below the user-defined oversold level and the MACD line is below the Signal line.
The chart background or bars change color based on these states: green for bullish, red for bearish, and blue for neutral. Users can set alerts for "Bullish Trend Change" and "Bearish Trend Change" to be notified the moment these technical conditions are met simultaneously.
Details
The script executes logic based on two classic technical indicators:
- MACD: Calculates the difference between a fast and slow Exponential Moving Average (EMA). A Simple Moving Average (SMA) of this difference serves as the signal line.
- RSI: Measures the speed and change of price movements to identify overbought or oversold conditions.
In this specific implementation, the overbought/oversold levels are often tightened (e.g., near the 50 midline) to act as a directional filter rather than traditional extreme reversal points. The posChange variable tracks when the trend flips from one polarity to the other, which is then plotted as a trigger for alerts.
Settings
- Fast Length: The period for the shorter-term EMA used in MACD calculation.
- Slow Length: The period for the longer-term EMA used in MACD calculation.
- Signal Length: The period for the SMA of the MACD line (the Signal Line).
- RSI Length: The lookback period used for the Relative Strength Index calculation.
- Oversold: The RSI threshold below which (when combined with MACD) a bearish state is confirmed.
- Overbought: The RSI threshold above which (when combined with MACD) a bullish state is confirmed.
FAQ
How do I interpret the blue bars? Blue bars indicate a neutral state where the MACD and RSI conditions do not align (e.g., MACD is bullish but RSI hasn't crossed the threshold).
Can I use this for scalping or swing trading? Yes, by adjusting the Fast/Slow MACD lengths and the RSI period, you can tune the sensitivity for lower timeframes (scalping) or higher timeframes (swing trading).
How do I access Strategy MACD and RSI alert? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.