Deviation To MA

Deviation
Indicator

StatisticalSeparate panelFree on ChartLabs

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.

Example market1hIndicatorsAtlas AIDeviationchartlabs.co/charts
Atlas reads it

Deviation To MA is -0.034.

Deviation To MA -0.034

Atlas reads it

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.

1Bullish lean

Above zero

The close is above the mean of the earlier closes. The example is 0.200.

2Bearish lean

Below zero

The close is under that mean, so the fraction is negative.

3Inconclusive

On zero

The close equals the mean, or it is record 0, which is forced to 0.000.

4Inconclusive

A large fraction

The close is far from the recent mean. The line does not say it must return.

Deviation formulaHow it is calculated.

Dev=closemean−1
STEP 1

Write 0 on the first bar

There is no earlier close. Record 0 is 0.000.

STEP 2

Average the earlier closes

Up to the last 14, not including this bar. In the example the mean is 10.

STEP 3

Divide and subtract 1

12 / 10 − 1 is 0.200. Leave it as a fraction.

Deviation settingsEvery setting, explained.

SettingDefaultRangeWhat it changes
Length141 to 5,000How many earlier closes are averaged. The Signal lens changes this.
Line#999999FixedOne line, 1 px, 3 decimals. The close is the only source.
First bar0FixedRecord 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.
1416 earlier closes in the mean
70,20866,82563,44360,06164,803.7

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

Onthe example0.200is a close 20 percent above the prior mean

Traders often look at whether price is stretched versus that mean. The plot itself stays in fraction form.

Do not trade record 0

Thefirst value is0.000by rule

It is not a real deviation. The second bar is the first comparison.

A negative print

Ifthe close is under the prior meanthenthe line is negative

The same formula, with the close below the average.

Test a rule in the Strategy TesterFree with 1 year of history. Past results do not guarantee future results.

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 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 indicators

Try Deviation on a live chart.
Free. No download.

Works in your browser and on iPhone too.

Example market1h
Dev