Initial Balance is the range represented by the first two segments (typically half-hour segments) of a trading session. Range extensions are a function of the longer-term trader participation, pushing price outside of the beginning 'fair' range established by the local traders. With the introduction of 24/7 markets the initial balance is often now regarded as less important than in the past, however re-calculating IB for multiple trading sessions may reinstitute insight to Market Direction and Confidence
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.