OPEN-SOURCE SCRIPT
CISD after Sweep or Fractal Rays CISD

CISD after Sweep — Fractal Rays + CISD
This indicator maps out swing-point liquidity sweeps and the "Change in State of Delivery" (CISD) reactions that follow them.
How it works
Fractal rays — the script marks swing highs/lows using a standard fractal (N bars on each side). Each fractal is drawn as a horizontal ray from its bar forward, and its state is tracked live:
Untested — price hasn't reached the level yet
Tested — price wicked into the level but the candle body didn't close through it
Broken — a candle closed through the level (ray stops at the break)
An optional 2-candle reversal rule can downgrade what looks like a break back to "tested" if the very next candle closes back on the safe side of the level.
CISD detection — once a fractal is wick-tested (swept), the script scans back over the recent candles for the last displacement candle in the opposite direction (a bearish candle closing below the sweep's low for a swept high, or a bullish candle closing above the sweep's high for a swept low). That candle's close becomes a CISD level:
Drawn as a dashed, faded line while pending
Turns solid once price closes back through the CISD level (confirmed shift in delivery)
Removed if price instead closes back through the original fractal price first (invalidated)
Inputs
Fractal period, history depth, and broken-ray display limit
Independent color/width/style controls for untested, tested, and broken rays
CISD scan depth, line width, label toggle, bullish/bearish colors, and pending-line opacity
Optional 2-candle tested-reversal rule
Anti-blink option that defers break verdicts until the forming candle closes, so lines don't flicker between states intra-bar
Notes
All levels are read from confirmed price action only (or the forming candle's wick, where noted) — nothing is calculated from future data.
Ray extension and CISD-level scan depth are both bar-limited for performance; very old fractals beyond the "Max Candles Back" setting are not tracked.
This is a structure/context tool, not a standalone signal generator — combine it with your own entry and risk criteria.
This indicator maps out swing-point liquidity sweeps and the "Change in State of Delivery" (CISD) reactions that follow them.
How it works
Fractal rays — the script marks swing highs/lows using a standard fractal (N bars on each side). Each fractal is drawn as a horizontal ray from its bar forward, and its state is tracked live:
Untested — price hasn't reached the level yet
Tested — price wicked into the level but the candle body didn't close through it
Broken — a candle closed through the level (ray stops at the break)
An optional 2-candle reversal rule can downgrade what looks like a break back to "tested" if the very next candle closes back on the safe side of the level.
CISD detection — once a fractal is wick-tested (swept), the script scans back over the recent candles for the last displacement candle in the opposite direction (a bearish candle closing below the sweep's low for a swept high, or a bullish candle closing above the sweep's high for a swept low). That candle's close becomes a CISD level:
Drawn as a dashed, faded line while pending
Turns solid once price closes back through the CISD level (confirmed shift in delivery)
Removed if price instead closes back through the original fractal price first (invalidated)
Inputs
Fractal period, history depth, and broken-ray display limit
Independent color/width/style controls for untested, tested, and broken rays
CISD scan depth, line width, label toggle, bullish/bearish colors, and pending-line opacity
Optional 2-candle tested-reversal rule
Anti-blink option that defers break verdicts until the forming candle closes, so lines don't flicker between states intra-bar
Notes
All levels are read from confirmed price action only (or the forming candle's wick, where noted) — nothing is calculated from future data.
Ray extension and CISD-level scan depth are both bar-limited for performance; very old fractals beyond the "Max Candles Back" setting are not tracked.
This is a structure/context tool, not a standalone signal generator — combine it with your own entry and risk criteria.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน