PROTECTED SOURCE SCRIPT
تم تحديثه

GOLD – OB Clean + Internal/External Market Structure [Dragos]

99
GOLD – OB Clean + Internal/External Market Structure [Dragos]

All-in-one tool for XAUUSD that combines:

Clean Order Blocks (Supply/Demand) derived from the last opposite candle after a BOS (break of structure)

Internal & External Market Structure (CHoCH/BOS) with lines and labels

Visual zone management: right extension, mitigation (first touch), invalidation (close beyond), and 50% midline

How it works

Structure & BOS

Finds pivots (HH/LL) via Pivot len.

Triggers BOS when price crosses the last confirmed swing.

Order Blocks

On BOS, scans the last N bars for the opposite candle (bear for BOS up / bull for BOS down) and draws the OB:

Green = Demand, Red = Supply

Optional: use wicks (high/low) or just the body (open/close).

Mitigation: on first touch the zone fades or hides (per settings).

Invalidation: if price closes beyond the zone, it turns gray or gets removed (per settings).

Midline: 50% line for refined management (partial entries, R/R, etc.).

Internal / External Structure

Two structure layers: Internal (micro, shorter swing) and External (macro, longer swing).

Displays CHoCH/BOS with labels; External lines can be dashed for clarity.

Choose to show Internal, External, or Both.

Key Settings

Structure

Pivot len (swing HH/LL) — pivot sensitivity.

Order Blocks

Lookback N bars for the opposite candle

Use wicks — if on, zone uses high/low; otherwise just the body.

Zone Management

Extend zones to the right

Hide zone after mitigation (touch)

Fade zone after mitigation

Remove zone when invalidated

Show 50% line

Max zones stored

Colors: fill/border for Demand/Supply, 50% line color, Mitigated/Invalidated colors.

General

Only on XAU/GOLD (optional) — restricts execution to symbols containing “XAU”/“GOLD”.

Market Structure (tab)

Internal Swing Length / External Swing Length

Show Internal/External Market Structure (Both / Internal / External)

Colors for bullish/bearish MS

Usage Guide

Recommended timeframes: M5/M15 for entries, H1 for context.

Workflow:

Determine External (macro) direction.

Look for BOS and OB in the same direction on Internal.

Wait for mitigation (touch) inside the OB; the 50% line can be used for conservative entries.

Good confluences: sessions (killzones), volume spikes, extreme RSI, MAs (add as separate indicators if needed).

Visual Conventions

Demand: green; Supply: red.

Mitigated: faded yellow (or hidden if chosen).

Invalidated: gray (or removed).

50% line: gray.

Notes & Limits

Pine v6. Object caps follow TradingView limits (max_* = 500). On long histories, increase “Max zones stored” carefully.

BOS is computed when price crosses the last confirmed swing; some traders prefer “close-only” confirmation (can be customized if desired).

This tool does not auto-generate BUY/SELL signals; it’s a context & zones assistant.

Risk disclaimer: Trading involves risk. This tool is for educational analysis and does not guarantee profit. Use strict risk management (fixed SL, R:R ≥ 1:2, risk < 1% per trade).
ملاحظات الأخبار
GOLD – OB Clean + Internal/External Market Structure + FIB on EX-CHoCH

A precision tool for XAUUSD that blends clean Order Block mapping with Internal/External Market Structure and an auto-Fibonacci module that appears only on external CHoCH (true structure shifts). It’s designed to keep the chart readable, highlight the right zones, and give you a repeatable playbook for entries, targets, and invalidation.

What it does

Finds swing structure using configurable pivots, tracks the most recent external and internal highs/lows, and marks BoS or CHoCH events.

Builds clean OB zones from the last opposite candle in the impulse that broke structure (body or wick logic), auto-extends them, and manages mitigation/invalidation visually.

Drops a FIB stack only on external CHoCH, anchored to the broken swing and its leg extreme—so you get retracement levels where they matter, not on every wiggle.

Why it’s useful

Cuts noise by separating internal vs external structure.

OBs are created only after actual breaks, not just whenever you see a big candle.

FIB appears only on regime change (CHoCH external), giving you ready-made pullback zones (e.g., 0.618/0.707/0.79/0.85) for limit entries or risk-defined continuation.

Core logic (under the hood)

Swings: ta.pivothigh/low with your pivotLen. External and internal swings use different lookback lengths.

Break detection: Robust crossover guards avoid NA issues; BoS/CHoCH labels and lines are drawn with explicit bar-time anchors.

Order Blocks: On BoS/CHoCH, the script searches back lookbackOB bars for the last opposite candle and boxes its body (or wick range, if enabled).

Mitigated: first touch can fade or hide the zone.

Invalidated: close beyond the far edge can gray out or remove the zone (optional).

50% midline and max zone count keep visuals clean and fast.

FIB on EX-CHoCH only:

Bullish CHoCH: 0 at the broken high, 1 at the leg low.

Bearish CHoCH: 0 at the broken low, 1 at the leg high.

Levels, labels, and price readouts are configurable; lines can auto-extend right.

Inputs at a glance

Structure/OB: pivotLen, lookbackOB, useWicks.

Zone management: extendRight, hideMitigated, fadeMitigated, removeInvalid, showMidLine, maxZones.

