Indicators/probuilder · probacktest · proorder · proscreener

SARatdmf

SARatdmf in ProBuilder returns a smoothed Parabolic SAR with adjustable acceleration factor, step and maximum. Syntax, parameters, examples, interpretation.

Syntax

probuilder
SARatdmf[At, St, Lim]

The standard configuration mirrors the classic Parabolic SAR defaults:

probuilder
SARatdmf[0.02, 0.02, 0.2]

Parameters

NameTypeDefaultDescription
Atdecimal0.02Acceleration factor. Controls how fast the SAR converges toward price, higher values make the trail hug price sooner.
Stdecimal0.02Step. The increment added to the acceleration factor each time the trend prints a new extreme.
Limdecimal0.2Maximum. Upper cap on the acceleration factor, preventing the trail from becoming oversensitive in extended trends.

Formula

The underlying Parabolic SAR recursion is:

code
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 Lim

SARatdmf 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)

probuilder
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 signal

Computes 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)

probuilder
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
ENDIF

A 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)

probuilder
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

ConfigurationReading
Price above the trailUptrend in progress, the trail acts as a rising stop level.
Price below the trailDowntrend in progress, the trail acts as a falling stop level.
Close crossing the trailStop 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 Lim lower than At caps the factor immediately, producing a sluggish trail that barely tightens. Keep At <= Lim.
  • Always-in-market assumption. SAR logic flips rather than going flat. Porting Example 2 to a long-only account requires replacing the SELLSHORT branch 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.