The imbalance detector indicator looks for prices the market skipped. When one candle’s high sits below the low of the candle two bars later, the space between them never traded. That gap is the imbalance.
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 | 2: ImbalanceUp, ImbalanceDown |
| Alerts | popup |
| Inputs | 7 |
What the Imbalance Detector Indicator draws on the chart
Rectangles cover each gap, sea green for bullish and indian red for bearish.
`ImbalanceUp` uses arrow 233 and `ImbalanceDown` uses 234.
Each arrow sits at the midpoint of its gap rather than beside the candle.
`InpShowLabels` adds a text tag on every box.
- ImbalanceUp: arrow, lime, width 2, arrow code 233
- ImbalanceDown: arrow, red, width 2, arrow code 234

How the Imbalance Detector Indicator calculates its values
Three bars define the gap
The code compares the high of the older bar against the low of the newer one, two positions apart. A space between them means no trade happened at those prices during the sequence.
The middle bar is the mover
The candle in between is what jumped the price. Its size is why the outer two never overlap, which is the whole shape this reading depends on.
Boxes get capped
`InpLookback` `500` bounds the scan and `InpMaxBoxes` `80` limits how many rectangles survive. Without the cap a long history would leave hundreds of boxes on the chart.
How to read the signals
A gap is a fact about price, not an opinion about direction.
The arrow sits inside the box, which is where the midpoint falls.
Fresh gaps matter more than old ones in most readings of this idea.
Nothing here tracks whether price came back and filled a gap.
Alert channels in this build: popup, one message per closed bar.
One route ships here. `InpAlertOnNew` arrives true and raises a terminal message when a fresh gap appears. This build has no handset option, no mail option and no clip option. The guard limits it to one message per bar.
Every Imbalance Detector Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpMaxBoxes |
Max imbalance rectangles drawn. Rectangles kept on the chart, default `80`. | 80 |
InpLookback |
Bars to scan back. Bars the scan covers, default `500`. | 500 |
InpObjPrefix |
Name prefix on every object, default `”FMS_IMB_”`. | FMS_IMB_ |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpShowLabels |
Show IMBALANCE text labels. Add a text tag on every box, default `true`. | on |
InpBullColor |
Fill for a bullish gap, default `clrSeaGreen`. | sea green |
InpBearColor |
Fill for a bearish gap, default `clrIndianRed`. | indian red |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpAlertOnNew |
Terminal message when a fresh gap appears, default `true`. | on |

Settings that fit your chart
Gaps need bars with real bodies to create them. EURUSD H1 is the reference chart, where `InpLookback` `500` covers about three weeks. On M1 the gaps are tiny and constant. H4 leaves fewer but far larger ones.
When the Imbalance Detector Indicator fails
Eighty boxes is a busy chart before you add anything else.
No filter on gap size ships, so a one-point gap counts the same as a large one.
The tool marks a gap forming, never a gap filling.
Copy the compiled Imbalance Detector 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.
Background reading on the method behind the Imbalance Detector Indicator: Copy trading on Wikipedia, Cupandhandle at Investopedia.
Download the Imbalance Detector Indicator for MT4 and MT5
The zip holds the compiled Imbalance Detector 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
What exactly does InpLookback 500 scan for?
Sequences of three bars where the older high sits below the newer low, or the reverse. That non-overlap is the gap, and five hundred bars is far enough back to keep the relevant ones.
Why does InpLookback skip the middle candle?
Because it is the cause rather than the level. The gap sits between the outer two bars, so the box covers that space. The middle candle simply explains why the space exists.
Where does the ImbalanceUp arrow sit?
At the midpoint of the gap, inside the rectangle. Many traders watch the middle of an untraded area as the level that matters, which is why the arrow marks it rather than the candle.
What happens when InpMaxBoxes 80 is reached?
The oldest rectangles drop off as new ones arrive. Eighty is already a crowded chart, so raising it adds visual noise faster than it adds useful information.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Imbalance Detector Indicator as one input. Always backtest before trading live.
Category: this is part of our Smart Money collection. Also, browse more Smart Money for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Copy trading on Wikipedia.
- Additional market context is at Cupandhandle at Investopedia.
