OPEN-SOURCE SCRIPT
Smart Money Concepts Engine [Quantum Algo]

Smart Money Concepts Engine [Quantum Algo]
====================================================
🔶 OVERVIEW
Smart Money Concepts Engine is an all-in-one smart money concepts (SMC) indicator that unifies market structure, order blocks, fair value gaps with inversions, liquidity, and premium and discount analysis into a single engine — and then goes one layer deeper than drawing tools: it scores the confluence of everything on the chart into a transparent zero-to-one-hundred Confluence Score, and narrates the current market read in plain language on a live dashboard.
Most smart money indicators draw concepts and leave the interpretation to you. This engine interprets. At any moment the dashboard answers the questions an institutional-style trader actually asks: What is the structure doing on both tiers? Has liquidity been taken? Is price in premium or discount? Are there fresh zones nearby? How much of this stacks together right now?
🔶 WHAT ARE SMART MONEY CONCEPTS?
Smart money concepts describe how large market participants leave footprints in price: they break structure to reveal intent (Break of Structure and Change of Character), they enter from unmitigated zones of prior aggression (order blocks), they leave imbalances behind fast moves (fair value gaps), they engineer stop runs above equal highs and below equal lows (liquidity sweeps), and they favor buying in the discount half of a range and selling in the premium half. This engine detects, draws, and tracks the life cycle of every one of these elements.
🔶 WHY THIS SCRIPT IS ORIGINAL
1. Confluence Score. A transparent zero-to-one-hundred score built from five weighted, observable conditions: swing and internal structure alignment (25), correct premium or discount positioning for the bias (25), a fresh order block near price (20), imbalance confluence (15), and a recent liquidity sweep in the supportive direction (15). Every point is explainable — nothing is a black box.
2. Narrative engine. The dashboard writes the market read as a plain-language story that updates live, for example: "Bullish structure — sell-side taken — price in discount — demand below." No interpretation gap between what the chart shows and what it means.
3. Zone life cycle everywhere. Order blocks are born fresh, brighten when tested, and are removed the moment they are mitigated — the chart only ever shows zones that still matter. Fair value gaps flip into inversion zones when violated and are removed on the second violation. Equal highs and equal lows are struck through and relabeled the moment they are swept.
4. Volume-graded zones. Every order block is labeled with the relative volume of its origin candle (for example "Demand · 1.8× Volume"), so zone quality is visible at a glance.
5. Dual-tier structure. Swing structure (Break of Structure and Change of Character with lines and labels) and internal structure (compact context markers) are tracked as two independent bias states — and their agreement or disagreement feeds the score.
6. Graded zone-tap signals. When price returns to a fresh zone while both structure tiers align and price sits on the correct side of equilibrium, the engine prints a signal stamped with the live Confluence Score. High-scoring signals are highlighted in the accent color.
7. Anti-clutter engineering. Sweep detection carries per-level memory and a cooldown so the same level can never stack duplicate labels. Every drawing family is capped by input, keeping the chart readable and the auto-scale anchored to current price.
🔶 HOW IT WORKS
Market structure: Swing highs and lows are confirmed with a symmetric pivot lookback. A candle close through a confirmed swing level prints a Break of Structure (BoS) in trend continuation or a Change of Character (CHoCH) on reversal, on both the swing tier and the internal tier. All events are evaluated on closed bars only, so structure and signals do not repaint.
Order blocks: On every swing structure break, the engine locates the origin candle of the move — the last opposite candle before the impulse — and projects it forward as a demand or supply zone, graded by the relative volume of that candle. Zones brighten on first touch and are removed when price closes through them.
Fair value gaps: Three-candle imbalances above a minimum size (measured in Average True Range) are boxed. When price closes through a gap, it flips into an inversion zone acting in the opposite direction; a second violation removes it. Gap detection runs in the background for the Confluence Score even when drawing is disabled.
Liquidity: Consecutive swing highs or lows within a tolerance form Equal Highs (EQH) or Equal Lows (EQL) — resting liquidity lines that follow price. A wick through the level with a close back inside marks a sweep: the line is struck through, relabeled, and the event feeds the score. Single-pivot stop hunts are detected the same way, with per-level memory preventing duplicates.
Premium and discount: The range between the last confirmed swing high and low is mapped into premium, equilibrium, and discount, with deeper tinting in the extreme quartiles. The dashboard reports the live position as a percentage of the range.
Dashboard: A compact, fully themeable panel shows swing bias, internal bias, last event, range position, liquidity status, fresh demand and supply counts, imbalance count, the Confluence Score with a strength meter, and the narrative. Text size, position, and every color are adjustable, and long narrative text wraps inside its cell to keep the panel compact.
🔶 HOW TO USE IT
1. Works on any market — cryptocurrency, forex, gold, indices, stocks, futures — and any timeframe. The engine adapts structure size through the swing and internal length inputs.
2. Read the dashboard top to bottom: bias on both tiers, what just happened, where price sits in the range, and whether liquidity has been taken.
3. The highest-quality condition is full alignment: both tiers agree, a sweep has occurred against the move, price trades on the correct side of equilibrium, and a fresh volume-graded zone waits nearby — exactly what the Confluence Score measures.
4. Treat zone-tap signals as locations of interest stamped with their context quality, not as automatic entries. A score above eighty means nearly everything aligns; below fifty means the setup is thin.
5. Use inversion zones as polarity flips: a violated imbalance often acts as support or resistance from the other side.
6. Fair value gap drawing is off by default for a cleaner chart; enable it in settings — the score uses gap information either way.
🔶 SETTINGS
- Swing and internal structure lengths, structure events to keep.
- Order blocks: origin candle lookback and zones to keep.
- Fair value gaps: minimum size, inversion tracking, gaps to keep (drawing off by default).
- Liquidity: equal level tolerance and levels to keep.
- Premium and discount map with adjustable extension.
- Zone tap signals and signals to keep.
- All chart colors, plus a fully themeable dashboard: position, four text sizes, title band, background, frame, grid, and three text colors.
🔶 ALERTS
- Bullish / Bearish Break of Structure
- Bullish / Bearish Change of Character
- Buy-Side / Sell-Side Liquidity Sweep
- Demand Zone Tap / Supply Zone Tap (score-stamped)
- Fair Value Gap Inversion
🔶 FREQUENTLY ASKED QUESTIONS
Does the indicator repaint? No. Structure events, sweeps, inversions, and signals are evaluated on closed bars at confirmed pivots. Pivot confirmation introduces intentional lag equal to the structure length.
What does the Confluence Score mean? It is a transparent sum of five weighted conditions, not a prediction. It measures how much of the smart money checklist is currently aligned — a context meter, not a probability of profit.
Why did an order block disappear? It was mitigated: price closed through it. The engine removes dead zones so the chart only shows levels that still matter.
Why do sweeps print only once at a level? Each swing level carries sweep memory and a cooldown, preventing the duplicate label stacking common in liquidity tools.
Which markets and timeframes work best? All markets with candle data. Higher timeframes produce larger, cleaner structures; the internal tier keeps lower timeframes readable.
🔶 CREDITS
The smart money concepts implemented here — order blocks, fair value gaps, liquidity sweeps, break of structure, change of character, and premium and discount — are trading concepts popularized by the Inner Circle Trader methodology of Michael J. Huddleston, with intellectual roots in the market logic of Richard D. Wyckoff. This script gratefully acknowledges that lineage. The confluence scoring model, the narrative engine, the zone life cycle system, the volume grading, the anti-duplication sweep memory, and all code in this script are original work
🔶 LIMITATIONS
Structure detection is only as good as the chosen pivot lengths; very noisy instruments may need larger values. Volume grading is less meaningful on symbols with unreliable volume reporting. Removed zones are not kept as historical artifacts. The Confluence Score measures alignment, not outcome. No indicator replaces independent analysis.
🔶 DISCLAIMER
This script is provided strictly for educational and informational purposes. It is not financial advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Past behavior of any structure event, zone, or signal does not guarantee future results. Trading involves substantial risk. Always do your own research and manage risk independently.
====================================================
🔶 OVERVIEW
Smart Money Concepts Engine is an all-in-one smart money concepts (SMC) indicator that unifies market structure, order blocks, fair value gaps with inversions, liquidity, and premium and discount analysis into a single engine — and then goes one layer deeper than drawing tools: it scores the confluence of everything on the chart into a transparent zero-to-one-hundred Confluence Score, and narrates the current market read in plain language on a live dashboard.
Most smart money indicators draw concepts and leave the interpretation to you. This engine interprets. At any moment the dashboard answers the questions an institutional-style trader actually asks: What is the structure doing on both tiers? Has liquidity been taken? Is price in premium or discount? Are there fresh zones nearby? How much of this stacks together right now?
🔶 WHAT ARE SMART MONEY CONCEPTS?
Smart money concepts describe how large market participants leave footprints in price: they break structure to reveal intent (Break of Structure and Change of Character), they enter from unmitigated zones of prior aggression (order blocks), they leave imbalances behind fast moves (fair value gaps), they engineer stop runs above equal highs and below equal lows (liquidity sweeps), and they favor buying in the discount half of a range and selling in the premium half. This engine detects, draws, and tracks the life cycle of every one of these elements.
🔶 WHY THIS SCRIPT IS ORIGINAL
1. Confluence Score. A transparent zero-to-one-hundred score built from five weighted, observable conditions: swing and internal structure alignment (25), correct premium or discount positioning for the bias (25), a fresh order block near price (20), imbalance confluence (15), and a recent liquidity sweep in the supportive direction (15). Every point is explainable — nothing is a black box.
2. Narrative engine. The dashboard writes the market read as a plain-language story that updates live, for example: "Bullish structure — sell-side taken — price in discount — demand below." No interpretation gap between what the chart shows and what it means.
3. Zone life cycle everywhere. Order blocks are born fresh, brighten when tested, and are removed the moment they are mitigated — the chart only ever shows zones that still matter. Fair value gaps flip into inversion zones when violated and are removed on the second violation. Equal highs and equal lows are struck through and relabeled the moment they are swept.
4. Volume-graded zones. Every order block is labeled with the relative volume of its origin candle (for example "Demand · 1.8× Volume"), so zone quality is visible at a glance.
5. Dual-tier structure. Swing structure (Break of Structure and Change of Character with lines and labels) and internal structure (compact context markers) are tracked as two independent bias states — and their agreement or disagreement feeds the score.
6. Graded zone-tap signals. When price returns to a fresh zone while both structure tiers align and price sits on the correct side of equilibrium, the engine prints a signal stamped with the live Confluence Score. High-scoring signals are highlighted in the accent color.
7. Anti-clutter engineering. Sweep detection carries per-level memory and a cooldown so the same level can never stack duplicate labels. Every drawing family is capped by input, keeping the chart readable and the auto-scale anchored to current price.
🔶 HOW IT WORKS
Market structure: Swing highs and lows are confirmed with a symmetric pivot lookback. A candle close through a confirmed swing level prints a Break of Structure (BoS) in trend continuation or a Change of Character (CHoCH) on reversal, on both the swing tier and the internal tier. All events are evaluated on closed bars only, so structure and signals do not repaint.
Order blocks: On every swing structure break, the engine locates the origin candle of the move — the last opposite candle before the impulse — and projects it forward as a demand or supply zone, graded by the relative volume of that candle. Zones brighten on first touch and are removed when price closes through them.
Fair value gaps: Three-candle imbalances above a minimum size (measured in Average True Range) are boxed. When price closes through a gap, it flips into an inversion zone acting in the opposite direction; a second violation removes it. Gap detection runs in the background for the Confluence Score even when drawing is disabled.
Liquidity: Consecutive swing highs or lows within a tolerance form Equal Highs (EQH) or Equal Lows (EQL) — resting liquidity lines that follow price. A wick through the level with a close back inside marks a sweep: the line is struck through, relabeled, and the event feeds the score. Single-pivot stop hunts are detected the same way, with per-level memory preventing duplicates.
Premium and discount: The range between the last confirmed swing high and low is mapped into premium, equilibrium, and discount, with deeper tinting in the extreme quartiles. The dashboard reports the live position as a percentage of the range.
Dashboard: A compact, fully themeable panel shows swing bias, internal bias, last event, range position, liquidity status, fresh demand and supply counts, imbalance count, the Confluence Score with a strength meter, and the narrative. Text size, position, and every color are adjustable, and long narrative text wraps inside its cell to keep the panel compact.
🔶 HOW TO USE IT
1. Works on any market — cryptocurrency, forex, gold, indices, stocks, futures — and any timeframe. The engine adapts structure size through the swing and internal length inputs.
2. Read the dashboard top to bottom: bias on both tiers, what just happened, where price sits in the range, and whether liquidity has been taken.
3. The highest-quality condition is full alignment: both tiers agree, a sweep has occurred against the move, price trades on the correct side of equilibrium, and a fresh volume-graded zone waits nearby — exactly what the Confluence Score measures.
4. Treat zone-tap signals as locations of interest stamped with their context quality, not as automatic entries. A score above eighty means nearly everything aligns; below fifty means the setup is thin.
5. Use inversion zones as polarity flips: a violated imbalance often acts as support or resistance from the other side.
6. Fair value gap drawing is off by default for a cleaner chart; enable it in settings — the score uses gap information either way.
🔶 SETTINGS
- Swing and internal structure lengths, structure events to keep.
- Order blocks: origin candle lookback and zones to keep.
- Fair value gaps: minimum size, inversion tracking, gaps to keep (drawing off by default).
- Liquidity: equal level tolerance and levels to keep.
- Premium and discount map with adjustable extension.
- Zone tap signals and signals to keep.
- All chart colors, plus a fully themeable dashboard: position, four text sizes, title band, background, frame, grid, and three text colors.
🔶 ALERTS
- Bullish / Bearish Break of Structure
- Bullish / Bearish Change of Character
- Buy-Side / Sell-Side Liquidity Sweep
- Demand Zone Tap / Supply Zone Tap (score-stamped)
- Fair Value Gap Inversion
🔶 FREQUENTLY ASKED QUESTIONS
Does the indicator repaint? No. Structure events, sweeps, inversions, and signals are evaluated on closed bars at confirmed pivots. Pivot confirmation introduces intentional lag equal to the structure length.
What does the Confluence Score mean? It is a transparent sum of five weighted conditions, not a prediction. It measures how much of the smart money checklist is currently aligned — a context meter, not a probability of profit.
Why did an order block disappear? It was mitigated: price closed through it. The engine removes dead zones so the chart only shows levels that still matter.
Why do sweeps print only once at a level? Each swing level carries sweep memory and a cooldown, preventing the duplicate label stacking common in liquidity tools.
Which markets and timeframes work best? All markets with candle data. Higher timeframes produce larger, cleaner structures; the internal tier keeps lower timeframes readable.
🔶 CREDITS
The smart money concepts implemented here — order blocks, fair value gaps, liquidity sweeps, break of structure, change of character, and premium and discount — are trading concepts popularized by the Inner Circle Trader methodology of Michael J. Huddleston, with intellectual roots in the market logic of Richard D. Wyckoff. This script gratefully acknowledges that lineage. The confluence scoring model, the narrative engine, the zone life cycle system, the volume grading, the anti-duplication sweep memory, and all code in this script are original work
🔶 LIMITATIONS
Structure detection is only as good as the chosen pivot lengths; very noisy instruments may need larger values. Volume grading is less meaningful on symbols with unreliable volume reporting. Removed zones are not kept as historical artifacts. The Confluence Score measures alignment, not outcome. No indicator replaces independent analysis.
🔶 DISCLAIMER
This script is provided strictly for educational and informational purposes. It is not financial advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Past behavior of any structure event, zone, or signal does not guarantee future results. Trading involves substantial risk. Always do your own research and manage risk independently.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
The institutional Edge: Indicators, Strategies & a Free Academy. quantum-algo.com
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
The institutional Edge: Indicators, Strategies & a Free Academy. quantum-algo.com
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.