OsMA stands for Moving Average of Oscillator, and despite the generic-sounding name it measures something very specific: the gap between the MACD line and its signal line, plotted as a histogram around a zero line. If you've ever watched the MACD histogram, you've already seen OsMA — MetaTrader's OsMA is that histogram, isolated into its own indicator. What it gives you is an early, magnified view of momentum shifts that the MACD's slower line-cross confirms only later.
How OsMA Is Calculated
To understand OsMA you first have to remember what the MACD is made of. The MACD line is the difference between a fast and a slow exponential moving average of price (default 12 and 26 periods). The signal line is a moving average of that MACD line (default 9 periods). OsMA is simply the distance between the two:
OsMA = MACD line − Signal line
That's the whole formula. When the MACD line is above its signal line, OsMA is positive and plots as a bar above zero. When the MACD line is below its signal line, OsMA is negative and plots below zero. The height of each bar is exactly how far apart the two MACD components are at that moment — a tall bar means the fast average has pulled far away from its own smoothed version, a short bar means they're converging.
Because OsMA is a difference of two already-smoothed lines, it strips out the shared baseline movement of the MACD and leaves only the changing relationship between the line and its signal. That's what makes it so responsive: small shifts in momentum that barely move the MACD line itself show up clearly as the histogram starting to shrink or grow.
Reading the Histogram Around Zero
OsMA carries two readable pieces of information — which side of zero it's on, and which direction the bars are growing:
- Bars above zero — the MACD line is above its signal line, i.e. upward momentum currently has the upper hand.
- Bars below zero — the MACD line is below its signal line, i.e. downward momentum has the upper hand.
- Bar height growing — the two MACD components are separating, meaning momentum in the current direction is accelerating.
- Bar height shrinking toward zero — the components are converging, meaning the current momentum is fading even if OsMA hasn't crossed zero yet.
Like the MACD it's built from, OsMA is unbounded — it has no fixed overbought/oversold levels the way RSI does. You read it relative to its own recent range and its zero line, not against a universal threshold.
Entry Conditions
The custom indicator built for this lesson plots OsMA as a histogram in a separate window and alerts the moment the histogram crosses zero:
- BUY — OsMA crosses from below zero to above zero (the MACD line has just crossed above its signal line).
- SELL — OsMA crosses from above zero to below zero (the MACD line has just crossed below its signal line).
An OsMA zero cross is mathematically identical to a MACD signal-line cross — they are the same event described two different ways. The advantage of watching it as a histogram is that you can see it coming: the bars shrink toward zero before they actually cross it, giving a visual heads-up that the MACD cross is approaching.
Why the Histogram Leads the Line Cross
This is the single most useful thing to understand about OsMA. Because it plots the distance between the MACD line and its signal line, OsMA peaks and starts falling while both MACD lines are still rising — at the exact moment the fast line stops pulling away from the signal line and begins closing the gap. In other words, the height of the OsMA histogram tops out one full turning point earlier than the zero cross itself.
That gives two levels of signal from one indicator. The histogram turning (bars stop growing and start shrinking) is an early, aggressive warning that momentum is decelerating. The zero cross (bars flip from one side to the other) is the later, more conservative confirmation that momentum has actually reversed. Aggressive traders act on the turn; conservative traders wait for the cross. This EA-style lesson's alert fires on the cross because it's unambiguous and mechanical, but the shrinking bars leading up to it are visible to the naked eye and are much of why traders prefer the histogram view to a raw line cross.
Parameters
- FastEMA (default 12) — the fast EMA period inside the MACD calculation. Lowering it makes OsMA more responsive and noisier.
- SlowEMA (default 26) — the slow EMA period. The gap between fast and slow sets how much of a trend the MACD line captures.
- SignalSMA (default 9) — the smoothing period for the signal line that OsMA is measured against. A larger value makes the histogram cross zero less often but later.
- AppliedPrice (default Close) — the price series the whole calculation runs on. Close is standard.
- EnableAlert (default true) — pops up a MetaTrader alert the moment OsMA crosses zero in either direction.
- EnablePush (default false) — sends the same cross notification to your phone via MetaTrader's push notification service.
Keeping the 12/26/9 defaults makes OsMA directly comparable to the standard MACD; changing them is really changing the underlying MACD, so adjust deliberately rather than by trial and error.
OsMA vs MACD vs Awesome Oscillator
All three of these oscillate around a zero line, but they measure different things. The MACD shows you two lines (the MACD line and its signal), and its most common trade signal is the crossover between them. OsMA compresses those two lines into the single histogram of their distance — same information, one visual, with the early-warning benefit described above. The Awesome Oscillator also plots a zero-line histogram, but it's built from simple moving averages of each bar's midpoint (median price) rather than exponential averages of the close, and it has no signal line at all — its zero cross compares a 5-period and 34-period SMA directly. In practice OsMA reacts to the same underlying momentum as the MACD (since it's literally derived from it), while the Awesome Oscillator can diverge from both because of its different inputs. If you already trade the MACD, OsMA is a cleaner way to watch the same signal; if you want a genuinely independent second opinion, the Awesome Oscillator is the more different tool.
A Word of Caution
OsMA inherits the MACD's biggest weakness: in a choppy, range-bound market the histogram crosses zero repeatedly on small, meaningless momentum wobbles, producing a string of whipsaw signals that each cost spread and slippage. It is a lagging construction — built from moving averages of moving averages — so in a fast reversal it can confirm the turn well after price has already moved a long way. And because the histogram's height is unbounded, there's no "too high" level that reliably signals exhaustion; a tall bar can get taller. Treat an OsMA zero cross as more reliable when it lines up with a clear trend on the price chart, and be cautious using it as a standalone signal in a sideways market — see Trend vs Range for how to recognize the conditions where it works best. As with every indicator on this site, this is educational content, not personalized financial advice — always combine it with your own read of price structure before acting on a signal.
Download the Indicator
This custom indicator calculates OsMA and automatically alerts when the histogram crosses its zero line. It's available for both MetaTrader 4 and MetaTrader 5 below.
How to Install — MetaTrader 4
- Download the
osma-alert.mq4file below. - Open MetaTrader 4 → click
File→Open Data Folder. - Place the file in the
MQL4/Indicatorsfolder. - Restart MetaTrader 4, then drag the indicator from the Navigator window onto the chart.
How to Install — MetaTrader 5
- Download the
osma-alert.mq5file below. - Open MetaTrader 5 → click
File→Open Data Folder. - Place the file in the
MQL5/Indicatorsfolder. - Restart MetaTrader 5, then drag the indicator from the Navigator window onto the chart.
Both files are source code — open and review the full code before using it, for your own safety.