SAR
SAR
Summary
Wilder's Parabolic SAR (Stop And Reverse): a trailing stop/reverse level that accelerates toward price via an acceleration factor. Signals trend direction and trailing exit points. SAR below price = uptrend (long); SAR above price = downtrend (short). Price crossing SAR flips direction.
Formula
SAR_next = SAR + af * (EP - SAR)
EP = extreme point (highest high in long / lowest low in short); af starts at Acceleration, += Acceleration each new EP, capped at Maximum.
On penetration: reverse, SAR := prior EP, reset af = Acceleration. SAR clamped each bar so it does not penetrate the prior/current bar's range.
Inputs
inHigh— High price of each barinLow— Low price of each bar
Outputs
outReal— Parabolic SAR stop/reverse level per bar
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInAcceleration | real | 0.02 | ≥ 0 | Step added to the acceleration factor on each new extreme point |
optInMaximum | real | 0.2 | ≥ 0 | Ceiling on the acceleration factor |
Properties
Numerical Stability: Path-Dependent
| Display Flags |
|---|
| ✅ Overlap Input i |
| ☐ Independent Y-Axis |
| ☐ Candlestick |
Implementation
TA-Lib Definition: sar.c · sar.yaml
| Native | File |
|---|---|
| C | ta_SAR.c |
| Rust | sar.rs |
| Java | Core_SAR.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Parabolic SAR, PSAR, Stop and Reverse
See Also
References
- J. Welles Wilder, New Concepts in Technical Trading Systems, Trend Research (ISBN 0894590278)