OPEN-SOURCE SCRIPT
Z-Score (Normal Distribution ) with Alerts

Statistical Edge: Z-Score (Normal Distribution) Indicator
Concept & Logic
The Z-Score Indicator is a statistical tool used to measure how many standard deviations a price is from its mean (Simple Moving Average). By applying the principles of Normal Distribution (The Gaussian Curve) to market data, this indicator identifies whether a price move is "normal" or "extreme" relative to its recent history.
In a theoretical Normal Distribution:
68.2% of data points fall within ±1 Standard Deviation (SD).
95.4% of data points fall within ±2 SD.
99.7% of data points fall within ±3 SD.
When the Z-Score crosses these thresholds, it indicates that the current price action is statistically rare, often signaling potential exhaustion or a high-momentum breakout.
Key Features
Z-Score Line (Blue): Tracks the real-time deviation of price from the mean.
±2.0 Threshold (Dashed Lines): Represents the 95% confidence interval. Prices reaching this zone are considered "Overextended" and often see a return to the mean (Mean Reversion).
±3.0 Threshold (Solid Lines): Represents the 99.7% extreme zone. Movements here are rare and suggest either an imminent sharp reversal or the start of a "Black Swan" parabolic trend.
Statistical Zones: Color-coded fills (Red for high extreme, Green for low extreme) for quick visual scanning.
How to Trade with Z-Score
Mean Reversion: Look for the Z-Score to penetrate the +2 or +3 levels and then cross back toward the zero line (Mean). This often signals that the "stretch" is over and price is returning to balance.
Trend Strength: A Z-Score that stays consistently above +2 (or below −2) without returning to zero indicates a very strong momentum trend. Do not fight the trend in these "fat tail" events.
Divergence: Watch for price making a higher high while the Z-Score makes a lower high at the +2 level; this suggests the momentum is weakening despite the price increase.
Technical Settings
Period (Length): The lookback period for calculating the Mean and Standard Deviation (Default: 20).
Source: Usually set to Close, but can be adjusted for different strategies.
Disclaimer
Financial markets do not always follow a perfect Normal Distribution (they often exhibit "Leptokurtosis" or fat tails). Statistical indicators should be used as a confluence tool alongside Price Action, Volume, and other technical analysis methods. Past performance does not guarantee future results.
Concept & Logic
The Z-Score Indicator is a statistical tool used to measure how many standard deviations a price is from its mean (Simple Moving Average). By applying the principles of Normal Distribution (The Gaussian Curve) to market data, this indicator identifies whether a price move is "normal" or "extreme" relative to its recent history.
In a theoretical Normal Distribution:
68.2% of data points fall within ±1 Standard Deviation (SD).
95.4% of data points fall within ±2 SD.
99.7% of data points fall within ±3 SD.
When the Z-Score crosses these thresholds, it indicates that the current price action is statistically rare, often signaling potential exhaustion or a high-momentum breakout.
Key Features
Z-Score Line (Blue): Tracks the real-time deviation of price from the mean.
±2.0 Threshold (Dashed Lines): Represents the 95% confidence interval. Prices reaching this zone are considered "Overextended" and often see a return to the mean (Mean Reversion).
±3.0 Threshold (Solid Lines): Represents the 99.7% extreme zone. Movements here are rare and suggest either an imminent sharp reversal or the start of a "Black Swan" parabolic trend.
Statistical Zones: Color-coded fills (Red for high extreme, Green for low extreme) for quick visual scanning.
How to Trade with Z-Score
Mean Reversion: Look for the Z-Score to penetrate the +2 or +3 levels and then cross back toward the zero line (Mean). This often signals that the "stretch" is over and price is returning to balance.
Trend Strength: A Z-Score that stays consistently above +2 (or below −2) without returning to zero indicates a very strong momentum trend. Do not fight the trend in these "fat tail" events.
Divergence: Watch for price making a higher high while the Z-Score makes a lower high at the +2 level; this suggests the momentum is weakening despite the price increase.
Technical Settings
Period (Length): The lookback period for calculating the Mean and Standard Deviation (Default: 20).
Source: Usually set to Close, but can be adjusted for different strategies.
Disclaimer
Financial markets do not always follow a perfect Normal Distribution (they often exhibit "Leptokurtosis" or fat tails). Statistical indicators should be used as a confluence tool alongside Price Action, Volume, and other technical analysis methods. Past performance does not guarantee future results.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。