OPEN-SOURCE SCRIPT
Initial Balance Suite [ChartSmith]

Initial Balance Suite tracks the high, low, and midpoint established during a configurable opening window, then projects extension levels and archives prior sessions — giving you a complete picture of the day's structural framework from the first bar after the IB closes.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT IS THE INITIAL BALANCE?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Initial Balance is the price range established during the opening period of a session — traditionally the first hour of RTH trading. The high and low formed during this window define the day's foundational structure. When price stays inside the IB, the market is balancing. When price breaks out of it, the market is entering price discovery. Extension levels above and below the IB project how far that discovery might reach.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SESSION SETTINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Start — Set the hour and minute at which the IB window begins. Defaults to 9:30, the RTH open.
Timezone — Aligns the session start to the correct local time. Options: America/New_York · America/Chicago · Europe/London · Asia/Tokyo · UTC.
IB Length — Controls how long the opening window runs before the IB is considered complete. Available options: 30s · 1m · 2m · 3m · 5m · 10m · 15m · 30m · 1hr · 2hr · 4hr. The IB high and low accumulate bar by bar throughout this window, locking in the final levels only when the window closes.
Note: your chart timeframe must be shorter than or equal to the selected IB length for the levels to calculate correctly.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INITIAL BALANCE LEVELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
IB High (IBH) — The highest price reached during the IB window.
IB Low (IBL) — The lowest price reached during the IB window.
IB Mid (IBM) — The midpoint of the IB range: (IBH + IBL) / 2.
Fill Area — Shades the region between IBH and IBL to visually define the balance zone.
Extend Right — Extends all IB lines to the right edge of the chart until the next session begins.
Each level has independent color, width, and line style (Solid / Dashed / Dotted) controls.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXTENSION LEVELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Extension levels project above IBH and below IBL using multiples of the IB range. Each level can be toggled and colored independently.
+/− 50% — IBH/IBL ± (0.5 × IB Range)
+/− 100% — IBH/IBL ± (1.0 × IB Range)
+/− 150% — IBH/IBL ± (1.5 × IB Range)
+/− 200% — IBH/IBL ± (2.0 × IB Range)
+/− 300% — IBH/IBL ± (3.0 × IB Range)
All extensions share a global width and style setting. Extensions are off by default — enable Show Extensions to display them.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PREVIOUS DAYS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Completed sessions are automatically archived and displayed as prior-day reference levels. Each prior session is restyled with its own color, width, and line style so it stays visually distinct from the current session.
Days to Show — Controls how many prior sessions are kept on the chart (1–10). Sessions beyond this count are deleted automatically.
Fill Area — Optionally shades the prior session's IBH-to-IBL range. Off by default.
Show Extensions — Optionally carries prior session extension lines forward. Off by default.
When a new session begins, the current IB is immediately reclassified as a prior-day level — no manual management required.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LABELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Labels appear at the right edge of each line and display the level name alongside its current price, formatted to the instrument's minimum tick. Size options: Auto · Tiny · Small · Normal · Large · Huge.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Twelve alert conditions are built in, all gated so they only fire after the IB has fully formed:
- IBH Cross Up / IBL Cross Down
- IBH Touch / IBL Touch
- +50% Cross Up / −50% Cross Down
- +100% Cross Up / −100% Cross Down
- +200% Cross Up / −200% Cross Down
- +300% Cross Up / −300% Cross Down
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
USAGE NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- The IB locks in the moment the opening window closes — levels will not repaint after that point.
- Extensions default to off. Enable Show Extensions first, then toggle individual levels.
- Previous session extensions are also off by default and are controlled separately from the current session under Previous Days → Show Extensions.
- To use with non-US sessions, adjust both the Session Start time and the Timezone to match your exchange.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT IS THE INITIAL BALANCE?
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The Initial Balance is the price range established during the opening period of a session — traditionally the first hour of RTH trading. The high and low formed during this window define the day's foundational structure. When price stays inside the IB, the market is balancing. When price breaks out of it, the market is entering price discovery. Extension levels above and below the IB project how far that discovery might reach.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SESSION SETTINGS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session Start — Set the hour and minute at which the IB window begins. Defaults to 9:30, the RTH open.
Timezone — Aligns the session start to the correct local time. Options: America/New_York · America/Chicago · Europe/London · Asia/Tokyo · UTC.
IB Length — Controls how long the opening window runs before the IB is considered complete. Available options: 30s · 1m · 2m · 3m · 5m · 10m · 15m · 30m · 1hr · 2hr · 4hr. The IB high and low accumulate bar by bar throughout this window, locking in the final levels only when the window closes.
Note: your chart timeframe must be shorter than or equal to the selected IB length for the levels to calculate correctly.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
INITIAL BALANCE LEVELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
IB High (IBH) — The highest price reached during the IB window.
IB Low (IBL) — The lowest price reached during the IB window.
IB Mid (IBM) — The midpoint of the IB range: (IBH + IBL) / 2.
Fill Area — Shades the region between IBH and IBL to visually define the balance zone.
Extend Right — Extends all IB lines to the right edge of the chart until the next session begins.
Each level has independent color, width, and line style (Solid / Dashed / Dotted) controls.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXTENSION LEVELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Extension levels project above IBH and below IBL using multiples of the IB range. Each level can be toggled and colored independently.
+/− 50% — IBH/IBL ± (0.5 × IB Range)
+/− 100% — IBH/IBL ± (1.0 × IB Range)
+/− 150% — IBH/IBL ± (1.5 × IB Range)
+/− 200% — IBH/IBL ± (2.0 × IB Range)
+/− 300% — IBH/IBL ± (3.0 × IB Range)
All extensions share a global width and style setting. Extensions are off by default — enable Show Extensions to display them.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
PREVIOUS DAYS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Completed sessions are automatically archived and displayed as prior-day reference levels. Each prior session is restyled with its own color, width, and line style so it stays visually distinct from the current session.
Days to Show — Controls how many prior sessions are kept on the chart (1–10). Sessions beyond this count are deleted automatically.
Fill Area — Optionally shades the prior session's IBH-to-IBL range. Off by default.
Show Extensions — Optionally carries prior session extension lines forward. Off by default.
When a new session begins, the current IB is immediately reclassified as a prior-day level — no manual management required.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
LABELS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Labels appear at the right edge of each line and display the level name alongside its current price, formatted to the instrument's minimum tick. Size options: Auto · Tiny · Small · Normal · Large · Huge.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ALERTS
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Twelve alert conditions are built in, all gated so they only fire after the IB has fully formed:
- IBH Cross Up / IBL Cross Down
- IBH Touch / IBL Touch
- +50% Cross Up / −50% Cross Down
- +100% Cross Up / −100% Cross Down
- +200% Cross Up / −200% Cross Down
- +300% Cross Up / −300% Cross Down
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
USAGE NOTES
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
- The IB locks in the moment the opening window closes — levels will not repaint after that point.
- Extensions default to off. Enable Show Extensions first, then toggle individual levels.
- Previous session extensions are also off by default and are controlled separately from the current session under Previous Days → Show Extensions.
- To use with non-US sessions, adjust both the Session Start time and the Timezone to match your exchange.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.