INVITE-ONLY SCRIPT
Güncellendi

ICT Trading by Jaehee

195
SUMMARY

• This script consolidates widely used ICT concepts into a single, coherent toolkit that emphasizes structural clarity over chart clutter.
• It renders Market Structure (BOS/CHoCH), significant Order Blocks (OB), Fair Value Gaps (FVG) with size filtering, BSL/SSL liquidity lines with optional sweep pruning, and Killzone session start markers.
• For analysis/education only. It does not provide investment advice or imply performance/returns.

WHAT MAKES IT DIFFERENT
• Integrated coverage of core ICT elements in one script (Structure, OB, FVG, BSL/SSL, Killzone).
• Quality gating so only “meaningful” zones/gaps remain (ATR/percent/tick thresholds, leg displacement, optional volume filter).
• Liquidity line maintenance: BSL/SSL can be automatically pruned after a defined sweep so attention stays on current liquidity.
• Visual minimalism: compact labels inside boxes; no background shading by default, keeping the chart readable.
• One-click contrast: a “Force Black” toggle switches all labels/lines to black for maximum legibility.
• Component-level ON/OFF controls (FVG / OB / BSL-SSL / Killzone) to tailor visibility to your workflow.
• OB de-duplication policy prevents overlapping clutter (keep-older-and-extend-right / keep-older / replace-with-new).

COMPONENTS & LOGIC (CONCISE)
• Market Structure (BOS/CHoCH)
◦ External swings via fractal pivots.
◦ BOS confirmation = close beyond the recent swing by k·ATR + a minimum real-body (first bar).
◦ Regime-aware labeling distinguishes BOS vs CHoCH.
• Order Blocks (strict ICT with significance)
◦ Demand OB: last down candle before a qualifying upside break; Supply OB: last up candle before a qualifying downside break.
◦ Filters enforce candle body, zone thickness, leg displacement (ATR-based), optional volume.
◦ Mitigation handling: Keep / Delete / Shrink (partial fills shrink the zone until invalidation).
• Fair Value Gaps (FVG)
◦ Standard 3-candle definition.
◦ Valid only when gap height ≥ max(percent threshold, ATR-based threshold, tick threshold) → trivial gaps intentionally removed.
◦ Minimal “FVG” text is centered inside the box.
• BSL / SSL & Sweep Management
◦ Equal highs/lows detected using dual tolerances (ticks + ATR) and a bar-spacing cap.
◦ Optional auto-removal after a sweep (Wick / Close / AnyTouch) so only actionable liquidity remains.
• Killzone Session Starts
◦ Compact vertical tick + label at the first bar of Asia / Europe / New York (no background fill).

INPUTS (MINIMIZED BY DESIGN)
• Visibility toggles: Show FVG / Show Order Blocks / Show BSL-SSL / Show Killzone session starts.
• Contrast toggle: Make all texts & lines BLACK (ON/OFF).
• Most numeric thresholds are internally fixed to discourage over-optimization and preserve consistent behavior.

HOW TO USE — PRACTICAL WORKFLOW
• Frame selection
◦ HTF (bias frame): choose 1H/4H/1D to read structure and map major OB/FVG.
◦ LTF (execution frame): 1–15 minute range; prefer trades aligned with the HTF bias.
• Long scenario (checklist)
◦ Bias: HTF shows a recent upside BOS or down→up CHoCH; price approaches a credible demand OB/FVG.
◦ Liquidity: recent SSL sweep (downside liquidity taken). Swept SSLs may auto-remove if that option is enabled.
◦ Triggers (one or more):
·· Fading back into a demand OB with support (close holds above the OB top).
·· Reclaim of a bullish FVG (close back above lower/mid line).
·· LTF structural shift (mini CHoCH → BOS).
◦ Invalidation/Risk: stop below OB bottom or sweep low, with an ATR buffer.
◦ Management: scale out near local LTF highs or nearest BSL; secondary targets at opposing FVG/supply OB; trail under LTF swing lows or FVG lower boundary.
• Short scenario (checklist)
◦ Bias: HTF shows a downside BOS or up→down CHoCH.
◦ Liquidity: recent BSL sweep (upside liquidity taken).
◦ Triggers (one or more):
·· Rejection from a supply OB after re-entry.
·· Failure/reject at a bearish FVG (upper/mid line).
·· LTF structural shift (mini CHoCH → downside BOS).
◦ Invalidation/Risk: stop above OB top or sweep high, with an ATR buffer.
◦ Management: scale out near local LTF lows or nearest SSL; secondary targets at opposing FVG/demand OB; trail above LTF swing highs or FVG upper boundary.

