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
| Input | Type | Default | Range or choices |
|---|---|---|---|
Accelerationacceleration | Number | 0.02 | min 0.001, max 1 |
Maximummaximum | Number | 0.2 | min 0.001, max 1 |
What it draws
| Line | Drawn as |
|---|---|
| SAR | Dots |
Used in
No strategy template reads it yet.