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
inPriceHL— High and low price series
Outputs
outReal— SAR stop level; positive while long, negative while short
Parameters
optInStartValue— Initial SAR/direction: 0 auto, >0 start long at value, <0 start short at |value|optInOffsetOnReverse— Fractional offset applied to the stop on each reversaloptInAccelerationInitLong— Initial acceleration factor when longoptInAccelerationLong— AF increment per new long extremeoptInAccelerationMaxLong— Cap on the long acceleration factoroptInAccelerationInitShort— Initial acceleration factor when shortoptInAccelerationShort— AF increment per new short extremeoptInAccelerationMaxShort— Cap on the short acceleration factor
Implementation
TA-Lib Definition: sarext.c · sarext.yaml
| Native | File |
|---|---|
| C | ta_SAREXT.c |
| Rust | sarext.rs |
| Java | Core.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Parabolic SAR Extended, Extended Parabolic Stop and Reverse