Standard Deviation

The Standard Deviation measures how far the price moves away from its moving average to assess market volatility.

Role in the strategy

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

The Standard Deviation 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 deviation value:

RuleSignal is 1 when
StdDev risesStdDev rose on the previous bar
StdDev fallsStdDev fell on the previous bar
StdDev is higher than the Level lineStdDev is above Level
StdDev is lower than the Level lineStdDev is below Level
StdDev crosses the Level line upwardStdDev crossed above Level from below
StdDev crosses the Level line downwardStdDev crossed below Level from above
StdDev changes its direction upwardStdDev formed a valley (down then up)
StdDev changes its direction downwardStdDev formed a peak (up then down)

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

Parameters

ParameterTypeDefaultRangePurpose
Apply toselectCloseOpen, High, Low, Close, Median, Typical, WeightedPrice series the deviation is calculated from
MA methodselectSimpleSimple, Exponential, Weighted, SmoothedSmoothing method of the reference average
Periodnumber202 to 1000Bars of the average and the deviation
Levelnumber00 to 10000Threshold for the level rules

Calculation

tech.StdDev in engine/indicator-engine/tech.ts computes the standard deviation of the selected price series around its moving average over the Period. The 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.