MACD with SAR Indicator
Jul 25, 2024

The MACD with SAR Indicator combines the momentum-tracking capabilities of the Moving Average Convergence Divergence (MACD) with the trend-reversal logic of the Parabolic Stop and Reverse (SAR) to identify high-probability entry and exit points. By applying the SAR algorithm directly to the MACD line rather than price action, this tool provides a unique perspective on trend transitions and momentum shifts.
Usage
The indicator is designed to simplify the identification of trend reversals. Users can look for the following signals:
- Trend Reversal Labels: The script automatically plots "L" (Long) and "S" (Short) labels when the MACD line crosses the SAR line.
- Momentum Shifts: The color-coded histogram indicates whether momentum is strengthening or weakening. Bright colors represent increasing momentum, while faded colors suggest a potential slowdown.
- Filtering: Traders can use the traditional MACD/Signal line crossovers in conjunction with the SAR labels to confirm entries. For example, an "L" label coinciding with a bullish MACD crossover may indicate a stronger trend change.
Details
Unlike standard setups where the SAR tracks price, this indicator calculates the SAR based on the MACD oscillator values. This implementation filters out minor price noise and focuses on the underlying momentum trend. The script allows users to choose between Simple Moving Averages (SMA) and Exponential Moving Averages (EMA) for both the MACD calculation and the signal line smoothing, offering greater flexibility for different asset classes.
Settings
MACD Settings
- Fast Length: The period for the shorter moving average (default: 28).
- Slow Length: The period for the longer moving average (default: 38).
- Source: The price data used for calculations (default: close).
- Signal Smoothing: The smoothing period for the MACD signal line (default: 9).
- Oscillator MA Type: Choose between SMA or EMA for the MACD lines.
- Signal Line MA Type: Choose between SMA or EMA for the signal line.
SAR Settings
- Start: The initial acceleration factor for the Parabolic SAR (default: 0.01).
- Increment: The step value added to the acceleration factor each time a new extreme point is reached (default: 0.01).
- Maximum: The cap for the acceleration factor (default: 0.18).
Visuals
- Display MACD_SAR Oscillator / MACD: Toggles the visibility of the SAR-based components versus the standard MACD components.
- Oscillator Line Width: Adjusts the thickness of the SAR plot.
FAQ
How do I interpret the "L" and "S" labels?
The "L" (Long) label appears when the MACD line crosses above the SAR line, suggesting a bullish shift. The "S" (Short) label appears when the MACD line crosses below the SAR line, suggesting a bearish shift.
Can I set alerts for these signals?
Yes, the script includes alert conditions for histogram state changes, MACD/Signal crossovers, and the SAR-based Long/Short signals.
How can I access the MACD with SAR Indicator?
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.