The advanced bollinger bands indicator adds the one thing a plain band set leaves out: a marker for the moment price comes back. BB Mid, BB Upper and BB Lower run as usual. Buy and Sell then mark the bar where a close returns inside the band it had left.
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 | 5: BB Mid, BB Upper, BB Lower, Buy, Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 9 |
What the Advanced Bollinger Bands Indicator draws on the chart
BB Mid is the average at the centre of the construction.
BB Upper and BB Lower sit Deviations either side of it.
Buy marks a close back above BB Lower after the previous close finished below it.
Sell marks the mirror re-entry through BB Upper.
- BB Mid: line, gold, width 1
- BB Upper: line, deep sky blue, width 2
- BB Lower: line, deep sky blue, width 2
- Buy: arrow, lime, width 4, arrow code 233
- Sell: arrow, red, width 4, arrow code 234

How the Advanced Bollinger Bands Indicator calculates its values
The bands
Three calls to the platform band routine give the middle, upper and lower values over BandPeriod at Deviations.
Nothing is computed by hand here, so the bands match what any other standard band tool would draw at the same settings.
Reading the previous band, not the current one
The re-entry test needs the band as it stood on the previous bar, so the code reads the upper and lower values at that shift as well.
Comparing the previous close against the previous band rather than the current one is what makes this a genuine crossing test. Using today band for yesterday close would report crossings that never happened.
What qualifies as a re-entry
A buy needs the previous close below the previous lower band and the current close back above the current lower band.
So price has to have actually finished outside and then finished inside again. A wick beyond the band with a close inside never qualifies.
How to read the signals
A marker is a return, not a touch. Price closed outside the band and then closed back in.
Both bands widen and narrow with volatility, so what counts as outside changes bar by bar.
In a strong trend price can close outside a band for many bars, and the re-entry then arrives well into the move.
BB Mid keeps drawing throughout and doubles as a plain average of the same length.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
Alerts cover popup, push, email and sound on each re-entry. A bar time check keeps it to one alert per closed bar.
Every Advanced Bollinger Bands Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
BandPeriod |
BandPeriod sets the window for the average and the deviation. It defaults to 20. | 20 |
Deviations |
Deviations is how many standard deviations each band sits from the middle, 2.0 by default. Widening it makes closes outside the band rarer, and re-entries rarer with them. | 2.0 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowOffsetPoints |
ArrowOffsetPoints is the cosmetic gap between a marker and its candle, 30 points by default. | 30 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
EnableAlerts gates the message block and defaults to true. | 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 |

Settings that fit your chart
The screenshot uses EURUSD H1. Re-entry setups suit markets that oscillate around a mean, so ranging majors on H1 and H4 give the cleanest examples. On a strongly trending instrument price closes outside the band repeatedly and the re-entries arrive late every time.
When the Advanced Bollinger Bands Indicator fails
Closing outside a band is common in a trend, so a re-entry marker often lands against a move that continues.
The band width changes every bar, so the level price had to clear is not the level it has to close back inside.
Nothing measures how far outside price went. A close one point beyond the band counts exactly like a decisive one.
The re-entry always arrives at least one bar after the excursion, which is the cost of requiring a close on both sides.
Copy the compiled Advanced Bollinger Bands 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 Advanced Bollinger Bands Indicator for MT4 and MT5
The zip holds the compiled Advanced Bollinger Bands 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.
FAQ
Why read BB Lower from the previous bar as well?
Because a crossing test needs both readings from their own bar. Comparing the previous close against the current band would report crossings that never happened, since the band moves every bar. Reading both at their own shift is what makes the test honest.
Does a wick beyond BB Upper count as an excursion?
No. The test uses closes on both sides, so price has to actually finish outside the band and then finish back inside. A bar that trades through the band and closes within it never starts the sequence, which cuts out a lot of noise.
What does raising Deviations from 2.0 do to the markers?
It pushes both bands further from the middle, so closes outside them become rarer. Fewer excursions means fewer re-entries, and the ones that remain follow larger moves. Lowering Deviations does the reverse and fills the chart.
Is a Buy marker here a reversal signal?
It reports that price closed back inside a band it had left, which is a description rather than a forecast. In a range that often coincides with a turn. In a trend price can leave and re-enter the same band repeatedly while continuing in one direction.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Advanced Bollinger Bands Indicator as one input. Always backtest before trading live.
Category: this is part of our Volatility collection. Also, still, yet, hence, browse more Volatility for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- Learn more about the underlying method in Bollinger Bands on Wikipedia.
- For wider market background, see Bollinger Bands at StockCharts ChartSchool.