FIB: toggle on/off, custom CSV levels (0,0.618,0.707,0.79,0.85,1 by default), show labels/prices, extend right, bull/bear colors.

Market Structure: internal/external lengths, choose to show Both / Internal / External.

Gold filter: optional strict filter to run only on XAU/GOLD tickers.

How to trade it (suggested playbook)

Define regime: Use External MS. A fresh CHoCH external flips bias; FIB prints automatically.

Mark confluence: Look for unmitigated OB aligning with FIB 0.618–0.85 and the 50% OB midline.

Entry ideas:

Limit at 0.707–0.79 inside the OB, or

Trigger on lower-TF internal MS shift into the OB.

Stop: Just beyond the OB’s far edge (or a tick beyond the wick if useWicks=true).

Targets:

T1: opposite side of the FIB stack or the midline of the next OB.

T2: the external swing (new HH/LL).

Management: If zone gets mitigated without follow-through or becomes invalidated, step aside—your context changed.

Best practices

Timeframes: H1/H4 for external context; M15/M5 for entries.

Add your usual confluence: RSI divergences, ATR over-extension, volume shifts at the OB, session timing.

Keep maxZones sane (e.g., 40–80) for performance and clarity.

Limitations & notes

It’s a price-structure tool—no magic signals. In ranges, expect more internal flips; rely on external bias.

FIB prints only on external CHoCH by design; if you need FIB on BoS as well, ask and we’ll add a toggle.

Broker symbols for gold vary; use the built-in strict GOLD filter only if your ticker contains XAU/GOLD.

Risk

Trading involves risk. Use proper position sizing, place stops, and don’t treat any OB/FIB level as guaranteed support/resistance. This tool highlights where probability can tilt—you decide if it’s worth the risk.

Want me to add a BoS-only FIB toggle, alerts, or a compact heads-up panel with current bias + nearest OB & FIB cluster?
ملاحظات الأخبار
GOLD — OB Clean + Market Structure + FVG + FIB (EX-CHoCH)

A surgical, XAUUSD-first toolkit that fuses Clean Order Blocks, Internal/External Market Structure, Fair Value Gaps, and an auto-FIB engine that triggers only on external CHoCH. Built to remove noise, spotlight asymmetric spots, and give you a repeatable, risk-defined playbook.

What it gives you

True structure map: Separate External trend (regime) from Internal rotation; auto-mark BoS vs CHoCH with time-anchored lines.

Institutional zones, cleaned: OBs from the last opposite candle that powered the break (body/wick mode), with 50% midline, mitigation fade/hide, and invalidation logic.

FVGs that matter: Three-bar gaps (body or wick) with right-extension, midline, mitigation and full-fill invalidation.

FIB on regime change only: Prints on EX-CHoCH (not every wiggle). Bull: 0 at broken high, 1 at leg low. Bear: 0 at broken low, 1 at leg high. Levels are CSV-configurable (e.g., 0/0.618/0.707/0.79/0.85/1), with optional labels and prices.

In-zone context labels: Lightweight center text inside OB/FVG (D/S, B/S), auto-repositioned as zones extend.

How it works (under the hood)

Swings: Parametric pivots define internal vs external highs/lows.

Break logic: Robust crossover guards prevent NA and repaint pitfalls; CHoCH/BoS drawn with bar-time anchors.

OB engine: On a break, search back N bars for the last opposite candle; box its body (or entire wick span). First touch → mitigated (fade/hide). Close through far edge → invalidated (gray/remove).

FVG engine: Detects classical 3-candle imbalance; extends, tracks mitigation, and removes on full fill.

FIB engine: Clears old stack and prints a fresh ladder only when external direction flips (CHoCH), aligning retracement entries with the new regime.

Trade playbook (suggested)

Bias: Use External MS. A fresh CHoCH external flips regime and prints the FIB.

Confluence: Hunt unmitigated OB + FVG overlap inside 0.618–0.85 FIB with the OB 50% nearby.

Entry:

Limit at 0.707–0.79 inside zone, or

Trigger on Internal MS shift on lower TF into that zone.

Invalidation: Stop just beyond OB far edge (or wick in wick-mode).

Targets: T1 = other side of FIB/zone; T2 = opposing external swing; trail after mitigation failure.

Controls you’ll actually use

Structure: pivotLen, internal/external lengths, show Internal/External/Both.

OB: lookbackOB, body/wick, extend right, fade/hide on mitigation, remove on invalidation, 50% midline, max zone count.

FVG: body/wick, extend, midline, mitigation handling, auto-remove on fill, max keep.

FIB: on/off, extend right, labels/prices, custom CSV levels, bull/bear colors.

Gold filter: optional strict XAU/GOLD symbol check.

Why it’s different

Prints FIB only on regime flips (EX-CHoCH) → fewer, higher-signal pullback zones.

Cleans the chart (internal vs external separation, capped objects, lightweight labels).

Encodes mitigation/invalidation so zones don’t linger past their usefulness.

Notes & risk

Designed for XAUUSD; works elsewhere if Gold-filter is off.

Best used H1/H4 for bias; M15/M5 for entries.

No tool removes risk. Size positions, use hard stops, and avoid forcing trades in chop.

Want extras like alerts, bias panel (current external, nearest OB/FVG, active FIB levels), or FIB on BoS toggle? I can add them.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.