OPEN-SOURCE SCRIPT
تم تحديثه Break & Re-Test Zones v5.2 Outcome Audit

Here's the full description of the indicator — what it is, what it draws, and how it thinks.
What it is
It's a TradingView indicator that automates the Break & Re-Test strategy on 15-minute Gold and NQ futures. It finds support/resistance zones by itself, watches for one to break, waits for price to come back and confirm the flip, and only then fires a buy or sell signal — with entry, stop, and targets pre-calculated. Two versions exist: the indicator (v5.1) for live trading and chart-reading, and a strategy sibling that runs the identical logic through TradingView's backtester.
What it draws — the five layers
1. Support & resistance zones. Built automatically from swing pivots, drawn as bands (not lines), and colour-coded by where price sits right now: green below price = support, red above = resistance, gray = price inside it ("IN TEST"). Each zone is also classified PRIMARY (solid thick border, likely to hold — earned by having 2 of: multiple touches, overlap with a higher-timeframe level, or a round number inside it) or SECONDARY (dashed, likely to break). White labels show the price and touch count. This is the map.
2. The armed state. When a candle body closes through a zone, that zone turns orange with a "RETEST? / ARMED" label — meaning a break happened and the indicator is now watching for the pullback. It's a watch notice, never an entry, and it lives only while the setup is genuinely armed.
3. The signal / trade package. When price returns and a confirmation candle closes back on the breakout side, the entry fires: a coloured arrow at the candle, a banner with direction and confluence grade ("LONG [B] @ …"), plus dotted rails to the entry, a hollow-circle stop, and blue-square TP1/TP2 targets. Stop goes beyond the zone; targets sit at 1.5R and 2R.
4. The outcome audit. Every fired trade tracks itself: stopped out, the whole package erases; reaches TP1, it's immortalised as a yellow-bordered rectangle spanning the winning run. Only the last couple of winners stay — a pattern library of what worked (winners-only by design, so it's study material, not a scoreboard).
5. Reference levels & tables. Stepped lines mark the previous day's and previous hour's high/low (the walls and fences other traders watch). A dashboard shows session, HTF bias, and zone counts; a pre-entry runsheet grades the nearest armed setup live against every rule (session, touches, gap, room, confluence, confirmation) and gives a GO / NO-TRADE verdict.
How it thinks — the engine
Under the hood it runs a per-zone state machine: each level independently moves live → broken → retested/failed/expired, so many setups can be tracked at once without interfering. Three principles govern everything: a break requires a body close through the zone (wick pokes are ignored); a retest needs a gap of at least one candle so the breakout candle can't be its own retest; and — critically — all decisions are made only at candle close, so signals, stops, and targets never drift intrabar or repaint.
Layered on top is a confluence grader (A/B/C) scoring each setup on higher-timeframe level overlap, breakout volume, and a quiet pullback — with an optional filter to trade only A or B+ setups. Session filters restrict signals to the high-volume London and New York windows (Asia is for marking levels, not trading them).
What it's for
Three jobs, in order of how you'd use them: it draws the map (which levels matter, which will hold vs break, for zone-to-zone planning), it triggers the trade (arms on break, fires on confirmed retest, with risk pre-set), and it keeps you honest (the audit shows real outcomes; the backtest sibling reports win rate and average R per grade so you tune on evidence, not vibes).
The one thing it deliberately doesn't do is pretend the strategy is a money printer — the audit only shows winners by design, and your first raw backtest came back at 25% win rate, which is exactly why the tuned strategy version and its per-grade stats exist: to find where the real edge lives before you risk anything.
What it is
It's a TradingView indicator that automates the Break & Re-Test strategy on 15-minute Gold and NQ futures. It finds support/resistance zones by itself, watches for one to break, waits for price to come back and confirm the flip, and only then fires a buy or sell signal — with entry, stop, and targets pre-calculated. Two versions exist: the indicator (v5.1) for live trading and chart-reading, and a strategy sibling that runs the identical logic through TradingView's backtester.
What it draws — the five layers
1. Support & resistance zones. Built automatically from swing pivots, drawn as bands (not lines), and colour-coded by where price sits right now: green below price = support, red above = resistance, gray = price inside it ("IN TEST"). Each zone is also classified PRIMARY (solid thick border, likely to hold — earned by having 2 of: multiple touches, overlap with a higher-timeframe level, or a round number inside it) or SECONDARY (dashed, likely to break). White labels show the price and touch count. This is the map.
2. The armed state. When a candle body closes through a zone, that zone turns orange with a "RETEST? / ARMED" label — meaning a break happened and the indicator is now watching for the pullback. It's a watch notice, never an entry, and it lives only while the setup is genuinely armed.
3. The signal / trade package. When price returns and a confirmation candle closes back on the breakout side, the entry fires: a coloured arrow at the candle, a banner with direction and confluence grade ("LONG [B] @ …"), plus dotted rails to the entry, a hollow-circle stop, and blue-square TP1/TP2 targets. Stop goes beyond the zone; targets sit at 1.5R and 2R.
4. The outcome audit. Every fired trade tracks itself: stopped out, the whole package erases; reaches TP1, it's immortalised as a yellow-bordered rectangle spanning the winning run. Only the last couple of winners stay — a pattern library of what worked (winners-only by design, so it's study material, not a scoreboard).
5. Reference levels & tables. Stepped lines mark the previous day's and previous hour's high/low (the walls and fences other traders watch). A dashboard shows session, HTF bias, and zone counts; a pre-entry runsheet grades the nearest armed setup live against every rule (session, touches, gap, room, confluence, confirmation) and gives a GO / NO-TRADE verdict.
How it thinks — the engine
Under the hood it runs a per-zone state machine: each level independently moves live → broken → retested/failed/expired, so many setups can be tracked at once without interfering. Three principles govern everything: a break requires a body close through the zone (wick pokes are ignored); a retest needs a gap of at least one candle so the breakout candle can't be its own retest; and — critically — all decisions are made only at candle close, so signals, stops, and targets never drift intrabar or repaint.
Layered on top is a confluence grader (A/B/C) scoring each setup on higher-timeframe level overlap, breakout volume, and a quiet pullback — with an optional filter to trade only A or B+ setups. Session filters restrict signals to the high-volume London and New York windows (Asia is for marking levels, not trading them).
What it's for
Three jobs, in order of how you'd use them: it draws the map (which levels matter, which will hold vs break, for zone-to-zone planning), it triggers the trade (arms on break, fires on confirmed retest, with risk pre-set), and it keeps you honest (the audit shows real outcomes; the backtest sibling reports win rate and average R per grade so you tune on evidence, not vibes).
The one thing it deliberately doesn't do is pretend the strategy is a money printer — the audit only shows winners by design, and your first raw backtest came back at 25% win rate, which is exactly why the tuned strategy version and its per-grade stats exist: to find where the real edge lives before you risk anything.
ملاحظات الأخبار
What it is. An automated Break & Re-Test system for 15-minute Gold/NQ. It finds support/resistance zones from swing pivots, watches for a zone to break on a body close, waits for price to return and confirm the flip with a confirmation candle, then fires an entry with stop and 1.5R/2R targets pre-drawn. Every decision happens only at candle close — nothing repaints.The zone colour code — the whole story in six colours:
GREEN below price = support, holding (solid thick border = PRIMARY, likely to hold; dashed thin = SECONDARY, likely to break)
RED above price = resistance, holding (same border rule)
ORANGE "RETEST? LONG/SHORT" = this level just broke; a setup is armed and the runsheet is grading it — the only colour that demands your attention
VIOLET "FLIP FAILED" = it broke, but price closed back through; the flip died, the level didn't — it revives shortly
GRAY "IN TEST" = price is inside the zone right now; the fight is undecided
YELLOW box = a completed trade that reached TP1, kept as proof/study material
The arrow grammar: outline △/▽ = a break just happened (armed, watching — never an entry, and it vanishes if the setup dies); solid ▲/▼ = enter, printed only when a confirmation candle closes back on the breakout side. Outline is the question, solid is the answer.
Everything else: stepped orange/purple lines are the previous day's (thick) and hour's (thin) high/low — the walls and fences feeding the A/B/C confluence grade shown in every entry banner. The dashboard's ZONE STATE strip now counts each state — live (holding), RETEST? long, RETEST? short, flip failed, total armed — so you can watch a level migrate through the lifecycle numerically as it happens on the chart. The runsheet grades the nearest genuinely armed setup (flip-failed zones are correctly excluded now) and gives the GO/NO-TRADE verdict.
Reading it in one sentence: scan the greens and reds for the map, act only when something turns orange, enter only on the solid arrow, and learn from the yellow.
ملاحظات الأخبار
The 7-point scale. HTF level overlap +2, breakout volume +1, quiet pullback +1, liquidity sweep +1, displacement +1, FVG +1. Grades: A ≥ 5, B = 3–4, C ≤ 2. Every grade now shows its contributors as letters — an entry banner or runsheet reading A [HVSD] means: HTF confluence, volume, sweep, and displacement all present (6 points), FVG and quiet-pullback absent. The runsheet row is relabelled "Grade (H V Q S D F)" so the legend travels with it. Note this recalibrates what letters mean: the old A (HTF + both volume checks) is now only a B — an A requires HTF confluence plus real ICT sequence quality. That's deliberate; A should be rare.What each ICT check detects, precisely:
S — Sweep: within the 12 bars before the break, a candle raided the prior 20-bar low (for longs) — wicked through it and closed back above. That's sell-side liquidity taken, the fuel ICT says powers the displacement. Both windows are inputs.
D — Displacement: the break candle's body ≥ 0.6×ATR. This is your MSS-quality filter — it separates a conviction break of structure from a drift that happens to close over a line. On MNQ right now 0.6×ATR is a meaningful candle; tune per instrument.
F — FVG: a Fair Value Gap printed anywhere from the break bar through the retest phase. When present, your retest into the zone is simultaneously a return into imbalance — the zone+FVG stack you already trade manually in your London-open scalps.
Each is individually toggleable, so you can isolate which one earns its point.
ملاحظات الأخبار
Liquidity sweep before the break (+1). The A+ ICT sequence: price raids a prior swing low (sell-side liquidity), snaps back, then displaces up through resistance. A break that was preceded by a sweep within the last ~12 bars has fuel behind it — the raid supplied the orders. Detection: a candle wicking below the prior 20-bar low but closing back above it (mirror for buy-side raids before shorts).Displacement break candle (+1). Not all breaks are equal: a break on a candle whose body is ≥ 0.6×ATR is displacement — conviction, an MSS-quality move. A limp drift through a level is exactly the kind of break that fakes out.
FVG in the breakout leg (+1). If the breakout leg leaves a Fair Value Gap (low > high two bars back, for longs), the retest into your zone is also a return into imbalance — the classic zone+FVG stack where entries are strongest. The indicator credits any FVG printed from the break bar through the retest phase.
New scale: HTF level 2 + volume 1 + quiet pullback 1 + sweep 1 + displacement 1 + FVG 1 = 7 points max; A ≥ 5, B = 3–4, C ≤ 2.
The 7-point scale. HTF level overlap +2, breakout volume +1, quiet pullback +1, liquidity sweep +1, displacement +1, FVG +1. Grades: A ≥ 5, B = 3–4, C ≤ 2. Every grade now shows its contributors as letters — an entry banner or runsheet reading A [HVSD] means: HTF confluence, volume, sweep, and displacement all present (6 points), FVG and quiet-pullback absent. The runsheet row is relabelled "Grade (H V Q S D F)" so the legend travels with it. Note this recalibrates what letters mean: the old A (HTF + both volume checks) is now only a B — an A requires HTF confluence plus real ICT sequence quality. That's deliberate; A should be rare.
What each ICT check detects, precisely:
S — Sweep: within the 12 bars before the break, a candle raided the prior 20-bar low (for longs) — wicked through it and closed back above. That's sell-side liquidity taken, the fuel ICT says powers the displacement. Both windows are inputs.
D — Displacement: the break candle's body ≥ 0.6×ATR. This is your MSS-quality filter — it separates a conviction break of structure from a drift that happens to close over a line. On MNQ right now 0.6×ATR is a meaningful candle; tune per instrument.
F — FVG: a Fair Value Gap printed anywhere from the break bar through the retest phase. When present, your retest into the zone is simultaneously a return into imbalance — the zone+FVG stack you already trade manually in your London-open scalps.
Each is individually toggleable, so you can isolate which one earns its point.
ملاحظات الأخبار
/ • CONFLUENCE SCORER — every signal graded A/B/C from three checks:// HTF level overlap (+2) · breakout volume ≥ x avg (+1) · quiet pullback (+1)
// A = 3+ pts, B = 2 pts, C = 0-1 pts. Optional filter: A-only / B+ / all
// • PRIMARY vs SECONDARY ZONES — zones scored on touches, HTF-level overlap
// and round-number confluence. PRIMARY (likely to hold) = solid border,
// SECONDARY (likely to break) = dashed border. White text labels.
// Supports shaded green, resistance shaded red — for zone-to-zone trades.
// • NEW MARKERS — green up-arrow under long signal candle, red down-arrow
// above short signal candle; TP = blue square + dotted line + price;
// SL = red hollow circle + red dotted line + price
// • Daily prev high/low added to HTF confluence set
ملاحظات الأخبار
// • CONFLUENCE SCORER — every signal graded A/B/C from three checks:// HTF level overlap (+2) · breakout volume ≥ x avg (+1) · quiet pullback (+1)
// A = 3+ pts, B = 2 pts, C = 0-1 pts. Optional filter: A-only / B+ / all
// • PRIMARY vs SECONDARY ZONES — zones scored on touches, HTF-level overlap
// and round-number confluence. PRIMARY (likely to hold) = solid border,
// SECONDARY (likely to break) = dashed border. White text labels.
// Supports shaded green, resistance shaded red — for zone-to-zone trades.
// • NEW MARKERS — green up-arrow under long signal candle, red down-arrow
// above short signal candle; TP = blue square + dotted line + price;
// SL = red hollow circle + red dotted line + price
// • Daily prev high/low added to HTF confluence set
ملاحظات الأخبار
// • CONFLUENCE SCORER — every signal graded A/B/C from three checks:// HTF level overlap (+2) · breakout volume ≥ x avg (+1) · quiet pullback (+1)
// A = 3+ pts, B = 2 pts, C = 0-1 pts. Optional filter: A-only / B+ / all
// • PRIMARY vs SECONDARY ZONES — zones scored on touches, HTF-level overlap
// and round-number confluence. PRIMARY (likely to hold) = solid border,
// SECONDARY (likely to break) = dashed border. White text labels.
// Supports shaded green, resistance shaded red — for zone-to-zone trades.
// • NEW MARKERS — green up-arrow under long signal candle, red down-arrow
// above short signal candle; TP = blue square + dotted line + price;
// SL = red hollow circle + red dotted line + price
// • Daily prev high/low added to HTF confluence set
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.