Expert Advisor – Bollinger Bands Breakout 1.0

The Bollinger Bands Indicator is one of the most popular, it can be used for breakout strategies as well as reversal. In this article you can download an Expert Advisor for MetaTrader4 that will use the Bollinger Bands breakout as entry signal.

Bollinger Bands

You can download the source code with the following link.

Download Here

About the Bollinger Bands Breakout EA


Parameters of the Bollinger Bands Breakout EA
  • Position Size, to define the position size
  • Stop loss in pips
  • Take profit in pips
  • Slippage in pips
  • Enable trade, to enable or disable the trading function
  • Period of the Bollinger Bands
  • Deviation of the Bollinger Bands

Entry Signal

  • BUY signal when the price is above the upper band
  • SELL signal when the price is below the lower band

Exit Signal

  • Fixed Take Profit OR Stop Loss hit

Result EURUSD H1

The backtesting on the EURUSD shows an interesting result. Despite not being stable the Risk Reward Ratio allows the EA to be profitable in the tested timeframe. The profit is around the 5% with a low drawdown. This EA could be used as base for a more complex one.

Bollinger Bands Breakout EA Backtest


  • Risk Reward Ratio produces a profit in the tested period
  • EA not heavily impacted by ranging market


The EA can suffer of false breakouts.



The profitability in the backtested period can indicate potential, the EA could be improved with further condition and become even more profitable and consistent.

This Expert Advisor is free to download and use.

Download Here

I remember when I first started to learn MQL coding, although I had some knowledge of coding many concept were still unclear. To speed up your learning process I would recommend to follow a quick MQL course that will give you the fundamentals you need to create functional Trading Robot.

You can check out the following two course, Udemy often has sales on to make the courses even more affordable, and if you subscribe to my newsletter (top and bottom of the page) I will let you know when this happens.

MQL4 Programming for Traders: Build Robust Trading Robots!

Black Algo Trading: Build Your Trading Robot

Please leave a comment if you have any feedback or doubt and remember to like us on Social Media! I would really appreciate also suggestion for improvements and reports of any bug found. Thank you!

If you want to save hours of research and coding and you want to see some professional code check this out! You can use it to build your own EA!

13 thoughts on “Expert Advisor – Bollinger Bands Breakout 1.0”

  1. Hi, I’m very interested on this EA, but I could not install it since I put on the chart and nothing happens. Pls I want to know if you’re still working on this EA, I can see its potential and I could give you a hand in optimizing it because I think this EA works very similiary to my trading strategy and if we can optimize its entries and exits and specific trading hours, it could be a very great Expert.
    Pls let me know.
    Thanks and BS.

    • Hi Shin,
      Did you compile the EA?
      Download the mq4 file and place it in the Experts folder, open it with MetaEditor and compile it, if there is no error you will have the ex4 file in the same folder, at this point in you MT4 client you can mount the EA, let me know how it goes.

  2. Complimenti per questo articolo. Sto lavorando ad una strategia di scalping basata sul breakout delle bb. Lo il mio ea gestisce per ora con interfaccia il basket dei Trades a 5m su una valuta con gestione ghosted di sl e tp.

    • Grazie per il feedback Andrea.
      Ben fatto a lavorare con EA e codice per Metatrader, se vuoi condividere piu dettagli e magari sentire un parere sentiti libero di contattarmi personalmente tramite la form di supporto.


  3. Heyy there really to disturb you. I just want to thank you for your hard work, it gaves a very good results during my backtest. However, I tried to install it in my chart to trade live, it wouldn’t trade. No activity for few days already. Anywhere I go wrong? Just can’t wait to use this EA =D

  4. Hi there, I’ve backtested this EA and it shows and impressive results! However when I try to trade on live account, it won’t trade. There are no activity in couple of days already. Anywhere I did wrong?

    • Hi Reno,
      Thank you for the feedback.
      Do you see the small face with a smile on the chart?
      Can you see any message or error if you go in the expert and journal tabs of the client terminal?

  5. Buongiorno, domanda, ho usato il codice e inserita la logica nel mio ea. Succede questo: una volta caricato l’ea su un grafico con TradeEnabled=true, crea subito una operazione BUY.

    void OnTick()

    //Check of Entry/Exit signal with operations to perform
    if(CanOpenBuy && CanOpenSell && CanOrder) OpenNew(OP_BUY);
    if(CanOpenSell && CanOpenBuy && CanOrder) OpenNew(OP_SELL);

  6. Seguito del post precedente: può darsi che l’apertura del BUY sia effettivamente dovuta al verificarsi delle condizioni del filtro. Ad ogni modo se potessi darmi feedback la cosa sarebbe gradita.

    • Direi che il prezzo e’ uscito dalle BB e ha fatto scattare l’ordine.
      l’EA dovrebbe fare un semplice confronto e in caso questo e’ verificato l’ordine viene eseguito.
      Prova a confrontare con il grafico.
      Dammi pure del tu,


  7. Dunque ho modificato la funzione di ricerca segnale inserendo due filtri (TF5M scalping breakout su bb), media mobile asp a 200 e soglia di atr:

    void FindBandsTrend(){
    double EmaValue=iMA(Symbol(),0,EmaPeriod,0,MODE_EMA,PRICE_CLOSE,0);
    double AtrValue=iATR(Symbol(),0,7,0);
    double BandsTopCurr=iBands(Symbol(),0,BandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_UPPER,0);
    double BandsLowCurr=iBands(Symbol(),0,BandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_LOWER,0);
    double BandsTopPrev=iBands(Symbol(),0,BandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_UPPER,1);
    double BandsLowPrev=iBands(Symbol(),0,BandsPeriod,BandsDeviation,0,PRICE_CLOSE,MODE_LOWER,1);
    if (AtrFilterOn==true)
    if(Close[1]BandsTopCurr && Close[0]>EmaValue && AtrValue>AtrThreshold) BandsBreakUp=true;
    if(Close[1]>BandsLowPrev && Close[0]EmaValue && AtrValue>AtrThreshold) BandsBreakDown=true;
    if (AtrFilterOn==false)
    if(Close[1]BandsTopCurr && Close[0]BandsLowPrev && Close[0]<BandsLowCurr && Close[0]<EmaValue) BandsBreakDown=true;

    l'ea mi ha aperto la posizione sul valore massimo di candela

    • Non capisco se c’e una domanda, ma vedo che nei filtri stai confrontanto la chiusura della candela precedente con il valore delle BB attuale in certi casi (Close[1]), non sono sicuro se e’ quello che vuoi fare


Leave a Comment