BSL/SSL TIPS
• Generation uses recent fractal highs/lows with tick/ATR tolerance and a spacing cap to avoid spurious “equal” prints.
• If auto-removal is enabled, swept lines vanish, keeping the view focused on what matters now.
• Confluence after a sweep (e.g., reversal close + OB/FVG nearby) can increase conviction.

ORDER BLOCK TIPS
• Significance filters (body/thickness/leg displacement/optional volume) suppress weak OBs by design.
• De-duplication keeps one meaningful zone when two boxes fully overlap (or extends the older zone to the right, depending on policy).
• Mitigation modes:
◦ Keep — retain the zone for reference even after touch.
◦ Delete — remove on mitigation to keep only fresh levels.
◦ Shrink — reduce boundary toward the fill to reflect partial consumption.

FVG TIPS
• Three-way minimum size (percent / ATR / ticks) must be met; this intentionally removes micro-gaps (e.g., ~0.12%).
• Bullish FVG: reclaim of the lower/mid line with a close may serve as a long trigger in a bullish context.
• Bearish FVG: rejection at the upper/mid line may serve as a short trigger in a bearish context.
• On mitigation (close through), boxes are removed to keep the chart clean.

KILLZONE (SESSION START MARKERS)
• Asia / Europe / New York: a short vertical tick and label at the session’s first bar—no background shading.
• Focus on signals forming soon after the session opens; overlap (e.g., Europe→New York) can increase volatility.

RISK & REAL-TIME CONSIDERATIONS
• Fractal swings confirm after L/R bars, so structure labeling is delayed by definition (and then fixed).
• BOS/CHoCH is validated only on the confirming close (k·ATR beyond the swing with a minimum real-body).
• OB/FVG/BSL-SSL state can change quickly on mitigation/sweep; account for slippage and define re-entry rules ahead of time.
• Always apply independent risk management (position sizing, stops). This is a study/analysis tool only.

READABILITY TIPS
• Use the Force-Black toggle when you want maximum contrast against candles.
• Keep only what you need (e.g., FVG+OB) to avoid visual overload.
• Always re-anchor LTF decisions to HTF zones and structure.

LIMITATIONS & NOTES
• No forward-looking guarantees; filters reduce noise but cannot eliminate false signals.
• Visualizations and thresholds are for study/analysis; not financial advice.
• Invite-Only distribution; access is managed via TradingView’s invitation system. No external links or promotions are included.
Sürüm Notları
Update Notes

What’s New
• Auto-cleanup of mitigated FVGs (visibility upgrade): When price returns to the FVG’s CE or fully fills the gap, the box is removed. A subtle “Mitig.” text remains at the originating candle for auditability.
• High-Timeframe Order Blocks (HTF OB) — optional: New toggle to project 4H and 1D OBs onto the active chart. Boxes are labeled “OB (4H)” or “OB (1D)” for instant separation of HTF structure from intraday noise. Default = OFF to keep charts light.
• ICT-standard alignment for EQH/EQL, BSL/SSL, and Liquidity Sweep: EQ lines are wick-based with tight tolerance; BSL/SSL are drawn as slim boxes around those EQ lines; a valid sweep requires a wick breach of the EQ line and a body return within a short window (optional displacement filter).

