OPEN-SOURCE SCRIPT
ที่อัปเดต: CISD Order Block+ (M1D)

CISD Order Block+ finds the candle that changed the state of delivery and turns it into the order block you deal from. A run of down candles delivers lower; price then closes back above the highest body edge of that run. That reclaim is the change in the state of delivery, and the candle it reclaimed is a bullish order block — its body is the array, its midpoint is the entry, and the range it delivered through projects the targets. Bearish mirrors it exactly. Nothing engages until liquidity has been swept, and one raid produces one setup. It maps structure. It does not fire trades.
The sequence it looks for
Bullish below; bearish mirrors.
Liquidity is taken. Price wicks through a swing low and closes back above it — sellside raided and rejected. With no sweep there is no setup, and the swing that was taken is consumed, so the same low cannot be raided twice.
Delivery runs down. Two or more consecutive down candles print. This is the leg that did the raiding.
The run is reclaimed. Within a set window of bars, a candle CLOSES back above the run's highest body edge. That close is the change in the state of delivery.
The origin candle becomes the order block. The highest-bodied candle of the run, the one price just closed back over, which is usually but not always the run's first candle. Its body high is the level, its body midpoint is the entry, and its own body low is the distal edge.
The targets project. The run's body-to-body range, cast forward past the level in standard deviations.
The anchor is the point of the whole thing. Most implementations mark the last down candle before the up move, or measure the midpoint across the entire displacement leg. This one anchors on the run's extreme body — the level whose reclaim actually reverses the delivery — and takes its 0.5 from that single candle's own body, not from the leg. Those produce different prices, and the difference is where you get filled.
These are established Inner Circle Trader concepts — the change in the state of delivery, the order block, the liquidity raid, consequent encroachment and standard deviation projections. This script is an original implementation of them.
One raid, one setup
A down leg is rarely a single run. It is more often three down, a pause, two down, a pause, two more — each with its own body high sitting at a different price. A rally back through that leg closes above each of those levels in turn, on different bars, which is how a CISD tool ends up printing four or five setups off one raid.
This script treats that as one event. When a setup confirms, every other pending run in that leg is discarded and the sweep that produced it is marked as used; the next setup on that side requires a new sweep. The one that survives is the FIRST close that reverses the delivery, not the highest level, because the run nearest the low is the one that actually delivered into the raid. The higher runs further back up the leg are old delivery, and a close through those comes after the move has already gone.
What it draws
The CISD level. A solid line at the origin candle's body high, anchored at the candle that formed it and tagged CISD at its right end. This is the trigger — the price whose reclaim made the setup, and the price whose loss ends it.
The 0.5. A dotted line at the consequent encroachment of that candle's body, tagged 0.5. The entry level: the discount half of the block on a bullish setup, the premium half on a bearish one. Both the line and its tag can be turned off independently.
The swept level. A dotted line at the raided level, running from the swing that formed it to the candle that took it, with a small x centred on the line. It shows the liquidity the whole setup was built on, and it belongs to the setup — when the block fails, the mark goes with it.
The distal edge. The far side of the origin candle's body, dotted, off by default. Turn it on for the full three-level block.
Standard deviations. The unit is the run's body-to-body range — the highest body edge to the lowest body edge across every candle in the run, so a three-candle run measures all three — projected past the CISD level at 1, 2, 2.5 and 4 by default, the multiples editable as a list. They draw as short stubs numbered on their left rather than as extended levels, and they are carried by the latest setup only: four multiples on four live setups is thirty-two objects and reads as a grid, and targets only matter for the setup you are in. Off by default, since projections sit far from price and stretch the price scale.
The block as a zone. Available behind an input, off by default. The levels are the thing; the box is optional.
Why the chart stays clean
Five things retire drawings, so nothing accumulates.
Failure erases. A set is deleted the moment price closes back through its CISD level. Delivery has reverted, the block is spent, and it leaves — lines, tags, sweep mark and all.
One price, one level. A new set whose level lands within half a body of a live one replaces it, on either side. They are one level re-detected as price chops around it, and two tags at one price is two names for one thing.
Age retires. A level price never closed back through would otherwise stay live forever. Sets older than a configurable age are dropped.
Live sets are capped. Oldest first, past a set limit.
Bodyless origins never qualify. An origin candle with almost no body is rejected outright. It is not an array, and its level and its 0.5 would print on top of each other.
A setting keeps failed sets on the chart, redrawn dotted and stripped of their projections, for anyone who wants the record instead of the read.
Everything is drawn black by default so the chart reads as one system rather than a colour code. State is carried by line style instead: solid means the level is live, dotted means it is reference. Every colour is an input if you want direction back in the hues.
Reversals
When a block fails it is not merely deleted, it arms the other side. The level that just failed IS the liquidity that was taken, so the opposite setup can confirm on the bar the failure happens rather than waiting for a fresh swing to form and confirm. Pivot confirmation is inherently late — a swing is only known once the bars either side of it exist — and on a sharp turn that lateness is the difference between marking the reversal and missing it. The behaviour is a setting, and turning it off restores strict pivot-only raids.
Reading it in practice
The CISD line is the trigger, not the entry. The setup is confirmed the moment price closes back through it; what you want next is the retrace into the 0.5, which is the half of the block delivering at a discount on a long. Stop beyond the distal edge — the far side of the origin candle's body — and let the standard deviation stubs frame where the leg is projecting toward. The sweep mark tells you which pool funded the move, which is usually the first thing to check when deciding whether the setup has a story behind it.
The setup ends when price closes back through the CISD level. That is the same line that confirmed it, and the script treats it as the invalidation, which is why a failed set erases itself.
Method and repainting
All detection evaluates on closed bars. The run, the reclaiming close, the sweep and the invalidation are confirmed on candle close, never intrabar — an in-progress candle, wick included, never creates or removes a set. Swing points come from a standard pivot and confirm the configured number of bars after they print, which is inherent to pivot detection: a swing is only known once the bars either side of it exist. Levels anchor to the candle that formed them and are drawn a fixed number of bars past the reclaim.
Alerts fire once per bar close on a confirmed setup.
Settings
Sweep gate: whether a sweep is required at all, pivot length, whether a sweep means a wick through with a close back inside or a close through, how far a raid may precede the run, whether the swept level is marked, one setup per sweep, whether a failed setup counts as a raid, and a minimum bar gap between setups on a side that applies only when the sweep gate is off.
Detection: minimum and maximum candles in the run, the earliest and latest bar of the reclaim window, a minimum origin body as a multiple of ATR, and which side to detect — both, bullish only or bearish only.
Drawing: the 0.5 line and its label, the distal edge, zone mode, bars drawn past the reclaim, the cap on live sets, whether failed sets are kept, merging sets at the same price, and the age at which a set retires.
Standard deviations: on or off, latest set only, the multiples list, whether the unit measures the whole run or the origin candle alone, stub length and stub offset.
Style: a colour per element and one label size for everything.
Analytics only
This is a decision-support tool for discretionary ICT study. It maps a structural sequence — a raid, a delivery leg, and the close that reverses it — and marks the levels that sequence produces. It contains no buy or sell signals and it does not tell you when to enter or exit. Its alerts announce that the pattern completed; they are notifications, not trade instructions.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results.
The sequence it looks for
Bullish below; bearish mirrors.
Liquidity is taken. Price wicks through a swing low and closes back above it — sellside raided and rejected. With no sweep there is no setup, and the swing that was taken is consumed, so the same low cannot be raided twice.
Delivery runs down. Two or more consecutive down candles print. This is the leg that did the raiding.
The run is reclaimed. Within a set window of bars, a candle CLOSES back above the run's highest body edge. That close is the change in the state of delivery.
The origin candle becomes the order block. The highest-bodied candle of the run, the one price just closed back over, which is usually but not always the run's first candle. Its body high is the level, its body midpoint is the entry, and its own body low is the distal edge.
The targets project. The run's body-to-body range, cast forward past the level in standard deviations.
The anchor is the point of the whole thing. Most implementations mark the last down candle before the up move, or measure the midpoint across the entire displacement leg. This one anchors on the run's extreme body — the level whose reclaim actually reverses the delivery — and takes its 0.5 from that single candle's own body, not from the leg. Those produce different prices, and the difference is where you get filled.
These are established Inner Circle Trader concepts — the change in the state of delivery, the order block, the liquidity raid, consequent encroachment and standard deviation projections. This script is an original implementation of them.
One raid, one setup
A down leg is rarely a single run. It is more often three down, a pause, two down, a pause, two more — each with its own body high sitting at a different price. A rally back through that leg closes above each of those levels in turn, on different bars, which is how a CISD tool ends up printing four or five setups off one raid.
This script treats that as one event. When a setup confirms, every other pending run in that leg is discarded and the sweep that produced it is marked as used; the next setup on that side requires a new sweep. The one that survives is the FIRST close that reverses the delivery, not the highest level, because the run nearest the low is the one that actually delivered into the raid. The higher runs further back up the leg are old delivery, and a close through those comes after the move has already gone.
What it draws
The CISD level. A solid line at the origin candle's body high, anchored at the candle that formed it and tagged CISD at its right end. This is the trigger — the price whose reclaim made the setup, and the price whose loss ends it.
The 0.5. A dotted line at the consequent encroachment of that candle's body, tagged 0.5. The entry level: the discount half of the block on a bullish setup, the premium half on a bearish one. Both the line and its tag can be turned off independently.
The swept level. A dotted line at the raided level, running from the swing that formed it to the candle that took it, with a small x centred on the line. It shows the liquidity the whole setup was built on, and it belongs to the setup — when the block fails, the mark goes with it.
The distal edge. The far side of the origin candle's body, dotted, off by default. Turn it on for the full three-level block.
Standard deviations. The unit is the run's body-to-body range — the highest body edge to the lowest body edge across every candle in the run, so a three-candle run measures all three — projected past the CISD level at 1, 2, 2.5 and 4 by default, the multiples editable as a list. They draw as short stubs numbered on their left rather than as extended levels, and they are carried by the latest setup only: four multiples on four live setups is thirty-two objects and reads as a grid, and targets only matter for the setup you are in. Off by default, since projections sit far from price and stretch the price scale.
The block as a zone. Available behind an input, off by default. The levels are the thing; the box is optional.
Why the chart stays clean
Five things retire drawings, so nothing accumulates.
Failure erases. A set is deleted the moment price closes back through its CISD level. Delivery has reverted, the block is spent, and it leaves — lines, tags, sweep mark and all.
One price, one level. A new set whose level lands within half a body of a live one replaces it, on either side. They are one level re-detected as price chops around it, and two tags at one price is two names for one thing.
Age retires. A level price never closed back through would otherwise stay live forever. Sets older than a configurable age are dropped.
Live sets are capped. Oldest first, past a set limit.
Bodyless origins never qualify. An origin candle with almost no body is rejected outright. It is not an array, and its level and its 0.5 would print on top of each other.
A setting keeps failed sets on the chart, redrawn dotted and stripped of their projections, for anyone who wants the record instead of the read.
Everything is drawn black by default so the chart reads as one system rather than a colour code. State is carried by line style instead: solid means the level is live, dotted means it is reference. Every colour is an input if you want direction back in the hues.
Reversals
When a block fails it is not merely deleted, it arms the other side. The level that just failed IS the liquidity that was taken, so the opposite setup can confirm on the bar the failure happens rather than waiting for a fresh swing to form and confirm. Pivot confirmation is inherently late — a swing is only known once the bars either side of it exist — and on a sharp turn that lateness is the difference between marking the reversal and missing it. The behaviour is a setting, and turning it off restores strict pivot-only raids.
Reading it in practice
The CISD line is the trigger, not the entry. The setup is confirmed the moment price closes back through it; what you want next is the retrace into the 0.5, which is the half of the block delivering at a discount on a long. Stop beyond the distal edge — the far side of the origin candle's body — and let the standard deviation stubs frame where the leg is projecting toward. The sweep mark tells you which pool funded the move, which is usually the first thing to check when deciding whether the setup has a story behind it.
The setup ends when price closes back through the CISD level. That is the same line that confirmed it, and the script treats it as the invalidation, which is why a failed set erases itself.
Method and repainting
All detection evaluates on closed bars. The run, the reclaiming close, the sweep and the invalidation are confirmed on candle close, never intrabar — an in-progress candle, wick included, never creates or removes a set. Swing points come from a standard pivot and confirm the configured number of bars after they print, which is inherent to pivot detection: a swing is only known once the bars either side of it exist. Levels anchor to the candle that formed them and are drawn a fixed number of bars past the reclaim.
Alerts fire once per bar close on a confirmed setup.
Settings
Sweep gate: whether a sweep is required at all, pivot length, whether a sweep means a wick through with a close back inside or a close through, how far a raid may precede the run, whether the swept level is marked, one setup per sweep, whether a failed setup counts as a raid, and a minimum bar gap between setups on a side that applies only when the sweep gate is off.
Detection: minimum and maximum candles in the run, the earliest and latest bar of the reclaim window, a minimum origin body as a multiple of ATR, and which side to detect — both, bullish only or bearish only.
Drawing: the 0.5 line and its label, the distal edge, zone mode, bars drawn past the reclaim, the cap on live sets, whether failed sets are kept, merging sets at the same price, and the age at which a set retires.
Standard deviations: on or off, latest set only, the multiples list, whether the unit measures the whole run or the origin candle alone, stub length and stub offset.
Style: a colour per element and one label size for everything.
Analytics only
This is a decision-support tool for discretionary ICT study. It maps a structural sequence — a raid, a delivery leg, and the close that reverses it — and marks the levels that sequence produces. It contains no buy or sell signals and it does not tell you when to enter or exit. Its alerts announce that the pattern completed; they are notifications, not trade instructions.
Disclaimer
This is a decision-support tool for discretionary ICT trading. It is not financial advice, and no market's past behaviour is indicative of future results.
Release Note
Fixed a crash that could stop the script mid-session. The sweep line and the block start at the candles that set them, which can sit thousands of chart bars back. Placing that anchor on the chart walks back through bar history, and the buffer Pine sizes for it is set from what past bars happened to need, so the first live bar that needed one bar more stopped the whole script with "requested historical offset is beyond the historical buffer's limit". The buffer is now set explicitly, and an anchor older than the chart can reach draws from the oldest reachable bar instead of failing. Nothing changes in what is detected or how it is drawn.
A sweep now has to take a real swing, not a pullback inside a run.
The pivot that arms a setup must be the extreme of its leg — the lowest low or highest high of the bars leading into it (new setting, Swing must be the extreme of, default 20 bars). A three-bar wobble inside a rally is not liquidity; nobody's stop sits under it, and setups were being armed off exactly that. Pivot length defaults to 5 rather than 3 for the same reason, and A failed setup counts as a raid now defaults off, because a failed block's level is not a pool either.
Release Note
Candle sweepA new sweep source: a candle takes the prior candle's high or low and closes back inside it. The run that made the sweep becomes the CISD, and it confirms on the spot when that candle's own close is already through the level. Swing pivots still count; the default is Either. The candle timeframe can be set, or left empty to pair one fractal step up (5m from 1H, 15m from 4H).
Kill on the sweep extreme
A pending CISD now dies the moment price trades through the extreme of the sweep that armed it, before any reclaim.
Confirm timeframe
The reclaim can be set to count only on closes of a chosen timeframe, such as 5m closes on a 1m chart.
New defaults
The block draws as a zone, standard deviation projections are on for every set, and sets stay on the chart until they fail.
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์แบบโอเพนซอร์ส
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน