Forex Blog

First-hand Forex trading experience and information about foreign exchange market that will be useful to traders


Improving Wide Range Bars Indicator with Alerts

April 18, 2014 by

The original WRB Hidden Gap indicator for MetaTrader 4 was developed by Akif Tokuz. It is based on Wide Range Bars + Hidden Gaps system developed by The Strategy Lab. Although they offer a lot of paid educational content, they have a free tutorial explaining the concept of WRBs and HGs. I highly advise you to read thoroughly that tutorial before doing anything with the presented WRB Hidden Gap indicator.

Akif Tokuz’s version of the indicator was developed back in 2010 and required some serious modifications. Not only have I converted it to MQL5, but I have also added some new features and optimized the code. Here is the list of my additions:

  • Alerts (optional) — once per hidden gap on first entry of price into the rectangle.
  • Switch between Wide Range Bars and Wide Range Bodies.
  • Control the rectangle style.
  • Correct indicator calculation. Previously, it would skip bars if more than one bar appear at a time.
  • Hidden Gaps are now marked as filled immediately when price fills them — without waiting for the bar to close.
  • Fixed a bug, which resulted in the incorrectly positioned Hidden Gaps.

Basically, this indicator allows detection of the hidden gap zones that offer useful price action levels for traders. It does not matter what strategy you use — hidden gaps can help you if you are technical trader, a fundamental analyst or a pure PA practitioner:

WRB Hidden Gap Indicator on EUR/USD @ H4 Chart

You can download the MT5 or MT4 version, or read more info about this hidden gap indicator.

If you find any bugs in this technical indicator or if you have some feature suggestions, please post about it using the commentary form below.

6 Responses to “Improving Wide Range Bars Indicator with Alerts”

  1. Denis

    Thank you!


    Andriy Moraru Reply:

    You are welcome!


  2. Matthew

    Do you have a NinjaTrader version of the WRB-HG ?



    Andriy Moraru Reply:

    No, sorry. I do not code for NinjaTrader.


  3. Rainmaker

    Hello Andriy Moraru,
    The lastest build of MT5 does not seem to work well with the WRB-HG indicator and other indicators that are well written. Can you take a look at it and see if you can optimize it?

    It stops the chart from loading and even disrupts the price feed from letting candles “paint”. When it is having issues it flickers when you refresh the page and does not let the other indicators work properly.

    This is a very important indicator of a lot of traders trading volatility. If you are busy and you know another great coder who will charge a small fee, I am willing to pay. The same goes for you of course.

    I really would like this fixed asap.


    Andriy Moraru Reply:

    Hello Rainmaker,

    I’ve just tested it on EUR/USD @ M15 with default settings in MT5 Build 2361 and couldn’t spot any problems. I would need more information for testing and possibly fixing this issue:
    1. Which MT5 build are you using?
    2. What currency pair/timeframe/broker/account type you are using it with?
    3. What settings are you using (if different from default).
    4. Which other indicators are you using with it? Do you get the same problem when WRB-HG is the only indicator attached?
    5. Providing some screenshots and videos of the problem could help me with this too.

    It is preferable that this discussion continues in the indicator’s forum thread here: – it will be much simpler for both of us because it is easy to share files, code, and images there.

    Thank you!


Leave a Reply

required (will not be published)