OPEN-SOURCE SCRIPT
Gaussian Volatility Adjusted

Gaussian Volatility Adjusted Indicator
The Gaussian Volatility Adjusted indicator is a powerful tool designed to identify trend direction and momentum by combining a Gaussian-filtered moving average with volatility-based thresholds. By smoothing price data with a Gaussian filter and adjusting for market volatility using Average True Range (ATR) and Standard Deviation (SD), this indicator generates clear bullish and bearish signals. The Exponential Moving Average (EMA) of the momentum difference and price bars are dynamically colored to highlight trend strength, making it easier for traders to identify potential entry and exit points in various market conditions.
How It Works
Gaussian Filter Calculations
Gaussian Filter: Applies a Gaussian smoothing filter to a user-defined price source, typically an EMA of the closing price, over a configurable length (default: 70) with a specified sigma (default: 12). The Gaussian filter uses a weighted sum based on a Gaussian distribution to reduce noise while preserving significant price trends. Weights are calculated using the Gaussian formula and normalized to ensure accurate smoothing.
Base Moving Average: Optionally applies an EMA (default: enabled, length: 45) to the closing price before Gaussian filtering, providing a smoother input for the Gaussian calculation to enhance signal reliability.
Volatility Adjustments
ATR-Based Bands: Calculates the Average True Range (ATR) over a user-defined period (default: 24), scaled by a sensitivity factor (default: 1) and an ATR factor (default: 0.85). These form volatility-adjusted bands around the Gaussian-filtered value:
Upper Band: Gaussian value + (ATR × ATR Factor).
Lower Band: Gaussian value - (ATR × ATR Factor).
Standard Deviation Bands: Computes the Standard Deviation (SD) of the closing price over a user-defined period (default: 27), scaled by the sensitivity factor. These form additional bands:
Upper SD Band: Gaussian value + SD.
Lower SD Band: Gaussian value - SD.
Trend and Momentum SignalsTrend
Detection:Bullish Trend: Triggered when the closing price exceeds the upper SD band, setting the trend to +1.
Bearish Trend: Triggered when the closing price falls below the upper ATR-based band, setting the trend to -1.
Momentum Calculation: Computes a momentum difference (Diff) based on the trend:
For a bullish trend (+1), Diff = Close - Upper ATR Band.
For a bearish trend (-1), Diff = Close - (Gaussian + SD).
EMA of Momentum: Applies an EMA (default length: 45) to the momentum difference to smooth the momentum signal.
Final Trend with EMA Confluences:
If EMA confluence is enabled (default: true), a bullish signal (+1) is confirmed when the trend is +1 and Diff exceeds the EMA of Diff. A bearish signal (-1) is confirmed when the trend is -1 and Diff is below the EMA of Diff.
If EMA confluence is disabled, the final trend follows the initial trend direction (±1).
Visual Representation
The indicator provides a clear and intuitive visual interface:
EMA Line: Plots the EMA of the momentum difference, colored based on the final trend:
Green: Bullish trend (Final_Trend = +1).
Red: Bearish trend (Final_Trend = -1).
Gray: Neutral or no trend.
Zero Line: A dashed line at zero (semi-transparent) serves as a reference for the EMA plot.
Bar Coloring: Price bars are colored to reflect the trend:
Green: Bullish trend (Final_Trend = +1).
Red: Bearish trend (Final_Trend = -1).
No Color: Neutral or no trend.
Volatility Bands: While not plotted in the provided script, the ATR and SD bands are calculated and could be plotted for additional context, marking key levels for trend detection.
Customization & Parameters
The Gaussian Volatility Adjusted indicator offers flexible parameters to suit various trading styles:
Volatility Parameters:
ATR Length: Period for ATR calculation (default: 24).
ATR Factor: Multiplier for ATR-based bands (default: 0.85).
SD Length: Period for Standard Deviation calculation (default: 27).
Sensitivity: Scales ATR and SD for band sensitivity (default: 1).
Moving Average Parameters:
Use EMA Confluence: Enable/disable EMA confluence for trend confirmation (default: true).
EMA Length: Period for EMA calculations (default: 45).
Gaussian Parameter:
Gaussian Length: Period for Gaussian filter (default: 70).
Sigma: Controls the Gaussian filter’s smoothness (default: 12).
Color Settings: EMA line and bars use green for bullish signals, red for bearish signals, and gray for neutral states, with customizable transparency for the zero line.
Trading Applications
This indicator is versatile and can be applied across various markets and strategies:
Trend Following:
Use the final trend signals and bar coloring to identify and follow bullish or bearish trends, with the Gaussian filter reducing noise for clearer trend detection.
Momentum Trading: The EMA of the momentum difference highlights strong momentum shifts, ideal for entering or exiting trades based on trend strength.
Reversal Detection: Monitor price crossings of the ATR and SD bands to identify potential trend reversals, especially when confirmed by the EMA confluence.
Scalping and Swing Trading: Adjust parameters (e.g., ATR length, Gaussian length, or sensitivity) to suit short-term scalping or longer-term swing trading strategies.
Final Note
The Gaussian Volatility Adjusted indicator is a robust tool for traders seeking to leverage smoothed price data and volatility-adjusted thresholds for trend and momentum analysis. Its combination of Gaussian filtering, ATR and SD-based bands, and EMA confluence provides a comprehensive framework for identifying trading opportunities. The dynamic coloring of the EMA line and price bars enhances visual clarity, making it easier to act on signals. As with all indicators, backtest thoroughly and integrate into a comprehensive trading strategy for optimal results.
The Gaussian Volatility Adjusted indicator is a powerful tool designed to identify trend direction and momentum by combining a Gaussian-filtered moving average with volatility-based thresholds. By smoothing price data with a Gaussian filter and adjusting for market volatility using Average True Range (ATR) and Standard Deviation (SD), this indicator generates clear bullish and bearish signals. The Exponential Moving Average (EMA) of the momentum difference and price bars are dynamically colored to highlight trend strength, making it easier for traders to identify potential entry and exit points in various market conditions.
How It Works
Gaussian Filter Calculations
Gaussian Filter: Applies a Gaussian smoothing filter to a user-defined price source, typically an EMA of the closing price, over a configurable length (default: 70) with a specified sigma (default: 12). The Gaussian filter uses a weighted sum based on a Gaussian distribution to reduce noise while preserving significant price trends. Weights are calculated using the Gaussian formula and normalized to ensure accurate smoothing.
Base Moving Average: Optionally applies an EMA (default: enabled, length: 45) to the closing price before Gaussian filtering, providing a smoother input for the Gaussian calculation to enhance signal reliability.
Volatility Adjustments
ATR-Based Bands: Calculates the Average True Range (ATR) over a user-defined period (default: 24), scaled by a sensitivity factor (default: 1) and an ATR factor (default: 0.85). These form volatility-adjusted bands around the Gaussian-filtered value:
Upper Band: Gaussian value + (ATR × ATR Factor).
Lower Band: Gaussian value - (ATR × ATR Factor).
Standard Deviation Bands: Computes the Standard Deviation (SD) of the closing price over a user-defined period (default: 27), scaled by the sensitivity factor. These form additional bands:
Upper SD Band: Gaussian value + SD.
Lower SD Band: Gaussian value - SD.
Trend and Momentum SignalsTrend
Detection:Bullish Trend: Triggered when the closing price exceeds the upper SD band, setting the trend to +1.
Bearish Trend: Triggered when the closing price falls below the upper ATR-based band, setting the trend to -1.
Momentum Calculation: Computes a momentum difference (Diff) based on the trend:
For a bullish trend (+1), Diff = Close - Upper ATR Band.
For a bearish trend (-1), Diff = Close - (Gaussian + SD).
EMA of Momentum: Applies an EMA (default length: 45) to the momentum difference to smooth the momentum signal.
Final Trend with EMA Confluences:
If EMA confluence is enabled (default: true), a bullish signal (+1) is confirmed when the trend is +1 and Diff exceeds the EMA of Diff. A bearish signal (-1) is confirmed when the trend is -1 and Diff is below the EMA of Diff.
If EMA confluence is disabled, the final trend follows the initial trend direction (±1).
Visual Representation
The indicator provides a clear and intuitive visual interface:
EMA Line: Plots the EMA of the momentum difference, colored based on the final trend:
Green: Bullish trend (Final_Trend = +1).
Red: Bearish trend (Final_Trend = -1).
Gray: Neutral or no trend.
Zero Line: A dashed line at zero (semi-transparent) serves as a reference for the EMA plot.
Bar Coloring: Price bars are colored to reflect the trend:
Green: Bullish trend (Final_Trend = +1).
Red: Bearish trend (Final_Trend = -1).
No Color: Neutral or no trend.
Volatility Bands: While not plotted in the provided script, the ATR and SD bands are calculated and could be plotted for additional context, marking key levels for trend detection.
Customization & Parameters
The Gaussian Volatility Adjusted indicator offers flexible parameters to suit various trading styles:
Volatility Parameters:
ATR Length: Period for ATR calculation (default: 24).
ATR Factor: Multiplier for ATR-based bands (default: 0.85).
SD Length: Period for Standard Deviation calculation (default: 27).
Sensitivity: Scales ATR and SD for band sensitivity (default: 1).
Moving Average Parameters:
Use EMA Confluence: Enable/disable EMA confluence for trend confirmation (default: true).
EMA Length: Period for EMA calculations (default: 45).
Gaussian Parameter:
Gaussian Length: Period for Gaussian filter (default: 70).
Sigma: Controls the Gaussian filter’s smoothness (default: 12).
Color Settings: EMA line and bars use green for bullish signals, red for bearish signals, and gray for neutral states, with customizable transparency for the zero line.
Trading Applications
This indicator is versatile and can be applied across various markets and strategies:
Trend Following:
Use the final trend signals and bar coloring to identify and follow bullish or bearish trends, with the Gaussian filter reducing noise for clearer trend detection.
Momentum Trading: The EMA of the momentum difference highlights strong momentum shifts, ideal for entering or exiting trades based on trend strength.
Reversal Detection: Monitor price crossings of the ATR and SD bands to identify potential trend reversals, especially when confirmed by the EMA confluence.
Scalping and Swing Trading: Adjust parameters (e.g., ATR length, Gaussian length, or sensitivity) to suit short-term scalping or longer-term swing trading strategies.
Final Note
The Gaussian Volatility Adjusted indicator is a robust tool for traders seeking to leverage smoothed price data and volatility-adjusted thresholds for trend and momentum analysis. Its combination of Gaussian filtering, ATR and SD-based bands, and EMA confluence provides a comprehensive framework for identifying trading opportunities. The dynamic coloring of the EMA line and price bars enhances visual clarity, making it easier to act on signals. As with all indicators, backtest thoroughly and integrate into a comprehensive trading strategy for optimal results.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.