Average True Range

The ATR is widely used to assess the volatility of financial instruments.

Role in the strategy

SlotAvailableRole
Entry PointNo—
Entry RuleYesFilters entries by the ATR direction or its level position.
Exit PointNo—
Exit RuleYesTriggers exits by the ATR direction or its level position.

The ATR produces conditions, not order prices. As an entry rule it is ANDed with the entry point and the other entry rules; as an exit rule it is ORed with the other exit rules. See Indicators for the slot semantics.

Logic rules

The indicator offers the standard oscillator rule set, evaluated on the ATR value:

RuleSignal is 1 when
ATR risesATR rose on the previous bar
ATR fallsATR fell on the previous bar
ATR is higher than the Level lineATR is above Level
ATR is lower than the Level lineATR is below Level
ATR crosses the Level line upwardATR crossed above Level from below
ATR crosses the Level line downwardATR crossed below Level from above
ATR changes its direction upwardATR formed a valley (down then up)
ATR changes its direction downwardATR formed a peak (up then down)

The ATR measures volatility without a direction: the same signal is written for both the long and the short side (noDirectionOscillator).

Parameters

ParameterTypeDefaultRangePurpose
Periodnumber141 to 1000Bars over which the true range is averaged
Levelnumber0.010 to 10000Threshold for the level rules

Calculation

tech.ATR in engine/indicator-engine/tech.ts computes:

  • True Range = the greatest of: High − Low, |High − previous Close|, |Low − previous Close|.
  • ATR = simple moving average of the True Range over the Period.

The ATR line is drawn in a separate chart pane and is expressed in price units.

Backtesting

  • The rule is evaluated on the previous (closed) bar with the standard dead zone (SIGMA = 0.000001).
  • The indicator contributes only a single signal array copied to both directions — it never changes the entry or exit order price.
  • An entry happens only when the entry point allows the direction and every entry rule passes; an exit happens when the exit point is reached and any exit rule passes.