Moving Average of Oscillator
OsMA
OsMA is MACD's main line minus its signal line, published as one buffer. It is the indicator most charting packages draw as the 'MACD histogram' — in MetaTrader that histogram is a separate indicator with its own function, and its zero line is the exact moment MACD's two lines cross.
- Fast / Slow EMA
- 12 / 26
- Signal period
- 9
- Zero line
- MACD cross
Illustrativo — dati sintetici, non una quotazione in tempo reale.
What OsMA tells you
OsMA measures the gap between MACD's two lines. When the gap widens the move is accelerating; when it narrows the move is losing pace even if price is still going. Because the gap is zero exactly when the two lines touch, OsMA turns a two-line crossover into a single sign change — which is why a rule written on OsMA needs one value where a MACD rule needs two.
- Above zero: MAIN is above SIGNAL — MACD is in its bullish arrangement
- Bars growing: the two lines are separating, so the move is accelerating
- Bars shrinking: they are converging, and a cross is being approached
- 1 Take MACD's MAIN_LINE (fast EMA − slow EMA)
- 2 Take its SIGNAL_LINE (the average of MAIN)
- 3 Plot MAIN − SIGNAL as bars around zero
Mostra la formula e i dettagli del calcolo
The Moving Average of Oscillator is one subtraction applied to MACD:
- Take MACD’s MAIN_LINE — the fast EMA minus the slow EMA.
- Take its SIGNAL_LINE — MAIN_LINE averaged over the signal period.
- Plot the difference:
OsMA = MAIN − SIGNAL.
That single buffer is drawn as bars around a zero line. The zero line is not an arbitrary level: OsMA = 0 is precisely the condition MAIN = SIGNAL, so every sign change in OsMA is a MACD crossover happening at the same bar. Where a MACD rule reads two buffers and compares them, an OsMA rule reads one and asks whether it is positive.
In MQL5 the call is iOsMA(symbol, period, fast_ema_period, slow_ema_period, signal_period, applied_price). The three periods are MACD’s, because the calculation underneath is MACD’s — OsMA has no settings of its own. The applied price is a real argument here and it feeds the moving averages, so changing it changes the whole construction.
What OsMA adds over the crossover is the size of the gap. Two lines that are far apart and separating describe a different market from two lines that are far apart and closing, and a crossover rule cannot tell them apart because neither has crossed yet. This is the reason the Builder template does not trade the sign change at all: the zero cross would produce the same EA as the MACD Signal template, so the rule is placed on the bars instead — OsMA rising above its own value three bars ago, while still on the trend side of zero, which describes a pullback that has started moving again.
One naming caution, because it causes real errors when porting strategies. MetaTrader draws MACD’s MAIN_LINE as the histogram. Almost every other charting package draws MAIN as a line and MAIN − SIGNAL as the histogram. Both are called “the MACD histogram” and they cross zero at completely different moments — MT5’s when the two EMAs cross, everyone else’s when the two MACD lines cross. If a strategy from elsewhere refers to the histogram, the MetaTrader indicator it means is this one.
Segnali
I segnali distinti e testabili che OsMA fornisce — e il regime di mercato adatto a ciascuno.
Re-acceleration Above Zero
Pronto nel BuilderShrinking Bars
Pronto nel BuilderDivergence from Price
Logica avanzataImplementazione MT5
Ciò che MetaTrader 5 calcola e disegna davvero: il riferimento di ogni regola di questa pagina.
Buffer
| Indice | Buffer | Disegnato in MT5 come | Cosa contiene |
|---|---|---|---|
| 0 | MAIN_LINE | Histogram | MACD's MAIN_LINE minus its SIGNAL_LINE, drawn as bars around zero. There is only this one buffer — the two series it is built from live in iMACD, not here. |
Note sulla piattaforma
Funziona meglio / usare con cautela
Nessun indicatore ha un vantaggio universale. Ecco dove OsMA aiuta — e dove inganna.
Funziona meglio
- Turning a MACD crossover rule into a single condition
- Judging whether a trend is still accelerating
- Timing a pullback entry inside an established trend
- Higher timeframes, where the bars are less erratic
Usare con cautela
- Any fixed threshold — the scale depends on the instrument
- Ranging markets, where the sign flips constantly
- Comparing OsMA readings across symbols or timeframes
- Assuming it leads price; it leads the crossover, which is not the same thing
Crea una strategia OsMA
Collega il segnale alle regole di ingresso e uscita, poi esporta un EA MT5 compilabile — senza codice.
- OsMA read at the current bar
- A second OsMA node read 3 bars back
- Cross the two — rising above the older value means the bars are growing again
- Compare OsMA against a Constant of 0 to fix the direction
- Both true → Open Buy · SL 45 / TP 135
- Stop then trails an EMA(20)
Combina OsMA con altri indicatori
Un indicatore raramente funziona da solo. Questi abbinamenti coprono i punti ciechi di OsMA.
OsMA + MACD
- OsMA above zero
- OsMA rising against its own past
- Buy
No template places MACD and OsMA in one flow, because it would say the same thing twice — OsMA is MAIN − SIGNAL, so its sign already carries MACD's crossover. The OsMA Re-acceleration + Zero Line template is the one-indicator form.
Apri il Builder →OsMA + ADX
- OsMA crosses zero
- ADX above 25
- Buy
No single-flow template pairs OsMA with ADX. Start from OsMA Re-acceleration + Zero Line and add an ADX node with a Compare at 25, the same filter the Parabolic SAR template uses.
Apri il Builder →OsMA + Moving Average
- Price above the EMA(200)
- OsMA turns up above zero
- Buy
No single-flow template pairs OsMA with a long moving average. Start from OsMA Re-acceleration + Zero Line and add an MA node with a Compare against Price.
Apri il Builder →Parametri
Valori iniziali da validare sulla tua coppia e timeframe — non sono impostazioni garantite.
| Parametro | Predefinito | Intervallo di test suggerito | Cosa fa |
|---|---|---|---|
| Fast EMA period | 12 | 5–30 | The faster of the two moving averages inside MACD. Shortening it makes OsMA react sooner and cross zero more often; the setting belongs to the MACD underneath, not to OsMA itself. |
| Slow EMA period | 26 | 20–60 | The slower average. The distance between fast and slow sets how large OsMA's readings become, which is one reason absolute thresholds do not transfer between settings. |
| Signal period | 9 | 5–20 | The averaging window applied to MAIN_LINE to produce SIGNAL_LINE. OsMA is the difference between the two, so this parameter alone decides how quickly the bars return to zero. MT5 smooths with a simple moving average here, not an EMA. |
| Applied price | PRICE_CLOSE | Close, Open, High, Low, Median, Typical, Weighted | Which price series feeds the moving averages. Unlike some MT5 volume indicators, iOsMA really does take this argument, and the Builder's generated code passes it through as an EA input. |
| Shift | 0 | 0–30 | Which bar back the node reads the buffer from. Two OsMA nodes at different shifts is how a rule expresses 'the bars are growing again' — that is exactly what the template does with 0 and 3. |
Preset iniziali
Esempi di mercato
Dove OsMA funziona, dove fallisce e come un filtro cambia il risultato.
Bars grow again inside a trend
OsMA never returned to zero during the pullback, and the bars start lengthening again — the trend resumed without the two MACD lines ever crossing back.
Sign change with nothing behind it
In a flat stretch OsMA flips above and below zero every few bars. Each flip is a valid MACD crossover and none of them lead anywhere, which is why a trend filter belongs on this signal.
The zero condition blocks the trade
The bars expand while OsMA is still below zero — momentum is improving but the arrangement is bearish. Requiring the trend side skips a long entry taken against the larger move.
FAQ
- Is OsMA the same as the MACD histogram?
- It is the same quantity as the histogram most charting packages draw, but in MetaTrader it is a different indicator. MT5's MACD publishes MAIN_LINE and SIGNAL_LINE only, and it draws MAIN_LINE as the bars. The MAIN − SIGNAL bars you see elsewhere exist in MT5 as OsMA, reached with iOsMA. When a strategy from another platform mentions the histogram, OsMA is what it means.
- Why use OsMA instead of MACD if they cross at the same moment?
- Because it takes one value rather than two. An OsMA rule reads a single buffer and asks whether it is positive; a MACD rule reads two buffers of the same handle and compares them. The crossing moment is identical, so the reason to prefer OsMA is that it also states how far apart the lines are — which is what lets a rule ask whether the gap is widening, something a crossover cannot say.
- What does it mean when the bars shrink?
- The two MACD lines are converging. Price may still be making progress, but it is doing so more slowly than the slow average is catching up, so the crossover is approaching. Shrinking bars above zero are a warning that the bullish arrangement is being given back, not yet a signal that it has been.
- Can I set a threshold like 'OsMA above 0.001'?
- Not one that transfers. OsMA is a difference between two moving averages of price, so its magnitude depends on the instrument, the timeframe and the fast/slow settings. A level tuned on EUR/USD H1 means nothing on gold or on M5. Compare against zero, or against OsMA's own value some bars back — both survive the change of scale.
- Can I build an OsMA EA without coding?
- Yes. The OsMA Re-acceleration + Zero Line template places two OsMA nodes — one at the current bar, one three bars back — crosses them to detect the histogram expanding again, and requires OsMA to be on the trend side of zero before acting. The periods, the lookback and the trailing stop are all EA inputs.
- How should I validate settings before going live?
- Backtest on quality tick data, then run on a demo account before risking money. OsMA inherits MACD's weakness in flat markets, so pay attention to how the equity curve behaves during ranging periods rather than only to the headline profit. Hold back data the search never saw, and prefer settings that stay profitable across periods rather than the single best combination.
Articoli correlati
Glossary