OPEN-SOURCE SCRIPT
Overbought or Oversold? Check Distance From MA

Moving averages are one of the most basic tools for technical analysts. They can be useful for both trend analysis and for mean reversion.
But how can you know when price is historically overbought or oversold relative to a moving average? Distance from MA can help.
This indicator calculates the distance from a moving average as a percentage and plots the result as an oscillator. Values above 0 appear in green, while negative readings are colored red.
This chart highlights the depth of the S&P 500's recent selloff. As you can see, the close dipped to 25 percent below its 50-day SMA on Monday. That was its most oversold condition since November 20, 2008 -- in the middle of the subprime financial crisis.
Distance from MA can handle five types of moving average. Simply change the "AvgType" input according to this key:
1 - Simple Moving Average
2 - Exponential Moving Average
3 - Hull Moving Average
4 - Weighted Moving Average
5 - Volume-Weighted Moving Average
But how can you know when price is historically overbought or oversold relative to a moving average? Distance from MA can help.
This indicator calculates the distance from a moving average as a percentage and plots the result as an oscillator. Values above 0 appear in green, while negative readings are colored red.
This chart highlights the depth of the S&P 500's recent selloff. As you can see, the close dipped to 25 percent below its 50-day SMA on Monday. That was its most oversold condition since November 20, 2008 -- in the middle of the subprime financial crisis.
Distance from MA can handle five types of moving average. Simply change the "AvgType" input according to this key:
1 - Simple Moving Average
2 - Exponential Moving Average
3 - Hull Moving Average
4 - Weighted Moving Average
5 - Volume-Weighted Moving Average
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.