OPEN-SOURCE SCRIPT
Overextended vs 50DMA Detector

This indicator helps traders identify when a stock or asset becomes statistically overextended relative to its 50-day moving average (50DMA) — a key signal for potential pullbacks, consolidations, or profit-taking zones.
⸻
🔍 What It Does
• Calculates the 50-day simple moving average (SMA) of price.
• Computes the percentage gap between current price and the 50DMA.
• Measures the standard deviation of that percentage gap to assess volatility-adjusted extremes.
• Flags the stock as “Overextended” when:
• Price is more than 20% above the 50DMA, and
• The % gap is greater than 3× its historical standard deviation.
When these conditions are met, the script:
• Highlights the candle with a 🚨 red triangle on the chart.
• Shades the background to indicate potential overheating.
• Triggers an alert condition so traders can be notified in real time.
⸻
🔍 What It Does
• Calculates the 50-day simple moving average (SMA) of price.
• Computes the percentage gap between current price and the 50DMA.
• Measures the standard deviation of that percentage gap to assess volatility-adjusted extremes.
• Flags the stock as “Overextended” when:
• Price is more than 20% above the 50DMA, and
• The % gap is greater than 3× its historical standard deviation.
When these conditions are met, the script:
• Highlights the candle with a 🚨 red triangle on the chart.
• Shades the background to indicate potential overheating.
• Triggers an alert condition so traders can be notified in real time.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.