SARatdmf
SARatdmf in ProBuilder returns a smoothed Parabolic SAR with adjustable acceleration factor, step and maximum. Syntax, parameters, examples, interpretation.
Syntax
SARatdmf[At, St, Lim]The standard configuration mirrors the classic Parabolic SAR defaults:
SARatdmf[0.02, 0.02, 0.2]Parameters
| Name | Type | Default | Description |
|---|---|---|---|
At | decimal | 0.02 | Acceleration factor. Controls how fast the SAR converges toward price, higher values make the trail hug price sooner. |
St | decimal | 0.02 | Step. The increment added to the acceleration factor each time the trend prints a new extreme. |
Lim | decimal | 0.2 | Maximum. Upper cap on the acceleration factor, preventing the trail from becoming oversensitive in extended trends. |
Formula
The underlying Parabolic SAR recursion is:
SAR[next] = SAR + AF * (EP - SAR)
where EP = extreme point of the current trend
AF = acceleration factor, starting at At,
increased by St at each new extreme, capped at LimSARatdmf applies an additional smoothing stage to this classic calculation, producing a less jagged trail than the raw SAR instruction. The exact smoothing method is internal to the platform.
How it works
Like the standard Parabolic SAR, SARatdmf plots a trailing level below price in uptrends and above price in downtrends. Each new extreme in the trend direction increases the acceleration factor, so the trail starts loose and tightens as the trend matures. When price touches the trail, the indicator reverses side and restarts with the initial acceleration, which is why SAR-family indicators are always in the market, always long or short by construction.
The smoothed variant changes the character of the trail rather than the mechanics. Smoothing filters the small oscillations that cause the raw SAR to flip prematurely in choppy phases, at the cost of slightly later reversals. The three parameters offer the usual trade-off: raising At or St tightens the trail and produces earlier but noisier flips, lowering them or reducing Lim gives the trend more room.
The instruction takes no price argument, it operates on the instrument's high and low series directly, so the whole call is bracket-only.
Examples
Example 1, Sell signal on a SAR cross (Indicator)
i1 = SARatdmf[0.02,0.02,0.2]
// Previous close above the trail, current close below it: bearish flip
IF(close[1] > i1[1] AND close < i1) THEN
signal = -1
ELSE
signal = 0
ENDIF
RETURN signalComputes the smoothed SAR with standard parameters and emits -1 on the bar where the close crosses from above to below the trail, the classic SAR sell event.
Example 2, Stop-and-reverse position management (ProOrder)
DEFPARAM CumulateOrders = false
trail = SARatdmf[0.02,0.02,0.2]
// Price above the trail: hold a long position
IF close CROSSES OVER trail THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Price below the trail: reverse to short
IF close CROSSES UNDER trail THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIFA symmetric stop-and-reverse system. Each cross of the smoothed SAR closes the current position and opens the opposite one, so the strategy is always in the market, matching the indicator's design.
Example 3, Screening for fresh bearish flips (ProScreener)
trail = SARatdmf[0.02,0.02,0.2]
flip = close CROSSES UNDER trail
SCREENER[flip](close AS "Last price")Returns instruments whose close crossed under the smoothed SAR on the current bar, candidates that just triggered a SAR-style sell.
Interpretation
| Configuration | Reading |
|---|---|
| Price above the trail | Uptrend in progress, the trail acts as a rising stop level. |
| Price below the trail | Downtrend in progress, the trail acts as a falling stop level. |
| Close crossing the trail | Stop and reverse event, trend classification flips. |
SAR-family indicators perform well in sustained trends, where the accelerating trail locks in progressively more of the move. In sideways markets they generate alternating flips with small losses on each, so a separate trend or volatility filter is usually applied before acting on reversals. The smoothing in SARatdmf reduces, but does not eliminate, this whipsaw behaviour.
Common errors and gotchas
- No price argument. The call is bracket-only.
SARatdmf[0.02,0.02,0.2](close)raises a syntax error, the indicator reads highs and lows internally. - Maximum below the start disables acceleration. Setting
Limlower thanAtcaps the factor immediately, producing a sluggish trail that barely tightens. KeepAt <= Lim. - Always-in-market assumption. SAR logic flips rather than going flat. Porting Example 2 to a long-only account requires replacing the
SELLSHORTbranch with a plain exit, otherwise the backtest holds unintended short exposure. - Whipsaw in ranges. Repeated flips in consolidation phases are inherent to the design. Smoothing delays them slightly but frequent small losses in sideways markets remain the primary failure mode.
Related instructions
SAR, the standard unsmoothed Parabolic SAR.Supertrend, ATR-based trailing stop with similar flip behaviour.ChandeKrollStopUp, volatility stop line above price.ChandeKrollStopDown, volatility stop line below price.AverageTrueRange, volatility measure used by comparable trailing stops.ExponentialAverage, general-purpose smoothing for custom trails.Highest, highest value over N bars, useful for extreme-point logic.Lowest, lowest value over N bars, the mirror helper.
