Parabolic SAR
All indicators

LibraryTrend

Indicator

Parabolic SAR

Welles Wilder's Parabolic stop and reverse: a trailing stop that closes in on price faster the longer a trend runs, and changes side when it is hit.

TrendOn the price2 inputsPSAR

How it is calculated

Each bar the stop moves towards the trend's extreme point by af times the gap; af starts at acceleration and grows by it on every new extreme, up to maximum. A low at or under the stop (a high at or over it when short) reverses: the stop jumps to the old extreme. It never enters the range of this bar or the one before. As TA-Lib's SAR the first bar only seeds and the second picks the side from the directional movement; direction is +1 long, -1 short.

Reference: TA-Lib SAR (Wilder 1978)

How to read it

Dots below price mark a long trend, above price a short one, and a switch is a reversal signal. It works in clean trends and gets whipsawed in ranges, where it is always in the market. A higher acceleration pulls the stop in tighter.

In a strategy

As a trailing Stop-Loss: exit a long when the close falls below ctx.ind("psar", acceleration=0.02, maximum=0.2).sar, or trade the switches of .direction with a trend filter.

Inputs

InputTypeDefaultRange or choices
AccelerationaccelerationNumber0.02min 0.001, max 1
MaximummaximumNumber0.2min 0.001, max 1

What it draws

LineDrawn as
SARDots

Used in

No strategy template reads it yet.

OrionQuant