OPEN-SOURCE SCRIPT
Enhanced Std Dev Oscillator (Z-Score)

Enhanced Std Dev Oscillator (Z-Score)
Overview
The Enhanced Std Dev Oscillator (ESDO) is a refined Z-Score indicator that normalizes price deviations from a moving mean using standard deviation, smoothed for clarity and equipped with divergence detection. This oscillator shines in identifying extreme overbought/oversold conditions and potential reversals, making it ideal for mean-reversion strategies in stocks, forex, or crypto. By highlighting when prices stray too far from the norm, it helps traders avoid chasing trends and focus on high-probability pullbacks.
Key Features
Customisable Mean & Deviation: Choose SMA or EMA for the mean (default: SMA, length 14); opt for Population or Sample standard deviation for precise statistical accuracy.
Smoothing for Clarity: Apply a simple moving average (default: 3) to the raw Z-Score, reducing noise without lagging signals excessively.
Zone Highlighting: Background colours flag extreme zones—red tint above +2 (overbought), green below -2 (oversold)—for quick visual scans.
Divergence Alerts: Automatically detects bullish (price lows lower, Z-Score higher) and bearish (price highs higher, Z-Score lower) divergences using pivot points (default length: 5), with labeled shapes for easy spotting.
Built-in Alerts: Notifications for Z-Score crossovers into OB/OS zones and divergence events to keep you informed without constant monitoring.
How It Works
Core Calculation: Computes the mean (SMA/EMA) over the specified length, then standard deviation (Population or adjusted Sample formula for N>1). Z-Score = (Source - Mean) / Std Dev, handling edge cases like zero deviation.
Smoothing: Averages the Z-Score with an SMA to create a cleaner plot oscillating around zero.
Levels & Zones: Plots horizontal lines at ±1 (orange dotted) and ±2 (red dashed) for reference; backgrounds activate in extreme zones.
Divergence Logic: Scans for pivot highs/lows in price and Z-Score; flags divergences when price extremes diverge from oscillator extremes (looking back 2 pivots for confirmation).
Visualisation: Blue line for the smoothed Z-Score; green/red labels for bull/bear divergences.
Usage Tips
Buy Signal: Z-Score crosses below -2 (oversold) or bullish divergence forms—pair with volume spike for confirmation.
Sell Signal: Z-Score crosses above +2 (overbought) or bearish divergence—watch for resistance alignment.
Customisation: Use EMA mean for trendier assets; enable Sample std dev for smaller datasets. Increase pivot length (7-10) in volatile markets to filter false signals.
Timeframes: Excels on daily/4H for swing trades; test smoothing on lower frames to avoid over-smoothing. Always combine with trend filters like a 200-period MA.
This open-source script is licensed under Mozilla Public License 2.0. Backtest thoroughly—past performance isn't indicative of future results. Trade with discipline! 📈
© HighlanderOne
Overview
The Enhanced Std Dev Oscillator (ESDO) is a refined Z-Score indicator that normalizes price deviations from a moving mean using standard deviation, smoothed for clarity and equipped with divergence detection. This oscillator shines in identifying extreme overbought/oversold conditions and potential reversals, making it ideal for mean-reversion strategies in stocks, forex, or crypto. By highlighting when prices stray too far from the norm, it helps traders avoid chasing trends and focus on high-probability pullbacks.
Key Features
Customisable Mean & Deviation: Choose SMA or EMA for the mean (default: SMA, length 14); opt for Population or Sample standard deviation for precise statistical accuracy.
Smoothing for Clarity: Apply a simple moving average (default: 3) to the raw Z-Score, reducing noise without lagging signals excessively.
Zone Highlighting: Background colours flag extreme zones—red tint above +2 (overbought), green below -2 (oversold)—for quick visual scans.
Divergence Alerts: Automatically detects bullish (price lows lower, Z-Score higher) and bearish (price highs higher, Z-Score lower) divergences using pivot points (default length: 5), with labeled shapes for easy spotting.
Built-in Alerts: Notifications for Z-Score crossovers into OB/OS zones and divergence events to keep you informed without constant monitoring.
How It Works
Core Calculation: Computes the mean (SMA/EMA) over the specified length, then standard deviation (Population or adjusted Sample formula for N>1). Z-Score = (Source - Mean) / Std Dev, handling edge cases like zero deviation.
Smoothing: Averages the Z-Score with an SMA to create a cleaner plot oscillating around zero.
Levels & Zones: Plots horizontal lines at ±1 (orange dotted) and ±2 (red dashed) for reference; backgrounds activate in extreme zones.
Divergence Logic: Scans for pivot highs/lows in price and Z-Score; flags divergences when price extremes diverge from oscillator extremes (looking back 2 pivots for confirmation).
Visualisation: Blue line for the smoothed Z-Score; green/red labels for bull/bear divergences.
Usage Tips
Buy Signal: Z-Score crosses below -2 (oversold) or bullish divergence forms—pair with volume spike for confirmation.
Sell Signal: Z-Score crosses above +2 (overbought) or bearish divergence—watch for resistance alignment.
Customisation: Use EMA mean for trendier assets; enable Sample std dev for smaller datasets. Increase pivot length (7-10) in volatile markets to filter false signals.
Timeframes: Excels on daily/4H for swing trades; test smoothing on lower frames to avoid over-smoothing. Always combine with trend filters like a 200-period MA.
This open-source script is licensed under Mozilla Public License 2.0. Backtest thoroughly—past performance isn't indicative of future results. Trade with discipline! 📈
© HighlanderOne
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.