What is Parabolic SAR?
The Parabolic Stop and Reverse (SAR) indicator, developed by J. Welles Wilder Jr., is a time and price based trading tool used to determine the direction of an asset's momentum and the point at which to place a stop-loss or take profit. It's often visualized as a series of dots, either above or below the price bars, indicating the current trend direction.
A primary strength of the Parabolic SAR is its ability to adapt to accelerating trends. As a trend develops, the SAR dots accelerate towards the price, tightening the stop-loss level and locking in more profits. When the trend reverses, the dots "stop and reverse" to the other side of the price, signaling a potential new trend.
Components and Calculation
The Parabolic SAR calculation involves several key elements:
- Start (Initial) Acceleration Factor (AF): Typically 0.02.
- Increment: The amount by which the AF increases with each new high/low (e.g., 0.02).
- Maximum Acceleration Factor (Max AF): The upper limit for the AF (e.g., 0.20).
- Extreme Point (EP): The highest high during an uptrend or the lowest low during a downtrend.
The SAR calculation is complex and recursive, but essentially, it determines the SAR value for the current bar based on the previous SAR value, the Extreme Point of the current trend, and the Acceleration Factor. The AF increases as the trend progresses, making the SAR line accelerate towards the price.
Basic Parabolic SAR Implementation in Pine Script
Pine Script v5 makes implementing Parabolic SAR very straightforward with the built-in `ta.sar()` function.
//@version=5
indicator("My Parabolic SAR Indicator", overlay=true)
// Inputs for Parabolic SAR parameters
start = input.float(0.02, title="Start AF")
increment = input.float(0.02, title="Increment")
maximum = input.float(0.20, title="Maximum AF")
// Calculate Parabolic SAR using the built-in function
sarValue = ta.sar(start, increment, maximum)
// Plot the Parabolic SAR dots
// Color dots based on whether SAR is below (uptrend) or above (downtrend) the price
plot(sarValue, "SAR", style=plot.style_circles, linewidth=2, color=sarValue < close ? color.green : color.red)
Practical Parabolic SAR Strategies
1. Trend Following and Reversal Signals
The most direct application of Parabolic SAR is for trend identification and reversal signals. It's a stop-and-reverse system by design:
- Buy Signal: When the SAR dots flip from being above the price to below the price.
- Sell Signal: When the SAR dots flip from being below the price to above the price.
//@version=5
strategy("Parabolic SAR Trend Strategy", overlay=true)
start = input.float(0.02, title="Start AF")
increment = input.float(0.02, title="Increment")
maximum = input.float(0.20, title="Maximum AF")
// Calculate Parabolic SAR
sarValue = ta.sar(start, increment, maximum)
// Determine if SAR has flipped (trend reversal)
longCondition = ta.crossover(close, sarValue)
shortCondition = ta.crossunder(close, sarValue)
// Strategy entries/exits
if (longCondition)
strategy.entry("Long", strategy.long)
if (shortCondition)
strategy.entry("Short", strategy.short)
// Plot SAR
plot(sarValue, "SAR", style=plot.style_circles, linewidth=2, color=sarValue < close ? color.green : color.red)
2. Parabolic SAR as a Dynamic Stop-Loss / Trailing Stop
Parabolic SAR is an excellent tool for placing dynamic stop-loss orders. As the trend progresses, the SAR dots move closer to the price, effectively trailing the market. This helps protect profits while still allowing the trade to run.
//@version=5
strategy("Parabolic SAR Dynamic Stop-Loss", overlay=true)
// Inputs for Parabolic SAR
start = input.float(0.02, title="Start AF")
increment = input.float(0.02, title="Increment")
maximum = input.float(0.20, title="Maximum AF")
// Calculate Parabolic SAR
sarValue = ta.sar(start, increment, maximum)
// Example entry logic (e.g., simple moving average crossover)
fastMA = ta.ema(close, 20)
slowMA = ta.ema(close, 50)
longEntry = ta.crossover(fastMA, slowMA)
shortEntry = ta.crossunder(fastMA, slowMA)
// Long strategy with SAR as stop-loss
if (longEntry)
strategy.entry("Buy", strategy.long)
strategy.exit("Long Exit", from_entry="Buy", stop=sarValue) // SAR as trailing stop
// Short strategy with SAR as stop-loss
if (shortEntry)
strategy.entry("Sell", strategy.short)
strategy.exit("Short Exit", from_entry="Sell", stop=sarValue) // SAR as trailing stop
// Plot SAR
plot(sarValue, "SAR", style=plot.style_circles, linewidth=2, color=sarValue < close ? color.green : color.red)
Optimizing Parabolic SAR Performance
To get the most out of Parabolic SAR in Pine Script:
- Parameter Tuning: Adjust `start`, `increment`, and `maximum` AF values. A smaller increment results in a smoother SAR that's further from price, while a larger increment makes it more sensitive and closer to price.
- Combine with Other Indicators: Parabolic SAR is best used as a trend-confirming or stop-loss tool. Combine it with trend strength indicators (like ADX) or oscillators (like RSI, MACD) to filter false signals.
- Multi-Timeframe Analysis: Confirm SAR signals on a higher timeframe before acting on signals from a lower timeframe.
- Filter Ranging Markets: Avoid using Parabolic SAR alone in choppy or sideways markets, as it can generate frequent false signals (whipsaws).
Common Parabolic SAR Pitfalls
- Whipsaws: In non-trending or highly volatile, non-directional markets, SAR can produce many premature stop-and-reverse signals, leading to multiple small losses.
- Lagging: While it accelerates towards price, it is still a lagging indicator. Signals may sometimes come after a significant portion of the move has already occurred.
- Not a standalone entry signal: It's more effective as a trailing stop or exit signal rather than a primary entry signal, especially without confluence from other indicators.
Conclusion
The Parabolic SAR is a unique and effective indicator in Pine Script for identifying trends and managing trades with dynamic stop-loss levels. Its ability to accelerate towards price makes it excellent for capturing profits in strong trends. By understanding its calculation and combining it judiciously with other indicators and market analysis, you can leverage Parabolic SAR to enhance your TradingView strategies and improve your trade management.
Enhance Your Trading
Get a high-performance Pine Script analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Subscribe now @ $99/month