SAREXT
SAREXT
Summary
Extended Parabolic SAR (stop and reverse) giving the caller full control over the initial state and separate acceleration factors for long and short positions. Unlike SAR, it returns negative values while short so reversals are distinguishable. Sign flip of the output marks a trend reversal (positive=long stop, negative=short stop).
Formula
SAR_next = SAR + AF*(EP - SAR), then clamped within the prior and current bar's range. On penetration, reverse: set SAR=EP (clamped), reset AF to its Init value, EP=extreme of the new direction. Output is +SAR when long, -SAR when short. On reversal an optional offset is applied: long->short SAR*(1+offset), short->long SAR*(1-offset).
Inputs
inHigh— High price of each barinLow— Low price of each bar
Outputs
outReal— SAR stop level; positive while long, negative while short
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInStartValue | real | 0 | any real | Initial SAR/direction: 0 auto, >0 start long at value, <0 start short at |value| |
optInOffsetOnReverse | real | 0 | ≥ 0 | Fractional offset applied to the stop on each reversal |
optInAccelerationInitLong | real | 0.02 | ≥ 0 | Initial acceleration factor when long |
optInAccelerationLong | real | 0.02 | ≥ 0 | AF increment per new long extreme |
optInAccelerationMaxLong | real | 0.2 | ≥ 0 | Cap on the long acceleration factor |
optInAccelerationInitShort | real | 0.02 | ≥ 0 | Initial acceleration factor when short |
optInAccelerationShort | real | 0.02 | ≥ 0 | AF increment per new short extreme |
optInAccelerationMaxShort | real | 0.2 | ≥ 0 | Cap on the short acceleration factor |
Properties
Numerical Stability: Path-Dependent
| Display Flags |
|---|
| ✅ Overlap Input i |
| ☐ Independent Y-Axis |
| ☐ Candlestick |
Implementation
TA-Lib Definition: sarext.c · sarext.yaml
| Native | File |
|---|---|
| C | ta_SAREXT.c |
| Rust | sarext.rs |
| Java | Core_SAREXT.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Parabolic SAR Extended, Extended Parabolic Stop and Reverse