potentially go back. This gives perfect targets for your trades.
Imbalance is created from the high and low of 3 candles. When the wicks the of 1st and 3rd candle does not fully overlap the middle one.
You can define the penetration ratio which will delete a tested zone from the chart. Usually find that 20% (0.2) is pretty accurate.
Fix deletion of triggered imbalanced zone
Add mid line for each boxes
The mid line can be used as specific target when using imbalanced zone as your potential target zone.
Also a reduce option which will reduce the imbalance based on price touch within it.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.