Trend Indicators

Parabolic SAR: Trailing Stops & Reversals

In this page: what Parabolic SAR is, how it works, when to use it, a practical example with code, and a bonus tip.

๐Ÿ“– 7 min read

๐Ÿ“ 1,356 words

๐Ÿท๏ธ Trend Indicators

Parabolic SAR on a price chart: illustration of the indicator and how it is used in technical analysis
Parabolic SAR โ€“ chart illustration

Parabolic SAR (Stop and Reverse) Indicator Explanation

The Parabolic SAR (Stop and Reverse) is a trend-following indicator that provides entry and exit signals along with dynamic stop-loss levels. Developed by J. Welles Wilder Jr. in 1978 and introduced in his book "New Concepts in Technical Trading Systems," Parabolic SAR appears as dots above or below price on a chart. When dots are below price, it indicates an uptrend and provides trailing stop-loss levels. When dots are above price, it indicates a downtrend and provides trailing stop-loss levels. The indicator accelerates as the trend progresses, making it particularly effective for capturing extended trends while managing risk through dynamic stop-losses.

How Parabolic SAR Works: Parabolic SAR is calculated using an acceleration factor (AF) that starts at 0.02 and increases by 0.02 each time a new extreme price (EP) is reached, up to a maximum of 0.20. The formula is: SAR = Prior SAR + AF ร— (EP - Prior SAR). In an uptrend, the EP is the highest high since the trend began, and in a downtrend, the EP is the lowest low. The SAR dots flip from below price to above price (or vice versa) when price crosses the SAR level, signaling a trend reversal. The acceleration factor ensures that the SAR moves closer to price as the trend progresses, providing tighter stop-losses in strong trends.

When to Use Parabolic SAR:

  • Trend Following with Trailing Stops: Parabolic SAR is highly effective for trend-following strategies as it provides clear entry signals (when SAR flips below price) and exit signals (when SAR flips above price) with automatic trailing stop-loss levels. The indicator works best in trending markets with clear directional movement.
  • Dynamic Stop-Loss Management: The accelerating nature of Parabolic SAR means that stop-losses tighten as trends progress, allowing traders to lock in profits while staying in strong trends. This feature makes it valuable for managing risk in extended trends.
  • Trend Reversal Identification: When Parabolic SAR flips from one side of price to the other, it signals a potential trend reversal. This can be used to exit existing positions and enter new positions in the opposite direction.

Advantages:

  • Provides clear, objective entry and exit signals without requiring interpretation, making it easy to implement in automated trading systems. The automatic trailing stop feature helps with risk management.
  • The accelerating stop-loss mechanism allows traders to lock in profits as trends progress, improving risk-reward ratios in strong trending markets. The stop-losses tighten automatically as trends strengthen.
  • Works effectively in trending markets across multiple asset classes, including stocks, forex, commodities, and cryptocurrencies. The indicator is particularly useful for medium to long-term trend following.

Limitations:

  • Parabolic SAR can produce false signals in ranging or sideways markets when price oscillates around the indicator, leading to whipsaws and multiple small losses. The indicator works best in clearly trending markets with sustained directional movement.
  • The indicator may lag behind price movements during rapid trend changes, as it relies on extreme prices and acceleration factors. This lag can result in delayed entry and exit signals, potentially missing significant portions of profitable moves.
  • Parabolic SAR does not provide information about trend strength or momentum, only trend direction and stop-loss levels. Traders should combine it with momentum indicators for more comprehensive analysis.

In summary, Parabolic SAR is a valuable trend-following indicator that provides clear signals with dynamic trailing stop-losses, making it ideal for traders seeking to capture extended trends while managing risk. For comprehensive understanding, refer to Wilder's original work "New Concepts in Technical Trading Systems" (1978) (opens in a new tab), Investopedia's Parabolic SAR guide (opens in a new tab), TradingView's Parabolic SAR documentation (opens in a new tab), and academic research on trend-following indicators in technical analysis published in journals such as the Journal of Financial Markets and the Review of Financial Studies.

Stop loss below and take profit above an entry, with a trailing stop stepping up behind it.take profitentrystop losstrailing stop follows
Where the risk levels sit around an entry. Positions only โ€” the drawing says nothing about what happens.

Practical Example: Using the Parabolic SAR Indicator in a Trading Strategy

The Parabolic SAR (Stop and Reverse) is a trend-following indicator used to identify trend direction and provide dynamic trailing stop-loss levels. In a trading strategy, the Parabolic SAR indicator helps traders make entry and exit decisions based on trend direction with automatic stop-loss management.

