Deviation
Indicator
Deviation to MA is the close divided by the average of earlier closes, minus 1, showing how far price has stretched from its average. The first bar is 0.
The disparity idea is in Steve Nison, Beyond Candlesticks (1994), where it is scaled by 100. This kernel keeps the fraction. Reviewed by the ChartLabs team, updated Nov 2026.
Deviation To MA is -0.034.
Deviation To MA -0.034
Deviation To MA is -0.034.
Deviation To MA -0.034
Illustration on simulated data.
Deviation To MAWhat is the Deviation indicator?
Length is 14. There is no source menu. The close is fixed. Record 0 writes 0.000. After that, the average is the mean of the previous closes, up to 14 of them, not including the current close.
A close of 10 followed by a close of 12 is 12 / 10 − 1, which is 0.200. The line prints three decimals. It is not multiplied by 100, so this is not a reading of 20.
The line is #999999, 1 px, in its own panel. If the mean of those earlier closes is 0, the bar is empty. The window never grows past Length. A long chart does not average the whole history.
Prior bars only
Today's close is the numerator. It is not inside the average it is compared with.
A fraction
0.200 means the close is 20 percent above that mean. The plotted number is still 0.200.
Deviation signalsFour patterns to know.
Above zero
The close is above the mean of the earlier closes. The example is 0.200.
Below zero
The close is under that mean, so the fraction is negative.
On zero
The close equals the mean, or it is record 0, which is forced to 0.000.
A large fraction
The close is far from the recent mean. The line does not say it must return.
Deviation formulaHow it is calculated.
Write 0 on the first bar
There is no earlier close. Record 0 is 0.000.
Average the earlier closes
Up to the last 14, not including this bar. In the example the mean is 10.
Divide and subtract 1
12 / 10 − 1 is 0.200. Leave it as a fraction.
Deviation settingsEvery setting, explained.
| Setting | Default | Range | What it changes |
|---|---|---|---|
| Length | 14 | 1 to 5,000 | How many earlier closes are averaged. The Signal lens changes this. |
| Line | #999999 | Fixed | One line, 1 px, 3 decimals. The close is the only source. |
| First bar | 0 | Fixed | Record 0 is 0.000. |
- Setting
- Length
- Default
- 14
- Range
- 1 to 5,000
- What it changes
- How many earlier closes are averaged. The Signal lens changes this.
- Setting
- Line
- Default
- #999999
- Range
- Fixed
- What it changes
- One line, 1 px, 3 decimals. The close is the only source.
- Setting
- First bar
- Default
- 0
- Range
- Fixed
- What it changes
- Record 0 is 0.000.
Drag to see how the setting changes the lines and how many signals you get. Illustration on simulated data.
Deviation strategiesUse it in 3 setups.
Read a positive fraction as a close above the mean
Traders often look at whether price is stretched versus that mean. The plot itself stays in fraction form.
Do not trade record 0
It is not a real deviation. The second bar is the first comparison.
A negative print
The same formula, with the close below the average.
Deviation mistakesCommon mistakes.
Multiplying by 100 in your head and quoting that as the line
Nison's disparity index is times 100. This kernel stops at the fraction. The example line is 0.200, not 20.
Including today in the average
The mean is the earlier closes only. Putting 12 into the average will not match 0.200.
Expecting a source menu
The close is fixed. Length is the only input.
Deviation combinationsPair it with these.
Deviation + SMA
The SMA is the average this line divides by, except the SMA on a chart usually includes the current bar and this mean does not.
Deviation + Rate of Change
ROC compares the close with one earlier close. This compares the close with the mean of up to 14 earlier closes.
Deviation + Bollinger Bands
Bollinger measures distance in standard deviations. This is a plain percent gap from the mean, stored as a fraction.
Deviation FAQQuestions traders ask.
What is the Deviation to MA setting?
Length 14. There is no source. The close is fixed.
What is the worked pair?
Close 10, then close 12. Record 0 is 0.000. Record 1 is 0.200.
Why not 20?
The kernel does not multiply by 100. 0.200 is the fraction. A book disparity index would show 20.
Which closes are averaged?
The ones before the current bar, at most 14 of them.
What colour is the line?
#999999, 1 px, three decimals.
What if the mean is 0?
The bar is left empty. A mean of 0 has no fraction to plot.
Does it repaint?
No. A closed bar stays. The live bar moves until it closes.
Who described this idea?
Steve Nison, Beyond Candlesticks (1994), as the disparity index. This plot keeps his ratio and drops the times 100.
Related indicatorsMore statistical tools.
All statistical indicatorsTry Deviation on a live chart.
Free. No download.
Works in your browser and on iPhone too.