OPEN-SOURCE SCRIPT
Smooths IB Map

Smooths IB Map — Initial Balance Probability Engine
Overview
Smooths IB Map is an Initial Balance indicator built around a statistical probability engine rather than simple level plotting. The Initial Balance (IB) is the price range established during the first hour of the regular trading session (9:30–10:30 ET by default). This range has long been used by institutional and retail traders as a reference for the day's expected price behavior — price frequently sweeps one or both IB extremes before reversing or continuing. This indicator quantifies that tendency and makes it actionable.
What makes this different
1 — Timeframe-independent data collection. Most IB indicators compute statistics directly from chart bars. This means the sample size — and therefore the probabilities — change depending on which timeframe the chart is set to. A 1-minute chart may only hold 16 days of history while a 15-minute chart holds 240, producing completely different numbers from the same lookback setting. This indicator solves that problem by anchoring all data collection inside request.security("5") — a fixed 5-minute reference feed. Probabilities are identical on any chart timeframe.
2 — Exponential decay weighted probability. A raw historical average gives equal weight to a sweep that happened 200 days ago and one that happened last week. This indicator applies exponential decay (factor 0.85 per day of age) so that recent sessions contribute proportionally more to the probability estimate. When market regime shifts, the indicator adapts faster than a simple percentage would.
3 — Range-conditional probability. Every historical IB day is classified as SMALL (<70% of the historical average range), NORMAL (70–130%), or LARGE (>130%). The indicator then computes the IBH and IBL sweep rate specifically for days that match today's size bucket. If today's IB is unusually tight, the conditional column in the table shows the sweep rate from similar tight-range days only — a more relevant reference than the overall average.
4 — First-break direction tracking. The table shows what percentage of historical days saw the IBH break first vs the IBL break first vs both sweeping on the same bar. Over a large enough sample this can reveal directional tendencies for specific instruments and sessions.
5 — Failed retest signal. After a level is swept, price often pulls back to retest it from the other side. If the retesting candle closes back on the swept side (confirming rejection), the level has flipped from resistance to support or vice versa. The indicator detects this condition and plots a colored circle directly on the wick of the confirming bar — one signal per level per day, first confirmed retest only.
How to use it
Add the indicator to any intraday chart (1m through 60m). Set your IB Open and IB Close times to match your instrument's session. Set the Data Cutoff to the time after which you do not want sweeps counted — for US equities, 16:00 ET is appropriate. Increase the Lookback Days to the maximum your plan supports (the tooltip explains approximate limits by plan). The probability labels display inside the IB box as a percentage — green indicates a historically high sweep rate (≥65%), red indicates low (≤35%), and white is neutral. The third column of the data table shows the conditional probability for today's IB size bucket. A teal circle on a bar's low signals a bullish failed retest of the IBH. A red circle on a bar's high signals a bearish failed retest of the IBL. All four alert conditions (IB formed, IBH swept, IBL swept, failed retest) are available for notification.
Notes
Designed and built for MNQ/NQ futures but compatible with any intraday instrument. A minimum of 5 completed historical sessions is required before probability values are shown. Statistics are always computed from completed days only — the current in-progress session is excluded. The failed retest signal requires the sweep to have been established on at least one prior bar before it can trigger, preventing false fires on the original sweep candle itself.
Overview
Smooths IB Map is an Initial Balance indicator built around a statistical probability engine rather than simple level plotting. The Initial Balance (IB) is the price range established during the first hour of the regular trading session (9:30–10:30 ET by default). This range has long been used by institutional and retail traders as a reference for the day's expected price behavior — price frequently sweeps one or both IB extremes before reversing or continuing. This indicator quantifies that tendency and makes it actionable.
What makes this different
1 — Timeframe-independent data collection. Most IB indicators compute statistics directly from chart bars. This means the sample size — and therefore the probabilities — change depending on which timeframe the chart is set to. A 1-minute chart may only hold 16 days of history while a 15-minute chart holds 240, producing completely different numbers from the same lookback setting. This indicator solves that problem by anchoring all data collection inside request.security("5") — a fixed 5-minute reference feed. Probabilities are identical on any chart timeframe.
2 — Exponential decay weighted probability. A raw historical average gives equal weight to a sweep that happened 200 days ago and one that happened last week. This indicator applies exponential decay (factor 0.85 per day of age) so that recent sessions contribute proportionally more to the probability estimate. When market regime shifts, the indicator adapts faster than a simple percentage would.
3 — Range-conditional probability. Every historical IB day is classified as SMALL (<70% of the historical average range), NORMAL (70–130%), or LARGE (>130%). The indicator then computes the IBH and IBL sweep rate specifically for days that match today's size bucket. If today's IB is unusually tight, the conditional column in the table shows the sweep rate from similar tight-range days only — a more relevant reference than the overall average.
4 — First-break direction tracking. The table shows what percentage of historical days saw the IBH break first vs the IBL break first vs both sweeping on the same bar. Over a large enough sample this can reveal directional tendencies for specific instruments and sessions.
5 — Failed retest signal. After a level is swept, price often pulls back to retest it from the other side. If the retesting candle closes back on the swept side (confirming rejection), the level has flipped from resistance to support or vice versa. The indicator detects this condition and plots a colored circle directly on the wick of the confirming bar — one signal per level per day, first confirmed retest only.
How to use it
Add the indicator to any intraday chart (1m through 60m). Set your IB Open and IB Close times to match your instrument's session. Set the Data Cutoff to the time after which you do not want sweeps counted — for US equities, 16:00 ET is appropriate. Increase the Lookback Days to the maximum your plan supports (the tooltip explains approximate limits by plan). The probability labels display inside the IB box as a percentage — green indicates a historically high sweep rate (≥65%), red indicates low (≤35%), and white is neutral. The third column of the data table shows the conditional probability for today's IB size bucket. A teal circle on a bar's low signals a bullish failed retest of the IBH. A red circle on a bar's high signals a bearish failed retest of the IBL. All four alert conditions (IB formed, IBH swept, IBL swept, failed retest) are available for notification.
Notes
Designed and built for MNQ/NQ futures but compatible with any intraday instrument. A minimum of 5 completed historical sessions is required before probability values are shown. Statistics are always computed from completed days only — the current in-progress session is excluded. The failed retest signal requires the sweep to have been established on at least one prior bar before it can trigger, preventing false fires on the original sweep candle itself.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.