Returns the Parabolic SAR: a stop-and-reverse level that accelerates toward price while a trend lasts and flips when price touches it.
ta.sar starts an acceleration factor at start. Each time the trend sets a new extreme, the factor grows by inc up to max, and the SAR moves that fraction of the way toward the extreme. When price touches the SAR, the trend flips and the factor resets.
The SAR is clamped so it never sits inside the highs or lows of the previous two bars. The first value appears on bar number 2, with the direction taken from the first two closes.
Syntax
ta.sar(start: simple int/float, inc: simple int/float, max: simple int/float) -> series floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| start | simple int/ | required | Initial acceleration factor, applied after each reversal. Typical value 0.02. |
| inc | simple int/ | required | Increment added to the factor on each new extreme. Typical value 0.02. |
| max | simple int/ | required | Cap for the acceleration factor. Typical value 0.2. |
Returns
series float: the stop-and-reverse price level for the current bar.
Remarks
- Plot it as dots with style =
plot.style_circlesto match the usual look. - The level depends on the chart's first bars, because the first trend direction is a guess from two closes.
Example
//@version=6
indicator("Parabolic SAR", overlay = true)
sar = ta.sar(0.02, 0.02, 0.2)
plot(sar, "SAR", color = close > sar ? color.green : color.red, style = plot.style_circles)See also
Runs on Sidechair