Why This Helps
• Cleaner decision surface: Old/mitigated FVGs are removed, so focus stays on active imbalances and current trade opportunities.
• Stronger top-down confluence: HTF OBs (4H/1D) often anchor major reversals; projecting them improves context for lower-timeframe execution and risk framing.
• More faithful liquidity map: ICT-consistent EQ/BSL/SSL logic clarifies where stops likely sit and when they’re truly swept—improving timing for entries, partials, and invalidations.

How To Use (Quick Guide)
• Keep HTF OBs OFF for lightweight scalping; toggle ON when planning swing scenarios or when price approaches HTF structure.
• Use the FVG auto-cleanup to keep charts uncluttered; the “Mitig.” marker preserves the footprint without re-drawing legacy boxes.
• Read EQ lines + BSL/SSL boxes as your primary liquidity map: wick breach + body return marks a valid sweep; combine with your OB/FVG/Killzone rules for confirmation.

Notes
• Colors and labels are chosen for readability on light/dark themes; customize in the Style tab as needed.
• Displacement requirement for sweeps is optional; disable to use pure wick-breach + body-return logic.
• Additions are performance-aware and default to minimal display until explicitly enabled.
Sürüm Notları
Summary of Changes

• Directional FVG Coloring
  – Previously, all Fair Value Gaps (FVGs) used a single fill color.
  – Now, bullish and bearish FVGs are clearly distinguished with separate palette tones:
    • Bullish FVG: soft green
    • Bearish FVG: soft red
  – Improves chart readability and directional context.
  – Label color and resolution handling remain unchanged (e.g., “Filled” label policy).

• Killzone Label Simplification
  – Previously, session markers displayed country code + city (e.g., “JP Tokyo”).
  – Now, labels show city only (e.g., “Tokyo”, “London”, “New York”).
  – All session timing, styles, and positioning logic remain unchanged.

• Pine Script v6 Upgrade & Stabilization
  – Upgraded script header from //version=5 to //version=6.
  – Stabilized strict typing under v6:
    • Removed creation of fvg records with na arguments; records are created only when a new FVG is detected.
    • Replaced nz()/na() usage on boolean series with ta.change()-based rising-edge detection.
    • Timeframe-boundary checks cast explicitly to bool (e.g., int delta = ta.change(time("240")); bool isNew4H = delta != 0).
    • Consolidated mixed input/series conditions to valid series bool expressions (no nested if pitfalls).
  – Result: no compile-time type errors in v6 and consistent runtime behavior.

Compatibility and Impact

• No input parameters were added or removed — existing layouts remain fully compatible.
• No algorithmic or detection logic was modified (OB, FVG, BSL/SSL, liquidity sweeps, HTF OB remain intact).
• Visual improvements only for FVG and Killzone labels; no effect on performance or signal generation.
• v6 migration is transparent to end users.

Migration Notes

• No action required from users.
• If desired, FVG palette values (fvgColBull / fvgColBear) can be customized directly in code to match different chart themes.
• The v6 changes are internal/technical (type-safety and event detection), so existing alerts and configurations continue to work as before.
Sürüm Notları
Update: v6 Migration & HTF OB Reliability
What’s New

Pine Script v6 Migration

Entire codebase updated from v5 → v6 with strict typing and series rules observed.

Replaced deprecated/ambiguous constructs (e.g., nz()/na() on booleans, mixed-type assignments) with v6-safe logic.

HTF Order Blocks (4H & 1D) — Reliability Fix

HTF OBs are now drawn once at the start of each new HTF bar using the last closed HTF bar’s signal.

Internals:

request.security() returns a per-bar trigger set (no rising-edge math inside the HTF function).

On ta.change(time("240")) != 0 / ta.change(time("D")) != 0, the script checks the closed HTF bar’s flags and plots/merges the OB box.

Result: Stable, duplication-free boxes that match v5 behavior, aligned with bar closes.

Directional FVG Coloring

Bullish and bearish FVGs use separate fills:

Bullish: #BFE8D4 (30% opacity)

Bearish: #F7C8C8 (30% opacity)

Improves visual context without altering detection logic.

Killzone Label Simplification

Session start markers now show city only (e.g., Tokyo, London, New York), removing country code for clarity.

