OPEN-SOURCE SCRIPT
Median Gaussian Trend | NAL

1. Overview
Median Gaussian Trend | NAL is an adaptive trend-band indicator built from a median price baseline, Gaussian smoothing, and Gaussian-weighted volatility bands.
The indicator is designed to filter raw price movement into a smoother directional structure. Instead of using a simple moving average or standard deviation channel, it first compresses price through a median calculation, then applies Gaussian smoothing to create a cleaner baseline. Around that baseline, it builds adaptive upper and lower bands using Gaussian-weighted deviation.
The result is a robust, smooth trend regime tool that identifies when price breaks outside its filtered volatility structure.
2. Calculation
The indicator starts by calculating a median of the selected source. This helps reduce noise by focusing on the central value of recent price action instead of reacting directly to every candle.
That median value is then passed through a Gaussian filter. The Gaussian filter gives more structured weighting to the lookback window, producing a smoother baseline while still preserving directional movement.
The indicator then calculates a Gaussian-weighted deviation around the smoothed median baseline. This creates a custom volatility measurement that is more aligned with the filtered baseline rather than raw price alone.
The upper and lower bands are then built around the Gaussian-smoothed median. The script allows separate upper and lower multipliers, which lets the band structure be asymmetric if needed.
Pine Script®
A bullish state triggers when price closes above the upper band. A bearish state triggers when price closes below the lower band. When price remains inside the bands, the previous regime is held.
3. Key Features
4. Use
Median Gaussian Trend is designed to identify when price escapes its smoothed median-volatility structure. A close above the upper band reflects bullish expansion, while a close below the lower band reflects bearish expansion.
The median component helps reduce noisy price behavior, while the Gaussian smoothing and deviation engine create a more refined trend envelope. This makes the indicator useful for reading directional structure without relying on a raw moving average channel.
This indicator is best used as a specialized module within a complete strategy framework. Its role is to isolate a filtered volatility-trend layer of price behavior, where the real value comes from how the signal is integrated into a broader process for regime, timing, and execution.
Median Gaussian Trend | NAL is an adaptive trend-band indicator built from a median price baseline, Gaussian smoothing, and Gaussian-weighted volatility bands.
The indicator is designed to filter raw price movement into a smoother directional structure. Instead of using a simple moving average or standard deviation channel, it first compresses price through a median calculation, then applies Gaussian smoothing to create a cleaner baseline. Around that baseline, it builds adaptive upper and lower bands using Gaussian-weighted deviation.
The result is a robust, smooth trend regime tool that identifies when price breaks outside its filtered volatility structure.
2. Calculation
The indicator starts by calculating a median of the selected source. This helps reduce noise by focusing on the central value of recent price action instead of reacting directly to every candle.
That median value is then passed through a Gaussian filter. The Gaussian filter gives more structured weighting to the lookback window, producing a smoother baseline while still preserving directional movement.
The indicator then calculates a Gaussian-weighted deviation around the smoothed median baseline. This creates a custom volatility measurement that is more aligned with the filtered baseline rather than raw price alone.
The upper and lower bands are then built around the Gaussian-smoothed median. The script allows separate upper and lower multipliers, which lets the band structure be asymmetric if needed.
A bullish state triggers when price closes above the upper band. A bearish state triggers when price closes below the lower band. When price remains inside the bands, the previous regime is held.
3. Key Features
- Median-based price filtering.
- Gaussian-smoothed baseline.
- Gaussian-weighted volatility deviation.
- Adaptive upper and lower trend bands.
- Separate upper and lower band multipliers.
- State-based candle coloring, band coloring, glow effect, and directional fills.
4. Use
Median Gaussian Trend is designed to identify when price escapes its smoothed median-volatility structure. A close above the upper band reflects bullish expansion, while a close below the lower band reflects bearish expansion.
The median component helps reduce noisy price behavior, while the Gaussian smoothing and deviation engine create a more refined trend envelope. This makes the indicator useful for reading directional structure without relying on a raw moving average channel.
This indicator is best used as a specialized module within a complete strategy framework. Its role is to isolate a filtered volatility-trend layer of price behavior, where the real value comes from how the signal is integrated into a broader process for regime, timing, and execution.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.