OPEN-SOURCE SCRIPT
Smart Liquidity & Trend Engine V9.0

Overview
The Smart Liquidity & Trend Engine is a systematic trading tool designed to dynamically identify high-probability reversal and continuation zones. Instead of relying on static support/resistance levels or traditional pivot points, this script utilizes a custom Weighted Multi-Timeframe Fractal Clustering Algorithm combined with momentum-based execution triggers. It is explicitly engineered for day traders and scalpers (particularly on XAUUSD and Forex pairs) who look for institutional liquidity sweeps followed by strong directional displacement.
► Originality & Core Concepts (How it works under the hood)
Most standard Support/Resistance indicators plot lines at every single pivot, creating chart clutter. This script solves that through a mathematical clustering approach:
Weighted Fractal Engine: The script simultaneously scans for fractals on the current Timeframe (LTF, weight = 1) and a Higher Timeframe (HTF, weight = 3).
ATR-Based Clustering: When multiple fractals form within a predefined price proximity (calculated using an ATR Multiplier), they are merged into a single "Liquidity Zone".
Strength Scoring (Lv.1 to Lv.5): As more fractals cluster into the same ATR threshold, the zone's score increases. A minimum score (default: 3) is required to validate a zone. An HTF fractal (3 pts) instantly creates a valid zone, while it takes three independent LTF fractals (1+1+1) to validate the same area.
Invalidation (Ghost Zones): Support/Resistance is not permanent. Once a candle physically closes beyond the upper/lower bounds of a Liquidity Zone, the zone is immediately invalidated, marked as a "Ghost," and stops participating in future signal calculations.
► Signal Execution Logic (How signals are generated)
This script does not print signals simply because the price touches a zone. It requires a sequence of events:
The "TAP" Signal (Preparation): Occurs when the price wicks into or touches a valid Liquidity Zone but respects the boundary. This indicates a potential liquidity grab or mitigation.
The "Diamond 💎" Signal (Execution): This is the ultimate entry trigger. It only prints when ALL the following conditions are met simultaneously:
Proximity: The price must be near an active Liquidity Zone (filtered by maximum ATR distance to prevent chasing late entries).
Momentum Confirmation: There must be a valid price action event—either a strong directional displacement (where the candle body is strictly greater than ATR * Displacement Multiplier) OR a valid Engulfing pattern.
Trend Alignment (Binary EMA): The signal must align with the macro trend. The trend is NOT determined by EMA crossovers, but strictly by the Slope (ta.rising/ta.falling) of the Slow EMA (default 200).
V-Reversal Override (Counter-Trend Exception): If the price drops into an incredibly strong historical zone (e.g., Strength >= 6 / Lv.4), the script allows a counter-trend Diamond signal to print, capturing aggressive V-shaped bottoms/tops at major HTF levels.
► How to Use It
Timeframe Selection: The script works beautifully on lower timeframes (e.g., M5, M15). By default, the HTF parameter is set to Manual (60 mins), meaning your M5 chart will automatically weigh H1 pivot levels heavily. You can also toggle "Auto HTF" to let the script maintain a dynamic 4x-12x timeframe multiplier.
Trade Execution:
Wait for a price approach towards a deeply colored box (Lv.3 to Lv.5).
Look for a TAP label to confirm the zone is being tested.
Do NOT enter immediately. Wait for the 💎 Diamond shape to appear, which confirms that momentum has stepped in (Displacement/Engulfing) to push the price away from the liquidity zone.
Set your Stop Loss just outside the tested Liquidity Zone or Ghost Zone.
Session Filtering: For optimal volatility, utilize the built-in Session Filter (e.g., New York session) to only receive alerts during high-volume hours.
(Disclaimer: This script is for educational and analytical purposes only. Past performance does not guarantee future results. Always use proper risk management.)
The Smart Liquidity & Trend Engine is a systematic trading tool designed to dynamically identify high-probability reversal and continuation zones. Instead of relying on static support/resistance levels or traditional pivot points, this script utilizes a custom Weighted Multi-Timeframe Fractal Clustering Algorithm combined with momentum-based execution triggers. It is explicitly engineered for day traders and scalpers (particularly on XAUUSD and Forex pairs) who look for institutional liquidity sweeps followed by strong directional displacement.
► Originality & Core Concepts (How it works under the hood)
Most standard Support/Resistance indicators plot lines at every single pivot, creating chart clutter. This script solves that through a mathematical clustering approach:
Weighted Fractal Engine: The script simultaneously scans for fractals on the current Timeframe (LTF, weight = 1) and a Higher Timeframe (HTF, weight = 3).
ATR-Based Clustering: When multiple fractals form within a predefined price proximity (calculated using an ATR Multiplier), they are merged into a single "Liquidity Zone".
Strength Scoring (Lv.1 to Lv.5): As more fractals cluster into the same ATR threshold, the zone's score increases. A minimum score (default: 3) is required to validate a zone. An HTF fractal (3 pts) instantly creates a valid zone, while it takes three independent LTF fractals (1+1+1) to validate the same area.
Invalidation (Ghost Zones): Support/Resistance is not permanent. Once a candle physically closes beyond the upper/lower bounds of a Liquidity Zone, the zone is immediately invalidated, marked as a "Ghost," and stops participating in future signal calculations.
► Signal Execution Logic (How signals are generated)
This script does not print signals simply because the price touches a zone. It requires a sequence of events:
The "TAP" Signal (Preparation): Occurs when the price wicks into or touches a valid Liquidity Zone but respects the boundary. This indicates a potential liquidity grab or mitigation.
The "Diamond 💎" Signal (Execution): This is the ultimate entry trigger. It only prints when ALL the following conditions are met simultaneously:
Proximity: The price must be near an active Liquidity Zone (filtered by maximum ATR distance to prevent chasing late entries).
Momentum Confirmation: There must be a valid price action event—either a strong directional displacement (where the candle body is strictly greater than ATR * Displacement Multiplier) OR a valid Engulfing pattern.
Trend Alignment (Binary EMA): The signal must align with the macro trend. The trend is NOT determined by EMA crossovers, but strictly by the Slope (ta.rising/ta.falling) of the Slow EMA (default 200).
V-Reversal Override (Counter-Trend Exception): If the price drops into an incredibly strong historical zone (e.g., Strength >= 6 / Lv.4), the script allows a counter-trend Diamond signal to print, capturing aggressive V-shaped bottoms/tops at major HTF levels.
► How to Use It
Timeframe Selection: The script works beautifully on lower timeframes (e.g., M5, M15). By default, the HTF parameter is set to Manual (60 mins), meaning your M5 chart will automatically weigh H1 pivot levels heavily. You can also toggle "Auto HTF" to let the script maintain a dynamic 4x-12x timeframe multiplier.
Trade Execution:
Wait for a price approach towards a deeply colored box (Lv.3 to Lv.5).
Look for a TAP label to confirm the zone is being tested.
Do NOT enter immediately. Wait for the 💎 Diamond shape to appear, which confirms that momentum has stepped in (Displacement/Engulfing) to push the price away from the liquidity zone.
Set your Stop Loss just outside the tested Liquidity Zone or Ghost Zone.
Session Filtering: For optimal volatility, utilize the built-in Session Filter (e.g., New York session) to only receive alerts during high-volume hours.
(Disclaimer: This script is for educational and analytical purposes only. Past performance does not guarantee future results. Always use proper risk management.)
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.