OPEN-SOURCE SCRIPT
IB Completed

IB Completed — Initial Balance Breakout & Retest Strategy
═══════════════════════════════════════════════════════════════
OVERVIEW
IB Completed is a fully automated intraday strategy that trades the Initial Balance (IB) breakout-and-retest pattern. Rather than entering on the initial breakout, it waits for a confirmed pullback to the IB level before entering — filtering out false breakouts and aligning entries with proven support/resistance.
Designed for futures (MES, ES, NQ, MNQ, GC, etc.) on 1-min through 15-min charts, but works on any liquid instrument with a defined opening session.
═══════════════════════════════════════════════════════════════
HOW IT WORKS
Build the IB — During a configurable window (default 9:30–10:30 ET), the high and low are recorded and locked in for the day.
Breakout — Price breaks above IB High (long) or below IB Low (short).
Retest — Price pulls back to the IB level while closing on the opposite side of the trigger SMA, confirming the pullback.
Reclaim & Entry — Price closes back beyond the IB level AND the trigger SMA, confirming the retest held. Entry fires at the bar close.
Only one trade per session is allowed.
Stop Placement: Placed at the most recent confirmed pivot (swing high/low) from the retest phase, offset by a configurable amount. Falls back to the retest extreme if no pivot exists.
Scaled Exits: Position is split across up to 5 R-multiple targets (default: 50% at 1R, 25% at 2R, 25% at 3R). Configurable as percentages or fixed contract quantities.
Break-Even Stop: After a configurable R-multiple is reached (default 2R), the stop moves to entry price.
EOD Flatten: All positions force-closed at a set time (default 3:55 PM ET).
═══════════════════════════════════════════════════════════════
INPUTS
Opening Range Window — Start/end hour and minute for the IB session, plus timezone selection (New York, Chicago, LA, London, Tokyo, Singapore, Sydney).
Pivot Settings — Left and right bar counts for pivot detection (stop-loss reference).
Trigger SMA — Length, source, visibility, and color for the SMA that governs retest/reclaim signals.
Higher Timeframe Filter — Optional trend filter using a higher-timeframe MA (SMA/EMA/WMA/VWMA). Longs require close > HTF MA, shorts require close < HTF MA. Configurable timeframe and length.
Risk / Stop Loss — Stop offset mode (Points or Percentage), offset amount, and optional setup invalidation if price breaches the opposite IB level.
Position Sizing — Fixed contracts or Risk-Based sizing (set a dollar risk amount and tick value; contracts are calculated so stop distance equals that risk).
Exit Scaling (R-Multiples) — Configure exit percentages or contract quantities at 1R through 5R.
Break-Even Stop — Enable/disable, and set the R-multiple trigger.
Session & Risk — Trade cutoff time, go-flat time, and toggles to enable/disable longs and shorts independently.
IB Size Filter — Optionally block trades when the IB range exceeds a max tick threshold.
Day-of-Week Filter — Checkboxes to skip any day of the week (e.g., skip Thursdays).
Location / Trend Filters — 17 optional filters, all OFF by default. Each can be shown on chart and/or used as an entry gate (longs require close above, shorts require close below). Includes: Previous Week H/L, Previous Day H/L, Magic Lines (pre-market H/L), Overnight Low, Daily 9 SMA, 4H 9 SMA, and 100/200 SMA on Weekly, Daily, 4H, and 1H timeframes.
Display — IB line colors, styles, box settings, trade level line length, IB 25/50/75% interior lines, and fully customizable entry/stop/target colors for both long and short sides.
Info Panel — Floating panel showing IB stats (high, low, range, ticks, bias, close zone), setup status, position, BE stop, HTF MA, and filter status. Configurable text size.
═══════════════════════════════════════════════════════════════
ALERTS
JSON-formatted alert messages fire on every entry and exit, ready for webhook automation. Fields include side, ticker, quantity, entry, stop, and R-level. Three alertconditions are also available: IB Complete, Long Entry, and Short Entry.
═══════════════════════════════════════════════════════════════
OVERVIEW
IB Completed is a fully automated intraday strategy that trades the Initial Balance (IB) breakout-and-retest pattern. Rather than entering on the initial breakout, it waits for a confirmed pullback to the IB level before entering — filtering out false breakouts and aligning entries with proven support/resistance.
Designed for futures (MES, ES, NQ, MNQ, GC, etc.) on 1-min through 15-min charts, but works on any liquid instrument with a defined opening session.
═══════════════════════════════════════════════════════════════
HOW IT WORKS
Build the IB — During a configurable window (default 9:30–10:30 ET), the high and low are recorded and locked in for the day.
Breakout — Price breaks above IB High (long) or below IB Low (short).
Retest — Price pulls back to the IB level while closing on the opposite side of the trigger SMA, confirming the pullback.
Reclaim & Entry — Price closes back beyond the IB level AND the trigger SMA, confirming the retest held. Entry fires at the bar close.
Only one trade per session is allowed.
Stop Placement: Placed at the most recent confirmed pivot (swing high/low) from the retest phase, offset by a configurable amount. Falls back to the retest extreme if no pivot exists.
Scaled Exits: Position is split across up to 5 R-multiple targets (default: 50% at 1R, 25% at 2R, 25% at 3R). Configurable as percentages or fixed contract quantities.
Break-Even Stop: After a configurable R-multiple is reached (default 2R), the stop moves to entry price.
EOD Flatten: All positions force-closed at a set time (default 3:55 PM ET).
═══════════════════════════════════════════════════════════════
INPUTS
Opening Range Window — Start/end hour and minute for the IB session, plus timezone selection (New York, Chicago, LA, London, Tokyo, Singapore, Sydney).
Pivot Settings — Left and right bar counts for pivot detection (stop-loss reference).
Trigger SMA — Length, source, visibility, and color for the SMA that governs retest/reclaim signals.
Higher Timeframe Filter — Optional trend filter using a higher-timeframe MA (SMA/EMA/WMA/VWMA). Longs require close > HTF MA, shorts require close < HTF MA. Configurable timeframe and length.
Risk / Stop Loss — Stop offset mode (Points or Percentage), offset amount, and optional setup invalidation if price breaches the opposite IB level.
Position Sizing — Fixed contracts or Risk-Based sizing (set a dollar risk amount and tick value; contracts are calculated so stop distance equals that risk).
Exit Scaling (R-Multiples) — Configure exit percentages or contract quantities at 1R through 5R.
Break-Even Stop — Enable/disable, and set the R-multiple trigger.
Session & Risk — Trade cutoff time, go-flat time, and toggles to enable/disable longs and shorts independently.
IB Size Filter — Optionally block trades when the IB range exceeds a max tick threshold.
Day-of-Week Filter — Checkboxes to skip any day of the week (e.g., skip Thursdays).
Location / Trend Filters — 17 optional filters, all OFF by default. Each can be shown on chart and/or used as an entry gate (longs require close above, shorts require close below). Includes: Previous Week H/L, Previous Day H/L, Magic Lines (pre-market H/L), Overnight Low, Daily 9 SMA, 4H 9 SMA, and 100/200 SMA on Weekly, Daily, 4H, and 1H timeframes.
Display — IB line colors, styles, box settings, trade level line length, IB 25/50/75% interior lines, and fully customizable entry/stop/target colors for both long and short sides.
Info Panel — Floating panel showing IB stats (high, low, range, ticks, bias, close zone), setup status, position, BE stop, HTF MA, and filter status. Configurable text size.
═══════════════════════════════════════════════════════════════
ALERTS
JSON-formatted alert messages fire on every entry and exit, ready for webhook automation. Fields include side, ticker, quantity, entry, stop, and R-level. Three alertconditions are also available: IB Complete, Long Entry, and Short Entry.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。