MA OsMA Filter Crossover Alert Indicator: A Cross With a Histogram Check

Written by Dominic Walsh · Published · Last updated

OsMA is the gap between MACD and its signal line, which makes it a reasonable second opinion on a moving average cross. The ma osma filter crossover alert indicator pairs the two: a 10 over 30 EMA crossing supplies the signal, and the OsMA reading has to point the same way before an arrow appears.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 4: FastMA, SlowMA, Buy, Sell
Alerts popup, push notification
Inputs 8

What the MA OsMA Filter Crossover Alert Indicator draws on the chart

FastMA is the dodger blue 10-period line and SlowMA the orange 30-period one.

Buy places a lime arrow beneath the bar where the fast line crosses above the slow one.

Sell places a red arrow above it on the opposite cross.

OsMA stays in the background. Add MetaTrader’s own Moving Average of Oscillator alongside if you want to watch it.

  • FastMA: line, dodger blue, width 2
  • SlowMA: line, orange, width 2
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
MA OsMA filter crossover alert indicator on EURUSD H1 with the EMA pair and filtered arrows
MA OsMA filter crossover alert indicator on EURUSD H1 with the EMA pair and filtered arrows

How the MA OsMA Filter Crossover Alert Indicator calculates its values

Both averages, both bars

Four iMA calls give fast and slow at the current bar, plus fast_prev and slow_prev one bar back, all on MODE_EMA over the close. FastBuf and SlowBuf then hold the current values, which are the two lines you see. Reading each average twice turns this into a crossing test rather than a state test.

Detecting the cross

bull_cross needs fast_prev at or below slow_prev, with fast above slow. bear_cross mirrors it. Both readings come from the same bar indices on each side, so nothing drifts between the two comparisons.

Asking OsMA to agree

osma comes from iOsMA using `OsMAFast`, `OsMASlow` and `OsMASignal`, the conventional 12, 26 and 9. OsMA is MACD minus its signal line, so a positive reading puts the MACD histogram above zero and momentum building upward. Asking it to match the cross direction filters out crossings that happen while momentum still fades.

How to read the signals

Both lines are visible, so you can always see the cross behind an arrow.

A cross with no arrow means OsMA disagreed at that moment, which is worth noticing in itself.

A 10 and 30 pair runs at a middling speed, so signals arrive a few times a week on H1.

The chart never plots OsMA, so add it separately to check the filter’s reasoning.

Alert channels in this build: popup and push notification, one message per closed bar.

Two channels ship here: a terminal popup under `EnableAlerts`, on by default, and a mobile push notification under `EnablePush`, off by default. There is no email or sound option in this build. The guard permits one message per closed bar.

Every MA OsMA Filter Crossover Alert Indicator input

Core settings

Setting What it does Default
FastMAPeriod Crossing average length, default `10`. 10
SlowMAPeriod Reference average length, default `30`. Widening the gap reduces the cross count. 30
OsMAFast OsMA fast length, default `12`, with `OsMASlow` at `26` and `OsMASignal` at `9`, the standard trio. 12
OsMASlow (see inputs panel) 26
OsMASignal (see inputs panel) 9

Display settings

Setting What it does Default
ArrowOffsetPts Distance between candle and arrow, default `20` points. 20

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePush (see inputs panel) off
MA OsMA filter crossover alert indicator inputs: FastMAPeriod, SlowMAPeriod and OsMAFast
MA OsMA filter crossover alert indicator inputs: FastMAPeriod, SlowMAPeriod and OsMAFast

Settings that fit your chart

A 10 and 30 EMA pair with a MACD-derived filter suits H1 and H4 on the majors. EURUSD H1 is the reference chart. On M5 the cross fires often and OsMA, being slower, blocks a large share of them. On the daily chart both halves slow right down and signals become a handful a year.

When the MA OsMA Filter Crossover Alert Indicator fails

OsMA derives from MACD, which itself comes from moving averages. The filter therefore shares much of the lag it is meant to check.

In a range the cross and the histogram often agree on the same misleading move, since both react to the same swings.

Neither the OsMA value nor its zero line appears on the chart, so a blocked cross leaves you nothing to inspect.

Copy the compiled MA OsMA Filter Crossover Alert Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the MA OsMA Filter Crossover Alert Indicator for MT4 and MT5

The zip holds the compiled MA OsMA Filter Crossover Alert Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What is OsMA and why use it as the filter?

OsMA is the Moving Average of Oscillator: MACD minus its own signal line, which is the MACD histogram. A positive reading means momentum builds in the same direction the histogram points. Asking it to agree with a moving average cross blocks the crossings that happen while momentum already fades.

Do OsMAFast and OsMASlow use standard MACD settings?

Yes. `OsMAFast` at `12`, `OsMASlow` at `26` and `OsMASignal` at `9` are the conventional MACD trio. Keeping them standard means the filter behaves the way anyone familiar with MACD expects. You can also add MetaTrader’s own OsMA with matching settings and see exactly what it reads.

Why does a visible cross sometimes produce no arrow?

Because OsMA disagreed. bull_cross can be true while the histogram still sits below zero, which means the averages have crossed but momentum has not turned with them. The tool withholds the arrow in that case. Those are often the crossings worth skipping.

How does widening FastMAPeriod and SlowMAPeriod change things?

It reduces the cross count. At `10` and `30` the pair crosses a few times a week on H1. Move to 10 and 50 and crossings become rarer but each one covers more ground. Bringing them together does the reverse and leans much harder on the OsMA filter.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the MA OsMA Filter Crossover Alert Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Also, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment