OPEN-SOURCE SCRIPT
מעודכן Z'-Score Histogram

WHAT IT DOES:
The Z'-Score Histogram is a volatility-adjusted momentum oscillator that quantifies how far the current asset price has deviated from its historical average. By calculating the standard deviation of price movement over a user-defined lookback period, it translates raw price action into clear statistical units. Instead of relying on the arbitrary overbought or oversold boundaries found in standard indicators like RSI, this script shows exactly how many standard deviations the current price is away from the mean, plotting the data as a clean, real-time histogram.
WHY IT IS USEFUL:
Standard bounded indicators can flatten out or bake at extreme levels during strong, prolonged trends. The Z'-Score Histogram solves this by using an unbounded statistical scale. This approach allows traders to instantly spot statistically significant anomalies, since a move beyond positive or negative three standard deviations happens less than one percent of the time in a normal distribution. It helps traders quickly identify whether an asset is in a sustainable trend or if it has stretched too far and is ripe for a mean-reversion snapback.
HOW IT ADDS VALUE TO THE COMMUNITY:
This script adds value to the community by bridging the gap between complex statistical trading and clean, modern chart aesthetics. Many public Z-score tools are either overly bare-bones or cluttered with heavy UI elements. This version delivers professional statistical data in a highly readable, actionable format without lagging or cluttering the workspace.
WHY THIS SCRIPT IS UNIQUE:
Several features make this script unique from others in the public library:
- Dual-Engine Filtering: Most scripts force you into a Simple Moving Average baseline. This version gives you a toggle to use an Exponential Moving Average instead, allowing the Z-score to react faster to sudden, high-volatility regime shifts.
- Dynamic Regime Classification Engine: The script automatically categorizes market states into six distinct, logical phases based on statistical probability, ranging from oversold and hostile to neutral, strong, and overbought.
- Ultra-Clean Dashboard Panel: Instead of a bulky table that blocks price action, it features a lightweight, floating text HUD in the top right. The background is borderless and transparent, adapting seamlessly to any chart theme.
- Visual Extreme Value Highlights: The histogram instantly shifts to high-contrast signature colors only when the market hits the statistically rare three standard deviation thresholds, immediately alerting you to extreme market exhaustion.
DISCLAIMER:
The author has made every effort to ensure the underlying mathematics and logic in this script are correct. However, trading involves substantial risk. If, for example, you buy an asset simply because it registers as oversold on this indicator, and it proceeds to become even more oversold while your position goes against you, that is entirely on you. This tool is for informational and educational purposes only, not financial or execution advice. Use proper risk management and trade at your own discretion.
The Z'-Score Histogram is a volatility-adjusted momentum oscillator that quantifies how far the current asset price has deviated from its historical average. By calculating the standard deviation of price movement over a user-defined lookback period, it translates raw price action into clear statistical units. Instead of relying on the arbitrary overbought or oversold boundaries found in standard indicators like RSI, this script shows exactly how many standard deviations the current price is away from the mean, plotting the data as a clean, real-time histogram.
WHY IT IS USEFUL:
Standard bounded indicators can flatten out or bake at extreme levels during strong, prolonged trends. The Z'-Score Histogram solves this by using an unbounded statistical scale. This approach allows traders to instantly spot statistically significant anomalies, since a move beyond positive or negative three standard deviations happens less than one percent of the time in a normal distribution. It helps traders quickly identify whether an asset is in a sustainable trend or if it has stretched too far and is ripe for a mean-reversion snapback.
HOW IT ADDS VALUE TO THE COMMUNITY:
This script adds value to the community by bridging the gap between complex statistical trading and clean, modern chart aesthetics. Many public Z-score tools are either overly bare-bones or cluttered with heavy UI elements. This version delivers professional statistical data in a highly readable, actionable format without lagging or cluttering the workspace.
WHY THIS SCRIPT IS UNIQUE:
Several features make this script unique from others in the public library:
- Dual-Engine Filtering: Most scripts force you into a Simple Moving Average baseline. This version gives you a toggle to use an Exponential Moving Average instead, allowing the Z-score to react faster to sudden, high-volatility regime shifts.
- Dynamic Regime Classification Engine: The script automatically categorizes market states into six distinct, logical phases based on statistical probability, ranging from oversold and hostile to neutral, strong, and overbought.
- Ultra-Clean Dashboard Panel: Instead of a bulky table that blocks price action, it features a lightweight, floating text HUD in the top right. The background is borderless and transparent, adapting seamlessly to any chart theme.
- Visual Extreme Value Highlights: The histogram instantly shifts to high-contrast signature colors only when the market hits the statistically rare three standard deviation thresholds, immediately alerting you to extreme market exhaustion.
DISCLAIMER:
The author has made every effort to ensure the underlying mathematics and logic in this script are correct. However, trading involves substantial risk. If, for example, you buy an asset simply because it registers as oversold on this indicator, and it proceeds to become even more oversold while your position goes against you, that is entirely on you. This tool is for informational and educational purposes only, not financial or execution advice. Use proper risk management and trade at your own discretion.
הערות שחרור
Added better option highlight colors to highlight sweet spots of trends (Z' = 1 to 3)Added optional divergence lines
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.