Parabolic SAR
Created by J. Welles Wilder, Parabolic SAR (stop and reverse) is a price-time based indicator used to determine trend direction and reversals. [Discuss] 💬
// C# usage syntax (standard)
IReadOnlyList<ParabolicSarResult> results =
bars.ToParabolicSar(accelerationStep, maxAccelerationFactor);
// alternate usage with custom initial Factor
IReadOnlyList<ParabolicSarResult> results =
bars.ToParabolicSar(accelerationStep, maxAccelerationFactor, initialFactor);Parameters
| param | type | description |
|---|---|---|
accelerationStep | double | Incremental step size for the Acceleration Factor. Must be greater than 0. Default is 0.02 |
maxAccelerationFactor | double | Maximum factor limit. Must be greater than accelerationStep. Default is 0.2 |
initialFactor | double | Optional. Initial Acceleration Factor. Must be greater than 0 and not larger than maxAccelerationFactor. Default is accelerationStep. |
Historical price bars requirements
You must have at least two historical price bars to cover the warmup periods; however, we recommend at least 100 data points. Initial Parabolic SAR values prior to the first reversal are not accurate and are excluded from the results. Therefore, provide sufficient bars to capture prior trend reversals, before your intended usage period.
bars is a collection of generic TBar historical price bars. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
Response
IReadOnlyList<ParabolicSarResult>- This method returns a time series of all available indicator values for the
barsprovided. - It always returns the same number of elements as there are in the historical price bars.
- It does not return a single incremental indicator value.
- The first trend will have
nullvalues since it is not accurate and based on an initial guess.
ParabolicSarResult
| property | type | description |
|---|---|---|
Timestamp | DateTime | Date from evaluated TBar |
Sar | double | Stop and Reverse value |
IsReversal | bool | Indicates a trend reversal |
Utilities
See Utilities and helpers for more information.
Chaining
Results can be further processed on Sar with additional chain-enabled indicators.
// example
var results = bars
.ToParabolicSar(..)
.ToEma(..);This indicator must be generated from bars and cannot be generated from results of another chain-enabled indicator or method.
See Chaining indicators for more.
Streaming
Use the buffer-style List<T> when you need incremental calculations without a hub:
ParabolicSarList psarList = new(accelerationStep, maxAccelerationFactor);
foreach (IBar bar in bars) // simulating stream
{
psarList.Add(bar);
}
// based on `ICollection<ParabolicSarResult>`
IReadOnlyList<ParabolicSarResult> results = psarList;Subscribe to a BarHub for advanced streaming scenarios:
BarHub barHub = new();
ParabolicSarHub observer = barHub.ToParabolicSarHub(accelerationStep, maxAccelerationFactor);
foreach (IBar bar in bars) // simulating stream
{
barHub.Add(bar);
}
IReadOnlyList<ParabolicSarResult> results = observer.Results;See Buffer lists and Stream hubs for full usage guides.