Standard Deviation
The Standard Deviation measures how far the price moves away from its moving average to assess market volatility.
Role in the strategy
| Slot | Available | Role |
|---|---|---|
| Entry Point | No | — |
| Entry Rule | Yes | Filters entries by the deviation direction or its level position. |
| Exit Point | No | — |
| Exit Rule | Yes | Triggers 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:
| Rule | Signal is 1 when |
|---|---|
| StdDev rises | StdDev rose on the previous bar |
| StdDev falls | StdDev fell on the previous bar |
| StdDev is higher than the Level line | StdDev is above Level |
| StdDev is lower than the Level line | StdDev is below Level |
| StdDev crosses the Level line upward | StdDev crossed above Level from below |
| StdDev crosses the Level line downward | StdDev crossed below Level from above |
| StdDev changes its direction upward | StdDev formed a valley (down then up) |
| StdDev changes its direction downward | StdDev 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
| Parameter | Type | Default | Range | Purpose |
|---|---|---|---|---|
| Apply to | select | Close | Open, High, Low, Close, Median, Typical, Weighted | Price series the deviation is calculated from |
| MA method | select | Simple | Simple, Exponential, Weighted, Smoothed | Smoothing method of the reference average |
| Period | number | 20 | 2 to 1000 | Bars of the average and the deviation |
| Level | number | 0 | 0 to 10000 | Threshold 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.