|
Category
Indicator Functions
Description
Directional variant of the Parabolic SAR
Syntax
JDSAR(dir {0}, accel {0.02}, max {0.2}, len {100}, jdmode {0})
Parameters
dir {0} - which stop to return: > 0 = long-side SAR (trails below price), < 0 = short-side SAR (trails above price), 0 = whichever side is currently active
accel {0.02} - initial acceleration factor
max {0.2} - maximum acceleration factor
len {100} - number of bars to use in the calculation
jdmode {0} - 0 = standard high/low trigger; non-zero = close-based variation (the stop reverses only when the close breaks it, ignoring intrabar penetration)
Notes
Unlike the standard SAR, which maintains a single stop-and-reverse line, JDSAR computes a long-side and a short-side parabolic stop independently on every bar. The dir argument selects which one to return.
This makes it possible to attach a parabolic trailing stop to a specific side of a position that was entered by some other signal, independent of the indicator's own trend state. For a long position, JDSAR(1) always returns the long-side (below-price) stop; for a short position, JDSAR(-1) returns the short-side (above-price) stop.
With dir = 0 (the default), JDSAR returns whichever side is currently active, behaving like a conventional flipping SAR.
When jdmode is non-zero, the stop is triggered by each bar's close rather than its high or low, so intrabar wicks do not cause a reversal.
Examples
Long-side parabolic trailing stop, default parameters.
ExitStop: JDSAR(-1, 0.02, 0.2, 100, 1)
Short-side stop using the close-based (jdmode) variation.
|