MA Gaussiana
- Indicatori
- Victor Alfonso Molina Botello
- Versione: 2.0
- Aggiornato: 26 ottobre 2025
The "MA Gaussiano" indicator is a custom tool for MetaTrader 5 (MQL5) that combines a Gaussian Moving Average with colored trend candles, designed to identify market trends in a visual and innovative way. It was developed with xAI assistance in 2025 and focuses on providing a smooth and sensitive representation of prices, ideal for traders looking to filter noise in charts of currencies, stocks, or cryptocurrencies.
Main Components:
- Gaussian MA (Colored Line): Plots a line representing the Gaussian moving average. The line is colored green when the MA is rising (indicating an uptrend) and red when falling (downtrend). This is determined by comparing the current MA value with the previous one: if GaussianMA[i] > GaussianMA[i-1], green; otherwise, red.
- Trend Candles: Displays candlesticks that copy the open, high, low, and close data from the original chart, but colored according to the Gaussian MA direction: green for bullish and red for bearish. This helps visualize the trend directly on the chart without needing additional indicators.
Input Parameters:
- MAPeriod (default 14): Length of the period to calculate the MA. Higher values produce a smoother line but with more lag.
- SigmaFactor (default 3.0): Adjusts the "width" of the Gaussian distribution. A lower value concentrates weights on recent prices, while a higher one distributes them more evenly.
The indicator requires at least MAPeriod data bars to calculate and updates on each tick or new bar. It is efficient thanks to precomputed weights and does not install external dependencies. It can be used on any timeframe for trend-following strategies, such as crossovers with other MAs or entry/exit signal confirmation.
The term "Gaussian" in this indicator is due to Carl Friedrich Gauss, a German mathematician from the 19th century considered one of the greatest in history. The name comes from the Gaussian (or normal) distribution, a bell-shaped curve that describes many natural phenomena and which Gauss developed in the context of error theory and astronomy. In this indicator, the Gaussian function is applied to calculate weights in a weighted moving average, which smooths price data in a more natural way and sensitive to central values, similar to how the Gaussian distribution concentrates probability around the mean.
Form and Calculation Formula
The Gaussian Moving Average (Gaussian MA) is a variant of the weighted moving average that uses weights based on the Gaussian density function. Its general form is a weighted sum of recent closing prices, where the weights decrease symmetrically according to the distance from the current point, following the Gaussian curve.
The formula to calculate the Gaussian MA at time i i is:
GaussianMA [ i ] = ∑ k = 0 M A P e r i o d − 1 close [ i − k ] ⋅ w [ k ] ∑ k = 0 M A P e r i o d − 1 w [ k ] GaussianMA[i]=∑k=0MAPeriod−1w[k]∑k=0MAPeriod−1close[i−k]⋅w[k]Where:
- close [ i − k ] close[i−k] is the closing price at time i − k i−k.
- w [ k ] = exp ( − k 2 2 σ 2 ) w[k]=exp(−2σ2k2) is the Gaussian weight for each k k, with k k representing the temporal distance (from 0 to MAPeriod-1).
- σ = M A P e r i o d SigmaFactor σ=SigmaFactorMAPeriod is the standard deviation parameter that controls the width of the Gaussian curve (default SigmaFactor = 3.0).
- MAPeriod is the period of the average (default 14), which determines how many historical prices are used.
The weights w [ k ] w[k] are precomputed when initializing the indicator for efficiency, and the total sum of weights normalizes the result to make it a valid average.

Excellent! And for free! Thank you so much!