Expand description
§Parabolic SAR (Stop and Reverse)
Classic Welles Wilder trailing stop:
SAR_t = SAR_{t−1} + AF * (EP − SAR_{t−1})with acceleration factor AF starting at start, stepping by increment up to maximum
when EP makes new extremes, and flipping long/short when price crosses SAR.
Default: (0.02, 0.02, 0.20) (SarParams::standard).
First bar is warm-up (None); SAR starts at bar 1.
§Trading perspective
| Reading | Habit (classic) |
|---|---|
| SAR below price (dir +1) | Long / trail under |
| SAR above price (dir −1) | Short / trail over |
| Flip | Stop-and-reverse system signal |
SAR is aggressive in chop (many flips). Often filtered by ADX or a slow MA.
§vs Supertrend
| SAR | Supertrend | |
|---|---|---|
| Mechanism | AF toward extreme point | ATR bands around mid |
| Feel | Can hug price tightly | Smoother ATR trail |
| Choppy markets | Whipsaws more | Mult tuning helps |
Many desks pick one primary trail (SAR or Supertrend), not both as simultaneous entry signals.
§Pairs well with
- ADX — only reverse with SAR when ADX shows trend (or only enter with SAR + ADX).
- RSI — avoid long SAR flips into overbought extremes without confirmation.
- ATR — independent stop size check (SAR distance ≠ risk budget).
§Engineering
SarParams → sar / SarState → sar_solution. Batch via state.
Initial long/short seed uses a simple first-bar extreme heuristic (documented convention;
platforms differ slightly on the very first flip).
Structs§
- SarBar
Output - SarParams
- Parabolic SAR acceleration parameters.
- SarSeries
- SarSolution
- SarState
- Incremental Parabolic SAR.
- Validated
Sar
Functions§
- sar
- sar_
solution - Examples