Code Quality & Stability

Strict v6 typing across all modules (HTF, FVG, OB, BSL/SSL, sweeps).

Eliminated boolean edge-cases (no nz()/na() on bools; explicit boundary checks).

Consolidated timeframe boundary logic into clear, boolean conditions (!= 0).

Compatibility & Behavior

Inputs unchanged — users don’t need to reconfigure settings.

Visual changes only for FVG palette and Killzone labels; no change to detection logic or output signals.

No repaint beyond HTF close for HTF OBs (signals evaluated on the last closed higher-timeframe bar).

Performance

No material performance impact. Array/box/label housekeeping unchanged (bounded collections and pruning stay in place).

Migration Notes

No user action required.

FVG palette values (fvgColBull, fvgColBear) may be edited directly to suit different themes.

If HTF OBs were not appearing after a prior v6 conversion, this build resolves that by aligning detection with closed-bar triggers.

Bug Fixes

Fixed HTF OB non-appearance caused by mixed series/bool edge detection under v6.

Removed assignments that mixed na with typed variables.

Reworked duplication checks for HTF boxes to avoid over-plotting.
Sürüm Notları
Summary

HTF Order Block (OB) width control fixed.
HTF OBs (4H & 1D) now strictly cap their right edge so they never extend beyond the intended default length (obExtend = 30 bars on the current chart timeframe).

No changes to detection logic, visuals, or other features (FVG, BSL/SSL, Killzones).

What Changed

Merge behavior for HTF OBs: When overlapping/duplicate HTF OBs are merged, the box’s right boundary is clamped to left + obExtend.

This prevents previously observed “runaway extension” where multiple merges kept lengthening the HTF box and cluttering lower-TF charts.

Technical Details

Function affected: htf_add_or_merge(...).

Old behavior on merge:

box.set_right(ex, math.max(box.get_right(ex), rightIdx))

New behavior on merge:

capRight = box.get_left(ex) + obExtend

box.set_right(ex, math.min(math.max(box.get_right(ex), rightIdx), capRight))

Creation remains rightIdx = bar_index + obExtend (still 30 bars by default), so HTF OB length = 30 bars on the active chart TF (not 30 HTF bars).

Backward Compatibility

Fully backward-compatible.

No input names changed.

Default obExtend = 30 preserved.

LTF OB logic unchanged.

Dedup policy (KeepOlderExtendRight) still honored within the new cap.

Why This Matters

Lower timeframe views (e.g., 5m/15m) will no longer be dominated by oversized HTF boxes after repeated merges.

Chart readability improves without altering signal quality or trading logic.

Edge Cases Considered

Multiple consecutive merges: Right edge never exceeds left + obExtend.

Overlap tolerance: Existing overlap logic retained; only the extent is capped.

Missing boxes/labels: Null checks unchanged to avoid runtime errors.

HTF series timing: The change applies only on merge; creation timing (new 4H/1D bars) unchanged.

Performance Impact

Negligible. The change adds a single math.min(...) bound check during merges, with no additional loops or arrays.

How to Use

No action required. Keep using Show HTF Order Blocks as before.

If you want a different length, adjust obExtend (still measured in bars of the current chart timeframe).
Sürüm Notları
Update: HTF Order Block Rendering Fixed on Lower Timeframes
What changed

HTF OB detection now matches the main OB logic 1:1.
HTF (1H/4H/1D) blocks are created with the exact same flow as the main OBs: Pivot → BOS/CHoCH → last opposite-color candle → ATR-based significance. This removes the previous issues on 15m/30m where boxes appeared misaligned or overly frequent.

Time-anchored drawing (xloc=bar_time).
HTF boxes are anchored to actual bar time at creation. This prevents “right argument too far” errors and keeps HTF boxes perfectly aligned when viewed from lower timeframes.

Smart merge with capped right extension.
Price-overlapping HTF boxes are merged. The right edge only extends up to creation_time + obExtend, so boxes don’t grow indefinitely.

Display policy refined.

