OPEN-SOURCE SCRIPT
SMC Supply & Demand Probability Engine (Legacy Open Source)

DESCRIPTION:
Introduction
Welcome to the Legacy Open Source Edition of the SMC Supply & Demand Probability Engine. In the spirit of contributing to the Pine Script community, I have decided to open the source code of this previous iteration (V16) completely. This allows developers and advanced traders to study, modify, and dissect the underlying array-based logic and scoring mechanics.
Please note that this is a legacy version. For our highly optimized, distraction-free execution engine, check out the newly released SMC PRO (V18) and SMC PRO MAX (V19) on my profile.
Core Architecture & Proprietary Logic Inside:
1. Institutional Accumulation Engine (0 - 100%)
Not all demand zones are created equal. This open-source script contains the full logic for calculating institutional buying phases by analyzing 5 specific criteria (scoring up to 20 points each):
a. Sequence: Checks if the demand correctly formed after a supply mitigation.
b. Validity: Ensures the demand zone hasn't been structurally violated.
c. Time-Based Inventory: Measures the duration of the accumulation phase (the longer the base, the stronger the potential expansion).
d. Supply Pressure Absence: Scans for any immediate opposing supply zones that might suppress the price.
e. Pre-BOS Support: Evaluates structural momentum before the breakout.
- Output States: "NO INTEREST" ➔ "PROBING" ➔ "EARLY ACCUM" ➔ "COMMIT" ➔ "EXPANSION".
2. Probability Engine V2 (0 - 100%)
Before entering a trade, the dashboard assesses the setup's win probability based on:
b. Range Quality: Measures the entry position relative to the SMC High/Low logarithmic range.
c. Demand Distance: Proximity of the entry to the absolute bottom of the demand zone.
d. Supply Risk: Detects immediate danger areas (Supply Near EX) that could act as roadblocks.
e. Momentum Continuity: Ensures the trend aligns with the structural break.
3. Advanced Trade Management & Auto-Killswitch
- Dynamic TP & SL: Calculates Take Profit levels using Logarithmic Fibonacci scaling to map targets accurately on chart visualizations.
- Auto-Killswitch Protection: If the calculated Risk:Reward ratio for TP2 falls below 0.60 due to a massive stop-loss distance, the script will automatically invalidate the setup.
- Scale-In (Avg Up) Protocol: Identifies opportunities to add to a winning position once the structure confirms momentum, complete with a visual "Danger Area" risk box (±25% risk boundary).
How to Read the Legacy Dashboard
- SIDE & ACCUM: Direction of the trade and the current institutional accumulation percentage.
- ENTRY & SL: Exact price levels for execution and protection.
- TP (Skip Aware): Dynamic targets based on Logarithmic Fibonacci extensions.
- CONFIDENCE & PROBABILITY: A star-rating system (1 to 5 stars) interpreting the setup's strength.
- STATUS & ACTION: Tells you exactly what stage the trade is in ("WAIT", "ACTIVE", "AVG UP").
Usage Note
As this code is now fully Open Source, feel free to use snippets for your own Pine Script utilities. Always use strict risk management. Past performance mapped by the script does not guarantee future market behavior.
Introduction
Welcome to the Legacy Open Source Edition of the SMC Supply & Demand Probability Engine. In the spirit of contributing to the Pine Script community, I have decided to open the source code of this previous iteration (V16) completely. This allows developers and advanced traders to study, modify, and dissect the underlying array-based logic and scoring mechanics.
Please note that this is a legacy version. For our highly optimized, distraction-free execution engine, check out the newly released SMC PRO (V18) and SMC PRO MAX (V19) on my profile.
Core Architecture & Proprietary Logic Inside:
1. Institutional Accumulation Engine (0 - 100%)
Not all demand zones are created equal. This open-source script contains the full logic for calculating institutional buying phases by analyzing 5 specific criteria (scoring up to 20 points each):
a. Sequence: Checks if the demand correctly formed after a supply mitigation.
b. Validity: Ensures the demand zone hasn't been structurally violated.
c. Time-Based Inventory: Measures the duration of the accumulation phase (the longer the base, the stronger the potential expansion).
d. Supply Pressure Absence: Scans for any immediate opposing supply zones that might suppress the price.
e. Pre-BOS Support: Evaluates structural momentum before the breakout.
- Output States: "NO INTEREST" ➔ "PROBING" ➔ "EARLY ACCUM" ➔ "COMMIT" ➔ "EXPANSION".
2. Probability Engine V2 (0 - 100%)
Before entering a trade, the dashboard assesses the setup's win probability based on:
b. Range Quality: Measures the entry position relative to the SMC High/Low logarithmic range.
c. Demand Distance: Proximity of the entry to the absolute bottom of the demand zone.
d. Supply Risk: Detects immediate danger areas (Supply Near EX) that could act as roadblocks.
e. Momentum Continuity: Ensures the trend aligns with the structural break.
3. Advanced Trade Management & Auto-Killswitch
- Dynamic TP & SL: Calculates Take Profit levels using Logarithmic Fibonacci scaling to map targets accurately on chart visualizations.
- Auto-Killswitch Protection: If the calculated Risk:Reward ratio for TP2 falls below 0.60 due to a massive stop-loss distance, the script will automatically invalidate the setup.
- Scale-In (Avg Up) Protocol: Identifies opportunities to add to a winning position once the structure confirms momentum, complete with a visual "Danger Area" risk box (±25% risk boundary).
How to Read the Legacy Dashboard
- SIDE & ACCUM: Direction of the trade and the current institutional accumulation percentage.
- ENTRY & SL: Exact price levels for execution and protection.
- TP (Skip Aware): Dynamic targets based on Logarithmic Fibonacci extensions.
- CONFIDENCE & PROBABILITY: A star-rating system (1 to 5 stars) interpreting the setup's strength.
- STATUS & ACTION: Tells you exactly what stage the trade is in ("WAIT", "ACTIVE", "AVG UP").
Usage Note
As this code is now fully Open Source, feel free to use snippets for your own Pine Script utilities. Always use strict risk management. Past performance mapped by the script does not guarantee future market behavior.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.