UniversalMA MT5
- Indicators
-
Mikhail Sergeev
Mikhail Sergeev is a qualified specialist in the field of trading with 17 years of experience. An expert in the development of indicators and trading systems for MetaTrader 5.
I work in a team with the best guys from TrendRiders. Together we create powerful tools for analyzing stock charts. - Version: 3.0
- Updated: 1 September 2026
A moving average with enormous customization potential: 25 smoothing algorithms, 13 price options for the calculation, discretization (quantization) of the resulting average, trend-based line coloring, trend reversal arrows, 4 patterns of price interaction with the average, alerts and profit labels drawn right on the chart. The UniversalMA indicator combines the most sought-after construction methods used in modern trading. You no longer need a dozen different indicators on your chart — one is enough.
- Once a bar closes, the indicator does not change its values (no repainting).
- Works on any instrument and any timeframe.
- Does not load the computer (optimized code).
- Use it in your own Expert Advisors without any restrictions (the average value is buffer 0).
Do you trade the crossover of two moving averages? Grab our second free indicator — Moving Average Cross Signal — free download. It draws arrows at the crossover points of the fast and slow MA and sends alerts to the terminal, your phone and your email, so you never miss a trade.
Why you need a moving average. Moving averages are price-based lagging indicators that display the average price of an instrument over a set period of time. In essence, they smooth out the "noise" and let you read the chart calmly and without fuss. A moving average is a good way to assess momentum, confirm a trend and identify support and resistance areas.
The most common ways to use it:
- Direction of the moving average. The main rule of this method is to watch the overall direction of the average: it is exactly what points to the dominant market tendency. Trades should only be taken in the direction of that movement. This simple rule makes the moving average a convenient tool for short-term forecasting.
- Crossover of the moving average by the price chart.
- Tracking the speed at which the moving average changes.
- Combinations of several moving averages — the classic "fast + slow" pair.
- Using the average as a support or resistance level — with a time offset, or shifted up/down by a percentage of volatility.
How to choose the period. The smaller the period, the more sensitive and responsive the average is to every change in quotes — such averages are called fast. Conversely, the higher the period, the more sluggish the average becomes and the less it reacts to minor price fluctuations. Despite various points of view, there is no single "correct" value: to find the best one you will have to experiment for a while and understand which period is optimal for your particular strategy.
25 averaging algorithms in the UniversalMA indicator:
- SMA — simple averaging
- EMA — exponential averaging
- SMMA — smoothed averaging
- LWMA — linearly weighted averaging
- JJMA — adaptive JMA smoothing
- JurX — ultralinear JRSX smoothing
- ParMA — parabolic approximation
- T3 — Tilson's algorithm
- VIDYA — Variable Index Dynamic Average
- AMA — Adaptive Moving Average
- FATL — digital filter
- ALMA — Arnaud Legoux Moving Average
- HMA — Hull Moving Average
- DEMA — Double Exponential MA
- TEMA — Triple Exponential MA
- ZeroLagEMA — EMA with zero lag
- SineWMA — sine-weighted averaging
- TriMA — triangular averaging
- TriMAgen — generalized triangular averaging
- LSMA — least squares method
- ILRS — Integral of Linear Regression Slope
- IE/2 — a combination of LSMA and ILRS
- Median — median averaging
- GeoMean — geometric mean
- EWMA — exponentially weighted averaging
13 price options for the calculation: Close, Open, High, Low, Median Price (HL/2), Typical Price (HLC/3), Weighted Close (HLCC/4), Simpl Price (OC/2), Quarted Price (HLOC/4), TrendFollow_1, TrendFollow_2, Demark Price and FATL.
Indicator parameters
Main:
- MA Mode — the smoothing algorithm, 25 options from the list above.
- MA Period — the number of bars to average.
Additional settings MA:
- MA Price — the price the calculation is based on (13 options).
- MA Phase — a parameter within -100 ... +100 that affects the quality of the smoothing transient response. It works for the algorithms that need a second tuning parameter (JJMA, T3, VIDYA, AMA, ALMA and others).
- MA Shift — a shift of the price series the average is built on. For example, with a value of 1 the current bar does not take part in the calculation, and the average stops changing its values even on an unclosed bar.
- Step — discretization (quantization) of the average. A positive value sets the step in percent — the grid becomes geometric, so the same step works equally well on gold, indices and crypto. A negative value sets the step in points. At 0 the average is built in the usual way. Discretization turns the smooth line into a stepped one and removes micro-fluctuations — very handy for step-based and trend strategies.
Alert settings. Each channel is enabled separately and has three levels: Off — disabled, Signal only — only the final signal on a closed bar, Signal + preliminary — a preliminary signal also arrives while the bar has not closed yet. The preliminary alert lets you get to your computer in advance, double-check the news and prepare for the trade. Each type of signal is issued only once per bar — no duplicates.
- Send Email — sending the signal by email.
- Alert — pop-up and sound notification in the terminal.
- Push Notification — notification to the mobile terminal.
- Name sound file — the name of the sound file for the alert.
Paint settings:
- PaintArrow — trend reversal arrows. OFF — do not draw; Trend (price vs MA) — a signal at the moment the price crosses the average; Personal (MA direction) — a signal at the moment the average itself reverses. The selected mode also defines the logic the profit is calculated by.
- PaintPattern — separate pattern arrows, four options: Price crossing MA reverse — reverse signals based on the position of the price relative to the average; Bar crossing MA (open/close) — the bar has fully broken through the average, opening on one side and closing on the other; Crossing confirmed (3 bars) — a confirmed crossover, the price has held beyond the average for three bars; Touch shadow — the bar's shadow touches the average in the direction of the average.
- ColorMethod — line coloring: Trend (price vs MA) — by the position of the price relative to the average; Personal (MA direction) — by the direction of the average itself.
- ModePaintProfit — displays the result of the previous trade right on the chart, which makes testing an idea on history very convenient. Options: Off, Points, Cost (price difference), Points / 10, Percents, plus four modes of the maximum profit reachable inside a signal — Max Profit Points, Max Profit Cost, Max Profit Points / 10, Max Profit Percents.
Using it in your own Expert Advisors. The indicator can be embedded into trading robots without any restrictions. Buffers: 0 — the moving average value, 1 — the line color index, 2 — a signed trend counter (positive — price above the average, negative — below; the absolute value equals the number of bars since the change), 3 and 4 — trend reversal arrows up and down, 5 and 6 — arrows of the selected pattern.
In the course of our financial market research we strive to create universal tools that make it easy and productive to build all kinds of strategies. We decided to publish such developments free of charge. It is hard to overestimate the contribution of MQL to the development of modern trading and automated exchange trading, so we are glad to help this resource become richer in quality free content.
Your feedback is very important to us. If you have questions or want to share your opinion — write a comment or send a message, we are always in touch!

Reliable and repaint-free — works across all markets I already use other indicators from Mikhail Sergeev and they are all truly excellent. I've been trading for many years, so I know how to recognize a quality product when I see one. They offer reliability and no repaint, which is extremely important, along with immediate visibility on the chart, which also matters a lot. Above all, these are solid indicators across all timeframes and all instruments. I use them on Dax, crypto, and forex.