1H HTF OBs are hidden on the 1H chart to avoid duplication; they show on intraday charts below 1H.

4H and 1D HTF OBs display on all timeframes.

Each HTF box carries a clear label: “OB (1H/4H/1D)”.

Stability & performance.
Stronger bounds/NA guards prevent array.get out-of-bounds and NA assignment errors. Per-TF/per-side retention is capped (default 20) to reduce render load.

How to use

Enable “Show HTF Order Blocks (1H/4H/1D)” in settings.

Tune obExtend (right extension), maxOBperSide (main), and HTF_KEEP (HTF retention) as needed.

If you do want 1H HTF boxes visible on the 1H chart, change the visibility policy accordingly (default is hidden to avoid duplicates).

Expected result

On 15m (or any LTF), HTF boxes appear at the same time/price zones as they do on their native 1H/4H/1D charts.

No more excessive or misaligned 1H boxes.

No time-index distance errors; boxes keep consistent length and alignment while scrolling far back.

Quick validation

Identify an OB on the 1H chart.

Switch to 15m, enable HTF OB, and confirm the gray 1H box matches the 1H OB’s time and price.

Scroll deep into history to verify boxes remain anchored and error-free.

Compatibility

Main OB/FVG/BSL/SSL features remain unchanged.

Only the HTF OB logic and display policy were aligned and stabilized; existing inputs continue to work as before.
Sürüm Notları
Higher-Timeframe FVG Option — Update Summary
• Added an option to visualize Higher-Timeframe (HTF) Fair Value Gaps alongside the chart’s local timeframe FVGs.
• Supported HTFs: 1H / 4H / 1D.
• Visual refinements: thin box borders and timeframe tags directly on each FVG label (e.g., “15M FVG”, “1H FVG”).
What’s New
① HTF FVG Overlay (1H/4H/1D)
• Detects FVGs on selected higher timeframes using the same logical rules as the local timeframe (gap by candle index ±2 and minimum size filters by ATR/percent).
• Draws HTF FVG boxes on the current chart with time-aligned boxes (bar-time x-coordinates) so users can see where higher-timeframe imbalances intersect lower-timeframe price action.
• 1H HTF display is automatically gated to show only on charts below 60 minutes to avoid redundancy.
② Local FVG Visual Upgrades
• FVG boxes now include subtle, thin borders to improve edge definition without overwhelming the chart.
• Each FVG is labeled with its origin timeframe (e.g., “15M FVG”, “1H FVG”) for instant context in multi-TF workflows.
• Optional behavior for resolved FVGs: when filled, the box can be removed while a small “Filled” tag remains at a fixed offset for auditability.
How It Works (Conceptual)
• Detection: Uses the classic 3-bar displacement definition (gap between bar t and t-2) with adaptive minimum size filters (ATR-based and percent-of-price).
• HTF Projection: FVGs are computed on 1H / 4H / 1D via request.security(...) and projected onto the active chart using bar-time coordinates, ensuring accurate horizontal coverage.
• Merging/Extension: Boxes extend a configurable number of bars and may be merged if they fully overlap in price with tolerance (prevents visual clutter).
• Resolution Handling: When price closes the gap (midline touch or full fill, depending on settings), the area is marked as resolved. You may keep a minimal “Filled” tag for historical review.
Settings You’ll See
• Show FVG — Toggle local timeframe FVGs.
• Show HTF FVG (1H/4H/1D) — Overlay higher-timeframe FVGs on the current chart.
• Hide resolved FVG box (keep only “Filled” label) — Cleans up the view after resolution.
• (Internal) Extend length, ATR/percent thresholds, and merge tolerance follow the existing logic, now applied consistently to HTF signals.
Visual Style & UX
• Thin borders on all FVG boxes for legibility on dark/light themes.
• Label text uses concise timeframe tags: “15M FVG”, “1H FVG”, “4H FVG”, “1D FVG”.
• Color palette: bullish/bearish FVG fills remain consistent with the indicator’s theme; borders are kept understated.
Practical Use
• Top-down context: Use 4H/1D FVGs to frame bias, then look for local entries when price reaches those zones.
• Intra-day precision: Enable 1H FVG on 1m–15m charts to spot where LTF momentum meets HTF imbalance.
• Clutter control: Keep “Hide resolved FVG box” on during live trading and off during study/review.
Notes on Confirmation & Repainting
• FVG identification uses completed bars and standard gap logic. Labels and boxes appear after the condition is satisfied; HTF values are pulled bar-by-bar via security calls.
• As with any multi-timeframe study, interim values on the current forming bar can update until the HTF bar closes. For decision-making, consider confirming on bar close.
Backward Compatibility
• Existing users retain prior defaults. If you previously used only local FVGs, enabling Show HTF FVG adds higher-timeframe context without altering the original detection criteria.
Known Limitations
• Excessive historical drawing can hit TradingView’s object limits on very long lookbacks. The script prunes/merges areas to reduce clutter, but extreme zoom levels may still reach limits.
• Some features (like 1H display) are intentionally gated by the current chart timeframe to keep charts readable.
Changelog (Public)
• Added: HTF FVG overlay (1H/4H/1D) with time-aligned projection.
• Improved: Local and HTF FVG thin borders for clarity.
• Added: Timeframe tags on each FVG label (e.g., “15M FVG”, “1H FVG”).
• Maintenance: Internal pruning/merge logic for fewer duplicate boxes and better performance.
Sürüm Notları
Update Log

