WRB Hidden Gap MetaTrader indicator — detects and marks WRB. WRB is either a Wide Range Bar (a very long bar) or Wide Range Body (a candlestick with very long body). As WRB by themselves do not offer much information, the indicator also detects Hidden Gaps based on the WRB. It also shows filled and unfilled Hidden Gaps differently, so that it is easier to see the current market situation at a single glance. Optional alerts can be used to get signals when the current price first enters an unfilled Hidden Gap. The indicator is available for both MT4 and MT5.

Input parameters

  • UseWholeBars (default = false) — if true, the indicator will search for Wide Range Bars instead of Wide Range Bodies.
  • WRB_LookBackBarCount (default = 3) — how many bars to use in WRB comparison. The bigger the value the rarer and wider detected WRB.
  • WRB_WingDingsSymbol (default = 115) — a symbol used to mark WRB. A small diamond by default.
  • HGcolor1 (default = clrDodgerBlue) — the first (default) color for Hidden Gap rectangles.
  • HGcolor2 (default = clrBlue) — the second color for Hidden Gap rectangles.
  • HGstyle (default = STYLE_SOLID) — line style for the Hidden Gap rectangles.
  • StartCalculationFromBar (default = 100) — number of bars to look back to mark up the Wide Range Bodies and Hidden Gaps.
  • HollowBoxes (default = false) — if true, the rectangles marking the Hidden Gaps will be empty, otherwise — filled.
  • EnableNativeAlerts (default = false) — if true, a native MetaTrader popup alert will be used when the price enters a Hidden Gap territory.
  • EnableEmailAlerts (default = false) — if true, an email message will be sent when the price enters a Hidden Gap territory. Email should be properly configured in MetaTrader via Tools->Options->Email.
  • EnablePushAlerts (default = false) — if true, an email message will be sent when the price enters a Hidden Gap territory. Notifications should be properly configured in MetaTrader via Tools->Options->Notifications.
  • ObjectPrefix (default = "HG_") — prefix for chart objects for compatibility with other indicators.

Example and strategy

WRB Hidden Gap Indicator - Example MetaTrader Chart - Wide Range Bodies

The chart shows an example of Hidden Gap markup on the EUR/USD daily timeframe with default settings. The cyan diamonds are drawn inside WRB bars. Hidden Gaps are depicted using light blue and blue rectangles. Unfilled Hidden Gaps are shown with rectangles spanning past the right edge of the chart. Hidden Gap rectangles change color when an unfilled Hidden Gap of another color currently exists and intersects with a new Hidden Gap. The image shows only Wide Range Bodies (UseWholeBars = false). As you can see, there is not much difference when switching to Wide Range Bars (UseWholeBars = true):

WRB Hidden Gap Indicator - Example MetaTrader Chart - Wide Range Bars

This indicator does not generate any trading signals. It offers information about price action to aid a trader with entry and exit signals generated by some other strategy. WRB bars are nearly meaningless, but only WRB can show a Hidden Gap. A Hidden Gap, in its turn, can be treated as a sort of pivot or support/resistance zone. Hidden Gaps can also be treated as the usual price gaps (weekly, for example).

An entry signal (by some trading system) coinciding with the price entering a Hidden Gap rectangle can be considered confirmed, while the opposite edge of the rectangle can be used as a target level. If your system generates a trade outside the Hidden Gap territory, the latter can be used either as take-profit or as stop-loss.

Downloads (ver. 1.02, 2022-04-09)

WRB Hidden Gap for MetaTrader 4 in .zip

WRB Hidden Gap for MetaTrader 4 in .mq4

WRB Hidden Gap for MetaTrader 5 in .zip

WRB Hidden Gap for MetaTrader 5 in .mq5


Warning! If you do not know how to install this indicator, please read the MetaTrader Indicators Tutorial.

Do you have any suggestions or questions regarding this indicator? You can always discuss WRB Hidden Gap with the other traders and MQL programmers on the indicators forums.


1.02 - 2022-04-09

  • Added support for all three types of alerts — native (popup), email, and mobile notifications.
  • Added the input parameter for chart object names' prefix.
  • Optimized calculation algorithm.

© 2005–2022


Design — Mart Studio

Forex trading bears intrinsic risks of loss. You must understand that Forex trading, while potentially profitable, can make you lose your money. Never trade with the money that you cannot afford to lose! Trading with leverage can wipe your account even faster.

CFDs are leveraged products and as such loses may be more than the initial invested capital. Trading in CFDs carry a high level of risk thus may not be appropriate for all investors.