OPEN-SOURCE SCRIPT
ที่อัปเดต: Smart Money Concepts Liquidity Sweep, Order Block & FVG

OVERVIEW
Every Smart Money indicator draws order blocks and tells you they work. This one scores them 0–100 and then forward-tests whether the score is actually true — on your instrument, on your timeframe.
It maps liquidity, detects stop-hunts, builds entry zones from the displacement that follows, confirms them with real order flow, and grades every zone that price returns to. Instead of "here is an order block, trust me", the panel tells you something like:
Tier-A zones returned +0.23R vs +0.08R for a matched control, n=61, t=2.1 — PROVEN
...or, just as usefully, NOT PROVEN. It is built to be able to tell you it doesn't work.
This is a research and framing tool. It is NOT a strategy, NOT a signal service, and NOT a validated edge.
WHY THESE PARTS ARE ONE TOOL (mashup rationale)
The Smart Money / ICT model is a SEQUENCE. Each step is meaningless on its own, and that is why they are combined here rather than sold as separate scripts:
1. LIQUIDITY POOLS — Stops cluster above equal highs (buy-side) and below equal lows (sell-side). Swing points within an ATR tolerance are clustered into a single pool; the more swings, the more stops resting there. A pool is not a signal. It is a magnet and a target.
2. THE SWEEP — Price wicks THROUGH the pool and closes back INSIDE it. That is a stop-hunt, and it is the only part of the sequence that reveals intent. A sweep alone is still not a trade.
3. DISPLACEMENT — An impulsive, ATR-normalised move away from the swept level. This is what separates a SWEEP (reversal) from a RUN (continuation).
4. THE ZONE — Displacement leaves footprints: a FAIR VALUE GAP (a three-bar imbalance) and an ORDER BLOCK (the last opposing candle before the impulse). Where an FVG sits INSIDE an order block, two independent structures agree — flagged as a confluence zone.
5. LOCATION — The zone is then judged on WHERE it sits. Against the VOLUME PROFILE (value area, point of control, and untested "naked" POCs), and against the DEALING-RANGE EQUILIBRIUM. A bullish zone in DISCOUNT is a zone you are being paid to buy; the same zone in premium is not.
6. ORDER FLOW — The question structure cannot answer: did anyone actually show up? Intrabar delta signs each lower-timeframe bar's volume by its own direction. A bullish zone born on NEGATIVE delta is a vacuum, not a footprint — and scores nothing for it.
7. THE ENTRY — Price is never chased. The engine arms only when price RETRACES into a fresh zone, then frames entry / stop / target — the target being THE NEXT OPPOSING POOL OF STOPS, because that is where the next batch of liquidity is resting.
8. THE CALIBRATION — Without it, everything above is folklore.
Remove any one of these and the tool marks noise, chases price, targets nothing, ignores where value actually is, or reports a confidence it has not earned.
THE SCORE (0–100, eight measurable components, no discretion)
Displacement strength ...... impulse body ÷ ATR — the energy behind the zone
Participation (RVOL) ....... volume at formation vs its own recent average
Born from a sweep .......... did a stop-hunt precede it? (the core ICT claim)
Imbalance size ............. FVG height ÷ ATR
HTF alignment .............. does the higher timeframe agree?
Premium / discount ......... bullish zone in DISCOUNT? bearish zone in PREMIUM?
Volume-profile location .... at value, at the POC, or at an untested POC?
Order flow (delta) ......... was the displacement backed by real aggressive flow?
Tiers: A (70+) · B (40–69) · C (below 40). Every weight is an input — if you think the sweep matters more than I do, turn it up, and let the calibration tell you whether you were right.
THE CALIBRATION — AND WHY IT IS HONEST
Every zone trade is paired with a MATCHED CONTROL: the same bar, the same direction, and the SAME R:R — but entered at market with an ATR stop instead of at the zone. This isolates exactly one variable: does entering AT THE ZONE beat entering anywhere else on identical geometry? Under a random walk, this control has zero expectancy, so anything the zones earn is real.
Each tier is tested against its OWN control, because an A-zone may carry a very different R:R from a C-zone, and a trade's hit rate depends on its R:R.
Results are reported as EXPECTANCY IN R, not hit rate. When R:R varies from trade to trade, a hit rate on its own is meaningless: a 6R winner at 20% is +0.4R (excellent), while a 1R winner at 55% is +0.1R (barely worth the commission).
A Welch t-test decides whether the difference is real or luck. The panel does not say "proven" unless t > 1.96.
The panel also answers the one question that matters most: DOES TIER A BEAT TIER C? If the scoring model has any value, A-grade zones must outperform C-grade zones. If they don't, the score is noise — and it will say so.
Conventions are deliberately chosen so the tool cannot flatter itself:
· Both barriers touched on the same bar → the STOP is assumed first.
· Expired trades are marked to market, not counted as wins or losses.
· Everything is logged and resolved on confirmed bars only.
HOW TO USE IT
1. Read the bias, the liquidity map, and the premium/discount shading. Pools above are buy-side, pools below are sell-side, and price usually travels from one to the other.
2. Wait for a SWEEP, then for a zone to be created by the displacement that follows.
3. Do NOT chase. The engine arms an entry only when price RETRACES into a fresh zone.
4. Watch for ABSORPTION at the zone — heavy volume, a small range, price holding. Someone is soaking up the aggression. That is a defended zone, and it is the best live confirmation available.
5. READ THE CALIBRATION BEFORE YOU WEIGHT ANY OF IT. If Tier A is not proven on your instrument and timeframe, a zone is a LOCATION, not a PROBABILITY — treat it as context only.
6. Entry / stop / target and the resulting R:R are drawn on the chart. They are arithmetic, not advice.
Do not tune the weights until the numbers turn green. That is curve-fitting, and the calibration exists to catch it — not to be defeated by it.
ORIGINALITY
The underlying SMC concepts are public and credited below. What is assembled here is the specific synthesis: an eight-component measurable score, the fusion of SMC structure with auction-theory location (volume profile and premium/discount), true intrabar order-flow confirmation, a per-tier matched control, expectancy-in-R reporting, and a significance test that can — and frequently does — return "not proven".
Clean-room implementation. No third-party Pine code is reused.
UNIVERSAL / DATA REQUIREMENTS
Works on any symbol and any timeframe — the engine is ATR-normalised throughout, so it adapts to the instrument rather than assuming point values.
Volume improves the score but is NOT required. On a symbol without real volume, the RVOL, volume-profile and order-flow components neutralise and the panel says so, rather than blanking or pretending.
Intrabar delta requires a timeframe strictly below the chart's. The script AUTO-MAPS this (1m→5s, 3m→15s, 5m→30s, 15m→1m, and so on) because if the intrabar timeframe equals the chart timeframe there is only ONE intrabar — the bar itself — and delta degenerates to ±100% on every bar. Where true intrabar data is unavailable, the script falls back to a close-location proxy AND LABELS IT AS A PROXY in the panel.
NON-REPAINTING
Pools, sweeps, displacement, zones, the volume profile, absorption and entries are ALL computed on confirmed bars only.
Swing points use ta.pivot* and are therefore known only AFTER their confirmation bars. This is why a liquidity pool appears a few bars after its swing. That delay is the honest cost of not repainting, and it is paid deliberately — a level that moves after the fact is worse than no level at all.
The higher-timeframe read uses lookahead_off with a live-bar offset. The calibration harness logs AND resolves on confirmed bars, so its statistics cannot inflate intrabar. Nothing here is drawn and then moved.
HONEST LIMITATIONS — PLEASE READ
Smart Money Concepts is a popular framework, not a proven one. That is precisely why this script measures it instead of asserting it.
The calibration figures are IN-SAMPLE, close-to-close, with NO costs or slippage, and they use overlapping windows. A proven in-sample edge is NOT a guarantee of out-of-sample results.
The rolling volume profile is an APPROXIMATION — each bar's volume is spread uniformly across the bins its range covers. It is not tick data.
Small samples are unreliable. A tier with a low "n" is provisional even if it looks good.
If the edge is near zero, negative, or unstable across timeframes, the honest conclusion is that this model carries no edge on that instrument. The tool is designed to be able to tell you that, and you should believe it when it does.
Nothing here predicts price.
CONCEPT CREDITS
Smart Money / ICT concepts — liquidity pools, stop-hunts, displacement, fair value gaps, order blocks, premium/discount and optimal trade entry — are public trading concepts popularised by Michael J. Huddleston (Inner Circle Trader) and the wider SMC community.
Market Profile, the point of control and the value area — J. Peter Steidlmayer and the CBOT.
Market structure theory — Charles Dow.
Average True Range — J. Welles Wilder.
Wilson score interval — Edwin B. Wilson.
Triple-barrier forward labelling — Marcos López de Prado.
Welch's t-test — B. L. Welch.
The zone-scoring model, the order-flow fusion, the per-tier matched control and the tier calibration are the author's own. Not affiliated with, nor endorsed by, any of the above.
DISCLAIMER
This is a research and educational tool only. It is NOT financial advice, NOT a recommendation, and offers NO guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Entry, stop and target output is arithmetic, not advice. Trading carries a risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use of this script.
Every Smart Money indicator draws order blocks and tells you they work. This one scores them 0–100 and then forward-tests whether the score is actually true — on your instrument, on your timeframe.
It maps liquidity, detects stop-hunts, builds entry zones from the displacement that follows, confirms them with real order flow, and grades every zone that price returns to. Instead of "here is an order block, trust me", the panel tells you something like:
Tier-A zones returned +0.23R vs +0.08R for a matched control, n=61, t=2.1 — PROVEN
...or, just as usefully, NOT PROVEN. It is built to be able to tell you it doesn't work.
This is a research and framing tool. It is NOT a strategy, NOT a signal service, and NOT a validated edge.
WHY THESE PARTS ARE ONE TOOL (mashup rationale)
The Smart Money / ICT model is a SEQUENCE. Each step is meaningless on its own, and that is why they are combined here rather than sold as separate scripts:
1. LIQUIDITY POOLS — Stops cluster above equal highs (buy-side) and below equal lows (sell-side). Swing points within an ATR tolerance are clustered into a single pool; the more swings, the more stops resting there. A pool is not a signal. It is a magnet and a target.
2. THE SWEEP — Price wicks THROUGH the pool and closes back INSIDE it. That is a stop-hunt, and it is the only part of the sequence that reveals intent. A sweep alone is still not a trade.
3. DISPLACEMENT — An impulsive, ATR-normalised move away from the swept level. This is what separates a SWEEP (reversal) from a RUN (continuation).
4. THE ZONE — Displacement leaves footprints: a FAIR VALUE GAP (a three-bar imbalance) and an ORDER BLOCK (the last opposing candle before the impulse). Where an FVG sits INSIDE an order block, two independent structures agree — flagged as a confluence zone.
5. LOCATION — The zone is then judged on WHERE it sits. Against the VOLUME PROFILE (value area, point of control, and untested "naked" POCs), and against the DEALING-RANGE EQUILIBRIUM. A bullish zone in DISCOUNT is a zone you are being paid to buy; the same zone in premium is not.
6. ORDER FLOW — The question structure cannot answer: did anyone actually show up? Intrabar delta signs each lower-timeframe bar's volume by its own direction. A bullish zone born on NEGATIVE delta is a vacuum, not a footprint — and scores nothing for it.
7. THE ENTRY — Price is never chased. The engine arms only when price RETRACES into a fresh zone, then frames entry / stop / target — the target being THE NEXT OPPOSING POOL OF STOPS, because that is where the next batch of liquidity is resting.
8. THE CALIBRATION — Without it, everything above is folklore.
Remove any one of these and the tool marks noise, chases price, targets nothing, ignores where value actually is, or reports a confidence it has not earned.
THE SCORE (0–100, eight measurable components, no discretion)
Displacement strength ...... impulse body ÷ ATR — the energy behind the zone
Participation (RVOL) ....... volume at formation vs its own recent average
Born from a sweep .......... did a stop-hunt precede it? (the core ICT claim)
Imbalance size ............. FVG height ÷ ATR
HTF alignment .............. does the higher timeframe agree?
Premium / discount ......... bullish zone in DISCOUNT? bearish zone in PREMIUM?
Volume-profile location .... at value, at the POC, or at an untested POC?
Order flow (delta) ......... was the displacement backed by real aggressive flow?
Tiers: A (70+) · B (40–69) · C (below 40). Every weight is an input — if you think the sweep matters more than I do, turn it up, and let the calibration tell you whether you were right.
THE CALIBRATION — AND WHY IT IS HONEST
Every zone trade is paired with a MATCHED CONTROL: the same bar, the same direction, and the SAME R:R — but entered at market with an ATR stop instead of at the zone. This isolates exactly one variable: does entering AT THE ZONE beat entering anywhere else on identical geometry? Under a random walk, this control has zero expectancy, so anything the zones earn is real.
Each tier is tested against its OWN control, because an A-zone may carry a very different R:R from a C-zone, and a trade's hit rate depends on its R:R.
Results are reported as EXPECTANCY IN R, not hit rate. When R:R varies from trade to trade, a hit rate on its own is meaningless: a 6R winner at 20% is +0.4R (excellent), while a 1R winner at 55% is +0.1R (barely worth the commission).
A Welch t-test decides whether the difference is real or luck. The panel does not say "proven" unless t > 1.96.
The panel also answers the one question that matters most: DOES TIER A BEAT TIER C? If the scoring model has any value, A-grade zones must outperform C-grade zones. If they don't, the score is noise — and it will say so.
Conventions are deliberately chosen so the tool cannot flatter itself:
· Both barriers touched on the same bar → the STOP is assumed first.
· Expired trades are marked to market, not counted as wins or losses.
· Everything is logged and resolved on confirmed bars only.
HOW TO USE IT
1. Read the bias, the liquidity map, and the premium/discount shading. Pools above are buy-side, pools below are sell-side, and price usually travels from one to the other.
2. Wait for a SWEEP, then for a zone to be created by the displacement that follows.
3. Do NOT chase. The engine arms an entry only when price RETRACES into a fresh zone.
4. Watch for ABSORPTION at the zone — heavy volume, a small range, price holding. Someone is soaking up the aggression. That is a defended zone, and it is the best live confirmation available.
5. READ THE CALIBRATION BEFORE YOU WEIGHT ANY OF IT. If Tier A is not proven on your instrument and timeframe, a zone is a LOCATION, not a PROBABILITY — treat it as context only.
6. Entry / stop / target and the resulting R:R are drawn on the chart. They are arithmetic, not advice.
Do not tune the weights until the numbers turn green. That is curve-fitting, and the calibration exists to catch it — not to be defeated by it.
ORIGINALITY
The underlying SMC concepts are public and credited below. What is assembled here is the specific synthesis: an eight-component measurable score, the fusion of SMC structure with auction-theory location (volume profile and premium/discount), true intrabar order-flow confirmation, a per-tier matched control, expectancy-in-R reporting, and a significance test that can — and frequently does — return "not proven".
Clean-room implementation. No third-party Pine code is reused.
UNIVERSAL / DATA REQUIREMENTS
Works on any symbol and any timeframe — the engine is ATR-normalised throughout, so it adapts to the instrument rather than assuming point values.
Volume improves the score but is NOT required. On a symbol without real volume, the RVOL, volume-profile and order-flow components neutralise and the panel says so, rather than blanking or pretending.
Intrabar delta requires a timeframe strictly below the chart's. The script AUTO-MAPS this (1m→5s, 3m→15s, 5m→30s, 15m→1m, and so on) because if the intrabar timeframe equals the chart timeframe there is only ONE intrabar — the bar itself — and delta degenerates to ±100% on every bar. Where true intrabar data is unavailable, the script falls back to a close-location proxy AND LABELS IT AS A PROXY in the panel.
NON-REPAINTING
Pools, sweeps, displacement, zones, the volume profile, absorption and entries are ALL computed on confirmed bars only.
Swing points use ta.pivot* and are therefore known only AFTER their confirmation bars. This is why a liquidity pool appears a few bars after its swing. That delay is the honest cost of not repainting, and it is paid deliberately — a level that moves after the fact is worse than no level at all.
The higher-timeframe read uses lookahead_off with a live-bar offset. The calibration harness logs AND resolves on confirmed bars, so its statistics cannot inflate intrabar. Nothing here is drawn and then moved.
HONEST LIMITATIONS — PLEASE READ
Smart Money Concepts is a popular framework, not a proven one. That is precisely why this script measures it instead of asserting it.
The calibration figures are IN-SAMPLE, close-to-close, with NO costs or slippage, and they use overlapping windows. A proven in-sample edge is NOT a guarantee of out-of-sample results.
The rolling volume profile is an APPROXIMATION — each bar's volume is spread uniformly across the bins its range covers. It is not tick data.
Small samples are unreliable. A tier with a low "n" is provisional even if it looks good.
If the edge is near zero, negative, or unstable across timeframes, the honest conclusion is that this model carries no edge on that instrument. The tool is designed to be able to tell you that, and you should believe it when it does.
Nothing here predicts price.
CONCEPT CREDITS
Smart Money / ICT concepts — liquidity pools, stop-hunts, displacement, fair value gaps, order blocks, premium/discount and optimal trade entry — are public trading concepts popularised by Michael J. Huddleston (Inner Circle Trader) and the wider SMC community.
Market Profile, the point of control and the value area — J. Peter Steidlmayer and the CBOT.
Market structure theory — Charles Dow.
Average True Range — J. Welles Wilder.
Wilson score interval — Edwin B. Wilson.
Triple-barrier forward labelling — Marcos López de Prado.
Welch's t-test — B. L. Welch.
The zone-scoring model, the order-flow fusion, the per-tier matched control and the tier calibration are the author's own. Not affiliated with, nor endorsed by, any of the above.
DISCLAIMER
This is a research and educational tool only. It is NOT financial advice, NOT a recommendation, and offers NO guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Entry, stop and target output is arithmetic, not advice. Trading carries a risk of loss. Test out-of-sample and make your own decisions. The author accepts no liability for any use of this script.
Release Note
Smart Money Concepts v1.1 — CVD divergence fixThe cumulative-delta divergence test called the lowest and highest functions after a logical and. Pine short-circuits, so on any bar where the price comparison failed, the CVD extremes were never evaluated and their rolling windows drifted over a broken history — making the divergence read unreliable.
All four extremes are now computed unconditionally and combined afterwards. Liquidity sweep detection, order blocks, fair value gaps and the entry engine are unchanged.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน