Mean Deviation Index

The Mean Deviation Index ( MDX ) is used to see how much price is deviating from the mean. This indicator takes both volatility and mean deviation in consideration.

It uses the standard deviation of the ATR to filter an EMA , and uses this as the mean. It then only plots > or < 0 if price is more than one x ATR away from the mean. If index is positive, the background turns green, meaning price is more than 1 x ATR above the mean. If the index is negative, the background turns red, meaning price is more than 1 x ATR below the mean. This setting can be changed by changing the setting "ATR Multiplier", but the default is 1 x ATR.

There are two main ways to use this index.

1. Use it aggressively to find trends (by combining it with other indicators) by entereding each time the background changes color to green for longs or red for shorts.
2. Use it spot breakouts, waiting for a pullback, and then entering on the next move in the same direction. In this context for a short, you wait for the background color to turn green, then wait for the index to pull back, and then enter once it starts moving up again.
Notas de Lançamento: - Version 1.1 -
  • Added option to plot in a percentage scale instead of pure instrument value.
  • Changed the default of the different period settings to 26.
- Version 1.2 -
  • Added the option to plot levels on the indicator, alongh with alerts for when
    the MDX crosses these lines. Also added an option to show or hide these lines.
    These lines are hidden by default.
  • Added the option to make the indicator volume weighted.
    This is off by default.
Script de código aberto

No verdadeiro espírito TradingView, o autor deste script o publicou com código aberto, para que os traders possam compreendê-lo e verificá-lo. Um brinde ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para utilizá-lo em um gráfico.

Quer usar esse script no gráfico?


500 moedas
+1 Resposta
Again amazing indicator here. Please stay innovative man, people like you are so rare. Is there a way I can add a threshold or filter so that I can not get signals over or under a certain number? I did this manually by adding 2 horizontal lines and just checking every signal, so I don't use signals between for anything below 4 or above -4. See this screen shot https://prnt.sc/tj0v89
+1 Resposta
Now, if the background goes from green to white after a candle or two, does that indicate an exit? Or is the green trend still active?
Beautiful script! Cheers mate!
I accidentally deleted my first comment. Anyways, I was confused about this part of the code:

stddev_a = sma(pow(atr_val, 2), stdev_period)
stddev_b = pow(sum(atr_val, stdev_period), 2) / pow(stdev_period, 2)
stddev = sqrt(stddev_a - stddev_b)

I wanted to ask you, what stddev_a and stddev_b stand for? Isn't standard deviation = sqrt( (x-mean)^2 / n) ?

My graph doesn't change when I click on show as a percentage option. It stays the same (instead of going to 0-100). Is it just me?
it is smart to combine the benefits of standard deviation and ATR to make it as a powerful range filter. Thanks for sharing this great script.
Now the only thing i'm thinking to add is a volume multiplier.
lejmer stevenwalter0
@stevenwalter0, Both your requests have now been implemented. Happy trading! :)
Início Rastreador de Fundamentos Rastreador Forex Rastreador de Criptomoedas Calendário Econômico Sobre Recursos gráficos Preços Indique um Amigo Regras da Casa Central de Ajuda Soluções para Sites & Corretoras Widgets Soluções em Gráficos Biblioteca de Gráficos Lightweight Blog & Notícias Twitter