Adaptive Gaussian Moving Average

The Adaptive Gaussian Moving Average (AGMA) is a versatile technical indicator that combines the concept of a Gaussian Moving Average (GMA) with adaptive parameters based on market volatility. The indicator aims to provide a smoothed trend line that dynamically adjusts to different market conditions, offering a more responsive analysis of price movements.

The AGMA is calculated by applying a weighted moving average based on a Gaussian distribution. The length parameter determines the number of bars considered for the calculation. The adaptive parameter enables or disables the adaptive feature. When adaptive is true, the sigma value, which represents the standard deviation, is dynamically calculated using the standard deviation of the closing prices over the volatilityPeriod. When adaptive is false, a user-defined fixed value for sigma can be input.

The AGMA generates a smoothed line that follows the trend of the price action. When the AGMA line is rising, it suggests an uptrend, while a declining line indicates a downtrend. The adaptive feature allows the indicator to adjust its sensitivity based on market volatility, making it more responsive during periods of high volatility and less sensitive during low volatility conditions.

Potential Uses in Strategies:

-- Trend Identification: Traders can use the AGMA to identify the direction of the prevailing trend. Buying opportunities may arise when the price is above the AGMA line during an uptrend, while selling opportunities may be considered when the price is below the AGMA line during a downtrend.

-- Trend Confirmation: The AGMA can be used in conjunction with other technical indicators or trend-following strategies to confirm the strength and sustainability of a trend. A strong and steady AGMA line can provide additional confidence in the prevailing trend.

-- Volatility-Based Strategies: Traders can utilize the adaptive feature of the AGMA to build volatility-based strategies. By adjusting the sigma value based on market volatility, the indicator can dynamically adapt to changing market conditions, potentially improving the accuracy of entry and exit signals.


-- Lagging Indicator: Like other moving averages, the AGMA is a lagging indicator that relies on historical price data. It may not provide timely signals during rapidly changing market conditions or sharp price reversals.

-- Whipsaw in Sideways Markets: During periods of low volatility or when the market is moving sideways, the AGMA may generate false signals or exhibit frequent crossovers around the price, leading to whipsaw trades.

-- Subjectivity of Parameters: The choice of length, adaptive parameters, and volatility period requires careful consideration and customization based on individual preferences and trading strategies. Traders need to adjust these parameters to suit the specific market and timeframe they are trading.

Overall, the Adaptive Gaussian Moving Average can be a valuable tool in trend identification and confirmation, especially when combined with other technical analysis techniques. However, traders should exercise caution, conduct thorough analysis, and consider the indicator's limitations when incorporating it into their trading strategies.

Take your trading to new heights with LeafAlgo Premium Indicators and Strategies. Use code SSMS4MGK at checkout for a 50% discount on your first purchase at www.LeafAlgo.com !

Join our Discord community today!
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


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.

Want to use this script on a chart?