BBMA Indicator for MT4 + MT5: Bollinger Bands with 5 EMA

Written by Dominic Walsh · Published · Last updated

The BBMA indicator combines 20-period Bollinger Bands with a fast 5-period EMA on the price chart. The mix follows the Oma Ally method. It waits for a candle to close outside an outer band and the next candle to close back inside. If the EMA agrees with the direction, it prints a BBMA Buy or BBMA Sell arrow. A corner panel reports the band zone and EMA bias. The build runs on MT4 and MT5 as a chart overlay.

This build ships as bbma-indicator.ex4 for MT4 and bbma-indicator.ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 6: Upper, Mid, Lower, EMA, BBMA Buy, BBMA Sell
Alerts popup, push notification, email, sound
Inputs 14

What the Bbma Indicator draws on the chart

Three Bollinger lines sit on price. Mid in gold is the 20-period simple average. Upper and Lower in deep sky blue sit InpDeviation standard deviations above and below it, 2.0 by default. The EMA plot, a magenta line at width 2, is the 5-period exponential average that supplies the bias.

BBMA Buy is a lime arrow, code 233, drawn ArrowOffsetPts points under the low of the re-entry candle. A lime BUY text label sits a little further down. BBMA Sell is a red arrow, code 234, above the high with a red SELL label. The text labels only print within the last InpMaxLabelBars bars, 600 by default.

With ShowPanel at true, a small dark panel sits in the chosen corner. It lists the band zone of the current close: ABOVE UPPER, INSIDE or BELOW LOWER. It also says whether the EMA reads RISING or FALLING, and shows the band and EMA settings in use.

  • Upper: line, deep sky blue, width 1
  • Mid: line, gold, width 1
  • Lower: line, deep sky blue, width 1
  • EMA: line, magenta, width 2
  • BBMA Buy: arrow, lime, width 2, arrow code 233
  • BBMA Sell: arrow, red, width 2, arrow code 234
BBMA indicator on EURUSD H1: blue Bollinger bands, gold Mid, magenta 5 EMA, lime BUY / red SELL re-entry arrows.
BBMA indicator on EURUSD H1: blue Bollinger bands, gold Mid, magenta 5 EMA, lime BUY / red SELL re-entry arrows.

How the Bbma Indicator calculates its values

Bands from a 20-bar window

The basis comes first. For every bar the code sums the last InpBBPeriod closes, 20 by default. That average is the basis and lands in the Mid buffer. It then measures the standard deviation of those closes around the basis. Upper and Lower sit InpDeviation times that value above and below. Nothing comes from iBands; the maths runs inside the indicator, so MT4 and MT5 produce identical lines.

A fast EMA seeded with an SMA

The EMA plot starts as a simple average. That seed covers InpEmaPeriod bars at the warm-up boundary. From there it runs the recursive formula with alpha equal to 2 divided by one more than InpEmaPeriod. With the default 5 that alpha comes to one third, so the line tracks the last few closes closely. The bias test is plain. Rising means the current EMA value sits at or above the previous one, and falling means at or below.

The re-entry rule

A BBMA Buy needs three conditions. The previous close must sit below Lower, the current close at or above Lower, and the EMA must be rising. A BBMA Sell needs the previous close above Upper, the current close at or below Upper, and the EMA falling. The test uses finished closes, so an arrow on a closed bar stays where it printed. Only the bar still in progress can change before it closes.

How to read the signals

A lime BBMA Buy arrow marks a re-entry at the lower band. The candle before it closed below the band, this candle closed back inside, and the magenta EMA turned up. Mean-reversion traders read it as the lower band rejecting price. They aim at the gold Mid line or the upper band as a target.

A red BBMA Sell arrow is the mirror at the upper band with the EMA falling. When price keeps closing outside the band and no arrow prints, the extreme is still running. The tool waits for the re-entry close rather than calling a top.

The panel gives a one-glance status. INSIDE with EMA RISING after a BUY arrow means the setup still holds. ABOVE UPPER with a falling EMA says wait for the next close. Arrows that fire against a steep EMA slope deserve more caution.

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

Alerts go out once per closed bar by popup, push notification, email and sound, each behind its own switch. The message names the side and the band that triggered it.

Every Bbma Indicator input

Core settings