Scenario: You're creating a trend-following strategy for Gold (XAU/USD) on a 1-hour chart. You want to buy when Parabolic SAR flips below price (indicating uptrend) and sell when it flips above price (indicating downtrend), using the SAR dots as trailing stop-losses.

Strategy Logic:

  • Calculate the Parabolic SAR(0.02, 0.20) with an initial acceleration factor of 0.02 and a maximum of 0.20. The Parabolic SAR provides clear buy signals when dots flip below price and sell signals when dots flip above price, with the dots acting as trailing stop-losses.
  • Buy signal: When Parabolic SAR dots flip from above price to below price, indicating an uptrend has begun. The dots below price act as trailing stop-losses that accelerate as the trend progresses.
  • Sell signal: When Parabolic SAR dots flip from below price to above price, indicating a downtrend has begun or the uptrend has ended. Exit the position immediately.

Backtrader Example:

python
import backtrader as bt

class ParabolicSARStrategy(bt.Strategy):
    params = dict(
        af_start=0.02,
        af_increment=0.02,
        af_max=0.20
    )
    
    def __init__(self):
        self.psar = bt.ind.PSAR(af=self.p.af_start, afmax=self.p.af_max)
        
    def next(self):
        if not self.position:
            # Buy when SAR flips below price (uptrend)
            if (self.data.close[0] > self.psar[0] and 
                self.data.close[-1] <= self.psar[-1]):
                self.buy()
        else:
            # Sell when SAR flips above price (downtrend)
            if (self.data.close[0] < self.psar[0] and 
                self.data.close[-1] >= self.psar[-1]):
                self.sell()

# Usage
cerebro = bt.Cerebro()
cerebro.addstrategy(ParabolicSARStrategy)

Expected Outcome: By using the Parabolic SAR indicator, your strategy follows trends with clear entry and exit signals, while the trailing stop-loss feature helps lock in profits as trends progress. This approach leads to better trend-following performance, improved profit protection, and enhanced risk management by automatically adjusting stop-losses as trends strengthen.

๐Ÿ’ก Bonus Tip

Consider using Parabolic SAR in combination with ADX for trend strength confirmation. When Parabolic SAR indicates an uptrend and ADX is above 25, it suggests a strong trend with higher probability of continuation. This technique, documented in Wilder's original methodology, can significantly improve the reliability of Parabolic SAR-based trading strategies.

Using the Parabolic SAR indicator ensures your strategy follows trends effectively with dynamic trailing stop-losses, improving entry and exit timing based on trend direction and automatic risk management.

Build a Parabolic SAR EA for MT5

A Parabolic SAR Expert Advisor automates the stop-and-reverse idea: long while price is above the dots, short while it is below, and a reversal on the bar price crosses them.

In the builder. Parabolic SAR is one of the 47 indicator types in the Strategy Builder. In Step 3 (Entry rules) add it and write the buy rule as price crossing above the SAR, the sell rule as price crossing below it. Exit on the opposite flip, or add an ATR-based trailing stop in Step 5, then get the MQL5 code in Step 7.

SettingBuilder defaultRange
Start acceleration0.020.001 โ€“ 0.5
Increment0.020.001 โ€“ 0.5
Maximum acceleration0.20.01 โ€“ 1

H1 or H4 is a sensible first timeframe: M15 flips far more often, D1 is slow.

In hand-written MQL5. One iSAR (opens in a new tab) handle gives the dot value on every bar; read it with CopyBuffer (opens in a new tab) on the last closed bar so the signal does not change while the current bar forms:

// OnInit
sarHandle = iSAR(_Symbol, PERIOD_H1, 0.02, 0.2);

// OnTick, once per new bar
CopyBuffer(sarHandle, 0, 1, 1, sar);   // SAR on the last closed bar
bool buyFlip  = close[1] > sar[0];     // closed above the dot
bool sellFlip = close[1] < sar[0];     // closed below the dot

What goes wrong. SAR alone whipsaws in tight ranges, which is why many traders pair it with a trend filter or a higher-timeframe bias, or add a Market conditions (ATR volatility) filter in Step 4. A low increment raises the flip count; the maximum acceleration caps how fast the dots catch up in a strong trend. Spread widening is where tester and live results part, so a Spread limit helps. If you code it yourself, compare your last five flips with a Parabolic SAR study on the same chart before running the EA on demo.