OPEN-SOURCE SCRIPT
G-Score | NAL

1. Overview
G-Score | NAL is a volatility-adjusted Z-Score regime indicator built from two main components: a smoothed price Z-Score and an adaptive GARCH-based volatility Z-Score.
The indicator does not use fixed overbought or oversold levels. Instead, it builds dynamic thresholds from the current volatility structure of the market. Price is then measured against those volatility-derived boundaries to determine whether the market is entering a bullish or bearish statistical regime.
2. Calculation
The indicator starts by estimating volatility through a GARCH-style process. It calculates log returns from the selected source, converts those returns into squared variance, and then compares short-term variance behavior against a realized variance baseline.
Pine Script®
The model then searches through possible beta and gamma coefficients to find weights that better fit the recent variance environment. These optimized coefficients are used to build a GARCH variance estimate from three components: long-run variance, recent shock variance, and lagged variance.
Pine Script®
The final GARCH volatility value is created by taking the square root of the projected variance. This produces the volatility engine used later in the threshold system.
The indicator then calculates two separate Z-Scores. The first is a price Z-Score, measuring where price is relative to its own mean and deviation. The second is a volatility Z-Score, measuring where GARCH volatility is relative to its own historical distribution.
Both values are smoothed with a Jurik-style moving average to reduce noise while keeping the response relatively fast.
The volatility Z-Score is then mirrored into positive and negative boundaries. This creates dynamic upper and lower thresholds that expand and contract with the current volatility regime.
The final signal compares the smoothed price Z-Score against those adaptive volatility thresholds. A bullish state triggers when price strength expands above the upper volatility boundary. A bearish state triggers when price weakness falls below the lower volatility boundary. When price remains inside the volatility envelope, the previous regime is held.
3. Key Features
4. Use
G-Score is designed to identify when price begins separating from its normal statistical range after accounting for the current volatility environment. A move above the upper threshold reflects bullish statistical expansion, while a move below the lower threshold reflects bearish statistical expansion.
The strength of the indicator comes from the relationship between price displacement and volatility regime. Rather than treating every Z-Score reading the same, it lets volatility define the boundary that price must break.
This indicator is best used as a specialized module within a complete strategy framework. Its role is to isolate a specific statistical layer of market behavior, where price expansion is evaluated through the lens of adaptive volatility. The full value comes from how this regime signal is integrated into a broader process for timing, structure, and risk.
G-Score | NAL is a volatility-adjusted Z-Score regime indicator built from two main components: a smoothed price Z-Score and an adaptive GARCH-based volatility Z-Score.
The indicator does not use fixed overbought or oversold levels. Instead, it builds dynamic thresholds from the current volatility structure of the market. Price is then measured against those volatility-derived boundaries to determine whether the market is entering a bullish or bearish statistical regime.
2. Calculation
The indicator starts by estimating volatility through a GARCH-style process. It calculates log returns from the selected source, converts those returns into squared variance, and then compares short-term variance behavior against a realized variance baseline.
The model then searches through possible beta and gamma coefficients to find weights that better fit the recent variance environment. These optimized coefficients are used to build a GARCH variance estimate from three components: long-run variance, recent shock variance, and lagged variance.
The final GARCH volatility value is created by taking the square root of the projected variance. This produces the volatility engine used later in the threshold system.
The indicator then calculates two separate Z-Scores. The first is a price Z-Score, measuring where price is relative to its own mean and deviation. The second is a volatility Z-Score, measuring where GARCH volatility is relative to its own historical distribution.
Both values are smoothed with a Jurik-style moving average to reduce noise while keeping the response relatively fast.
The volatility Z-Score is then mirrored into positive and negative boundaries. This creates dynamic upper and lower thresholds that expand and contract with the current volatility regime.
The final signal compares the smoothed price Z-Score against those adaptive volatility thresholds. A bullish state triggers when price strength expands above the upper volatility boundary. A bearish state triggers when price weakness falls below the lower volatility boundary. When price remains inside the volatility envelope, the previous regime is held.
3. Key Features
- Adaptive GARCH-style volatility engine.
- Price Z-Score measured against volatility-derived thresholds.
- Dynamic upper and lower boundaries instead of fixed levels.
- Jurik-style smoothing for both price and volatility components.
- State-based candle coloring, background regime coloring, threshold fills, and transition labels.
- Designed to capture statistical expansion when price moves outside its volatility-adjusted structure.
4. Use
G-Score is designed to identify when price begins separating from its normal statistical range after accounting for the current volatility environment. A move above the upper threshold reflects bullish statistical expansion, while a move below the lower threshold reflects bearish statistical expansion.
The strength of the indicator comes from the relationship between price displacement and volatility regime. Rather than treating every Z-Score reading the same, it lets volatility define the boundary that price must break.
This indicator is best used as a specialized module within a complete strategy framework. Its role is to isolate a specific statistical layer of market behavior, where price expansion is evaluated through the lens of adaptive volatility. The full value comes from how this regime signal is integrated into a broader process for timing, structure, and risk.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.