Setting What it does Default
InpBBPeriod Bollinger period (mid + bands). InpBBPeriod (default 20) sets the look-back for Mid, Upper and Lower. Try 10 to hug price for more re-entries, or 50 to slow the bands. 20
InpDeviation Std-dev multiplier. InpDeviation (default 2.0) multiplies the standard deviation for the outer bands. Values of 2.5 or 3.0 demand a bigger extreme; 1.5 gives more but weaker signals. 2.0
InpEmaPeriod Fast EMA period (bias). InpEmaPeriod (default 5) controls the bias line. Use 10 or 20 to make the rising or falling test stricter and filter arrows in sharp counter-moves. 5

Display settings

Setting What it does Default
ArrowOffsetPts Arrow / label offset (points). 10
InpMaxLabelBars Draw BUY/SELL text within N recent bars. 600
ShowPanel Show corner info panel. ShowPanel (default true) switches the corner status panel on or off without touching the plots. on
PanelCorner 0=UL 1=UR 2=LL 3=LR. 0
PanelBg Panel background. RGB 16,20,32

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
BBMA indicator inputs panel: InpBBPeriod 20, InpDeviation 2.0, InpEmaPeriod 5, ShowPanel and alert switches
BBMA indicator inputs panel: InpBBPeriod 20, InpDeviation 2.0, InpEmaPeriod 5, ShowPanel and alert switches

Settings that fit your chart

The screenshots use EURUSD H1 with the default 20 / 2.0 bands and 5 EMA. There the extreme-then-re-entry pattern appears several times a week. Band re-entry works best on instruments that swing inside ranges. Majors on H1 and H4, and the cross pairs in quiet sessions, fit the method. On M5 and M15 the bands get pierced constantly and the 5 EMA flips often. Most users widen InpDeviation or lengthen InpEmaPeriod there. D1 works, but the arrows arrive late enough that a pullback entry matters more than the arrow bar itself.

When the Bbma Indicator fails

Strong trends. In a sustained move price can close outside the upper band for many bars. It may re-enter for one candle and then keep going. The BBMA Sell arrow that prints on that re-entry is early. Its EMA filter only helps if the EMA has already rolled over.

The EMA bias is only one bar deep. Rising means the EMA sits at or above its previous value. One up-tick after a long fall already passes the test. That is a thin filter in a fast market.

Open-bar changes. The arrow on the forming bar can appear and disappear until the close. The re-entry test uses the live close, so nothing is final before then. Arrows on closed bars hold, and the alert only fires for the last closed bar.

Copy bbma-indicator.ex4 into MQL4/Indicators and bbma-indicator.ex5 into MQL5/Indicators, then restart the terminal and drag the Bbma Indicator onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Bbma Indicator for MT4 and MT5

The zip bbma-indicator-indicator-forexmt4systems.zip holds bbma-indicator.ex4, bbma-indicator.ex5 and a short README, compiled files only. 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 makes a BBMA Buy arrow different from a normal Bollinger touch?

A touch is not enough. The code needs the previous candle to close below the Lower band. The current candle must then close at or above it. On top of that, the 5-period EMA must be rising on that bar. All three must hold on closed data. That is why arrows are rarer than band touches and why they do not repaint once the bar ends.

Why does the BBMA indicator draw its own bands instead of using iBands?

Computing the basis and standard deviation inside the indicator keeps the MT4 and MT5 builds identical. It also avoids a handle or a second indicator call. The result matches a standard 20-period, 2.0-deviation Bollinger on close. Overlay the platform’s own Bands and the lines will sit on top of each other.

Which InpEmaPeriod gives fewer arrows on EURUSD H1?

Raising InpEmaPeriod from 5 to 10 or 20 slows the magenta line. Its one-bar direction then flips less often and more re-entries fail the bias test. You get fewer arrows, mostly the ones that line up with a turn already in progress. Keep 5 if you want every re-entry and plan to filter by hand.

What does the corner panel show when ShowPanel is true?

Four lines. The first is the zone of the current close relative to the bands (ABOVE UPPER, INSIDE or BELOW LOWER). Next comes whether the EMA reads RISING or FALLING on the current bar. The last two list the band period and deviation in use and the EMA period. It updates on every tick and sits in the corner set by PanelCorner.

Are results guaranteed?

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

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