• Version: 2025-09-30
• Type: Indicator maintenance update (stability, clarity, and HTF FVG visual distinction)
• Scope: FVG handling, HTF FVG visuals, minor robustness fixes

Summary

• Refined the “resolved FVG” label to reduce ambiguity and improve scanability.
• Tightened code paths to prevent intermittent compile/runtime issues caused by missing locals and multiline pitfalls.
• Differentiated HTF FVG visuals from local FVGs while keeping borders direction-consistent.

What changed

• Resolved FVG label text:
– Previous: Filled → New: "FVG\nFilled" (two-line label for quicker recognition at a glance).
– Positioning and style unchanged.

• HTF FVG palette & borders:
– HTF FVG fill colors now distinct from local FVGs (soft blue/orange).
– Borders still use directional base colors (bull/bear) for consistency.
– 1H HTF FVGs only display when the chart TF is < 60m, as intended.

• De-duplication & retention:
– Keeps at most FVG_MAX_KEEP records; deletes paired graphics (boxes/labels) in sync to avoid leftover elements.
– HTF OB/FVG arrays prune with matching label arrays to prevent UI drift over long sessions.

Fixes & hardening

• Undeclared identifier protection:
– Explicitly declare szF = array.size(fvg_records) before loops that consume it.
– Guard all array gets with size checks where removal can occur.

• Multiline syntax pitfalls (Pine v6):
– All function calls and assignments remain one line to prevent end of line without line continuation errors.
– String newlines use \n inside a single-line string literal.

• Clean teardown on resolution:
– When a FVG resolves and “Hide resolved FVG box” is enabled, the script deletes the area box and its label before tagging the resolution label, preventing duplicated artifacts.

How to use

• Toggle Settings → FVG → Hide resolved FVG box (keep only ‘…’ label) to show only the compact “FVG / Filled” marker after resolution.
• Enable HTF FVG to view higher-timeframe gaps with distinct fills; borders reflect direction for quick bias reads.

Notes on methodology

• This update does not alter detection logic or trading rules. It strictly improves visual separation, state labeling, and code robustness so users can validate structure faster without relying on additional indicators.

Testing & compatibility

• Tested on major symbols across Crypto, FX, and Index futures with the default settings.
• Pine v6. No repaint logic introduced by these changes.
• If you customized colors previously, HTF FVG fills may appear different by design; borders remain consistent with bull/bear colors.

Known limitations

• Extremely dense charts may still require zoom to read two-line labels depending on your text size.
• HTF visibility rules follow your chart timeframe; 1H HTF FVGs won’t display on ≥60m charts by design.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.