OPEN-SOURCE SCRIPT
Обновлено QML FTB with Quality Score [Malibu]

QML FTB with Quality Score [Malibu]
Overview
QML FTB with Quality Score [Malibu] is an open-source market structure indicator designed to detect Quasimodo (QML) reversal formations and highlight potential First Touch Back (FTB) reaction levels after a confirmed break of structure.
The script is built to be selective rather than frequent. Instead of displaying every possible QML pattern, it filters structure through multiple confluence factors and ranks each setup with a normalized Quality Score. The goal is to help traders focus on cleaner and more meaningful reaction zones rather than treating all reversal structures as equal.
What this indicator does
This indicator scans price action for bullish and bearish Quasimodo formations, confirms the related market structure break, and projects the corresponding left-shoulder area as a potential reaction level.
In practical terms, it is a structure-based reversal and reaction-zone tool that can assist with:
- market structure shifts
- support and resistance transitions
- break-of-structure confirmation
- liquidity-driven reversal analysis
- filtered first-touch retest opportunities
Why this indicator can be useful
Raw QML detection can become noisy because many structures may appear valid at first glance, but not all of them carry the same quality. This script attempts to solve that problem by combining pattern detection with context-based filtering.
Instead of only drawing a shape, it asks additional questions:
- Was the structure break strong enough?
- Is momentum aligned?
- Is there RSI divergence?
- Is there Fair Value Gap confluence?
- Was liquidity swept before the reversal?
- Is the level still fresh and untouched?
That layered process is what makes the script more selective and more practical for traders who prefer structured filtering over raw pattern frequency.
How it works
The script uses a ZigZag-style swing engine to track meaningful highs and lows in price structure. Based on those swings, it evaluates whether the sequence forms a valid Quasimodo transition.
Bullish structure:
- price forms a lower low
- price then breaks the prior key high
- the previous shoulder area becomes the projected bullish QML / FTB level
Bearish structure:
- price forms a higher high
- price then breaks the prior key low
- the previous shoulder area becomes the projected bearish QML / FTB level
Once the structure is identified, the setup can be refined through optional confluence filters. The script then calculates a Quality Score and prints the confirmed level only after bar close.
Filtering logic
1) Body Break Filter
This filter requires the break of structure to happen with candle body confirmation rather than wick-only penetration. Its purpose is to reduce weak or cosmetic breaks and focus on clearer structural shifts.
2) Momentum Filter (EMA)
This filter checks whether the setup is aligned with the broader directional bias using an EMA-based trend condition. Bullish setups are generally stronger when price is positioned in bullish momentum context, while bearish setups are generally stronger when price is positioned in bearish momentum context.
3) RSI Divergence Filter
This filter looks for momentum exhaustion. For bullish setups, it checks whether price pushes lower while RSI fails to confirm that weakness. For bearish setups, it checks the opposite. This is the strictest filter and is meant to isolate higher-selectivity reversal conditions.
4) FVG Confluence
This filter checks whether the projected QML level aligns with a Fair Value Gap area. The aim is to add imbalance context and identify zones where inefficient price delivery may support a reaction.
5) Liquidity Sweep Filter
This filter checks whether the head of the QML structure swept prior liquidity before the reversal. It is meant to capture structural traps and stop-hunt style behavior before a turn.
6) Freshness (FTB) Filter
This filter removes levels that have already been touched or used. Its goal is to keep the focus on first-touch reaction opportunities rather than repeatedly tested zones.
Quality Score logic
The script ranks each setup using a normalized Quality Score.
Current score components:
- RSI Divergence: +30
- FVG Confluence: +25
- Liquidity Sweep: +25
- EMA Momentum Alignment: +20
The total score is normalized according to the filters that are currently active, then displayed as a percentage. This allows the indicator to remain usable even when traders prefer a lighter or stricter filter stack.
What it plots on the chart
The indicator can display:
- a thick horizontal QML entry level
- optional dashed ZigZag structure lines
- bullish and bearish QML labels
- a Quality Score percentage
- an additional symbol when RSI divergence is present
The visual design is intentionally simple so the underlying structure remains readable on chart.
Inputs
ZigZag Sensitivity (default: 13)
Controls how sensitive the swing detection is.
- Lower values produce more swing points and more signals, but also more noise.
- Higher values reduce signal frequency and generally improve selectivity, but can introduce more lag.
Body Break Filter (default: true)
Requires structure breaks to happen with body confirmation.
- Usually lowers signal count
- Usually improves reliability
- Best kept enabled in noisier conditions
Momentum Filter / EMA Filter (default: true)
Restricts setups to those aligned with EMA direction.
- Reduces counter-trend signals
- Makes the script more selective
- Generally improves quality in directional markets
EMA Period (default: 50)
Defines the trend filter length.
- Lower values make the filter more responsive
- Higher values make it smoother and slower
RSI Divergence Filter (default: false)
Allows only setups that also show RSI divergence.
- This is the strictest filter
- Strongly reduces signal frequency
- Best used when only higher-selectivity reversal setups are desired
FVG Confluence (default: true)
Requires the level to align with Fair Value Gap context.
- Filters out some otherwise valid patterns
- Can improve contextual quality in imbalanced markets
Liquidity Sweep Filter (default: true)
Requires evidence of liquidity interaction at the head of the structure.
- Helps isolate trap-like reversal conditions
- Adds selectivity around structural extremes
Freshness (FTB) Filter (default: true)
Rejects previously tested levels.
- Keeps the focus on first-touch setups
- Useful for traders who prefer untouched zones
Line Length (bars) (default: 25)
Controls how far the projected QML level is extended to the right.
- This is a visual setting
- It does not change the signal logic
Which settings matter most
The three most important inputs are:
- ZigZag Sensitivity
- Body Break Filter
- Freshness (FTB) Filter
These settings have the biggest impact on how noisy, selective, and practical the final output becomes.
Suggested usage styles
Balanced / default use
For most users, the default settings are the best place to start. They are designed to provide a practical balance between signal frequency and selectivity.
More aggressive use
For traders who want more setups:
- reduce ZigZag Sensitivity toward 8–10
- consider disabling EMA Filter
- consider disabling FVG Confluence
This can increase opportunity count, but it also increases noise and false positives.
More conservative use
For traders who want fewer but stronger setups:
- keep Body Break Filter enabled
- keep Freshness Filter enabled
- enable RSI Divergence Filter
- focus more on higher-score setups, especially 80%+
This creates a much stricter selection process.
Timeframe behavior
This indicator is generally better suited to M15, H1, H4, and Daily charts.
Suggested sensitivity behavior:
- M15 to H1: 13 to 21 is usually more stable
- H4 to Daily: 8 to 13 is often more responsive without becoming overly delayed
Timeframe notes:
- On M1 and M5, low sensitivity settings can produce excessive noise and weak structure breaks.
- In lower timeframes, Body Break confirmation becomes much more important.
- On higher timeframes, very high sensitivity values can reduce opportunities too much and may introduce unnecessary delay.
Market conditions
The script tends to behave more cleanly in liquid markets where structure is clearer, such as:
- crypto majors
- forex majors
- index products
- other actively traded instruments
In very thin or highly irregular markets, the structural quality of setups may degrade.
Why this indicator may be preferred over simpler alternatives
This script is not intended to be just a basic ZigZag visualizer or a simple Quasimodo marker.
Its main differentiator is the way it combines multiple layers of structure validation into one ranked workflow:
- structure recognition
- body-based break confirmation
- momentum alignment
- divergence context
- FVG context
- liquidity sweep context
- freshness filtering
- normalized quality scoring
Instead of showing every possible shape, it tries to separate weaker structural patterns from more meaningful ones.
What makes this script different
The individual concepts used here are known market-structure concepts, but the practical value of the script comes from how they are combined.
Its distinguishing contribution is the orchestration layer:
- the Quality Score model
- the multi-filter ranking process
- the first-touch freshness workflow
- the compact integration of structure, momentum, liquidity, and imbalance into one decision-support tool
In other words, the script is built on generic market-structure concepts, but its filtering and ranking workflow is specific to this implementation.
How to use it in practice
A common workflow is:
- wait for a level to be confirmed
- monitor the first return into that level
- use the score and filter context to judge whether the setup deserves attention
- avoid treating every printed level as a guaranteed reversal
Many users will find it most useful as a structured decision-support tool rather than as a standalone entry engine.
Technical behavior
- Signals are confirmed on bar close.
- Confirmed levels remain fixed after printing.
- The script does not rely on request.security() in the described signal logic.
- No lookahead-based behavior is used in the signal confirmation process.
- The latest developing pivot may evolve while structure is still forming, but confirmed outputs are only printed after confirmation.
Alerts
The script includes on-close alerts when a new bullish or bearish QML level is confirmed.
Alert messages can include contextual details such as:
- direction
- Quality Score
- divergence state
Limitations
This script is a technical analysis tool, not a prediction engine.
Please keep in mind:
- sideways conditions can generate weaker structural setups
- very low timeframes can create more noise and false breaks
- news-driven volatility can invalidate technical levels quickly
- very low ZigZag Sensitivity settings can make ordinary pullbacks look more important than they really are
- no indicator can guarantee that price will react from every marked level
For that reason, the script is best used as a structured analysis tool rather than as a certainty model.
Overview
QML FTB with Quality Score [Malibu] is an open-source market structure indicator designed to detect Quasimodo (QML) reversal formations and highlight potential First Touch Back (FTB) reaction levels after a confirmed break of structure.
The script is built to be selective rather than frequent. Instead of displaying every possible QML pattern, it filters structure through multiple confluence factors and ranks each setup with a normalized Quality Score. The goal is to help traders focus on cleaner and more meaningful reaction zones rather than treating all reversal structures as equal.
What this indicator does
This indicator scans price action for bullish and bearish Quasimodo formations, confirms the related market structure break, and projects the corresponding left-shoulder area as a potential reaction level.
In practical terms, it is a structure-based reversal and reaction-zone tool that can assist with:
- market structure shifts
- support and resistance transitions
- break-of-structure confirmation
- liquidity-driven reversal analysis
- filtered first-touch retest opportunities
Why this indicator can be useful
Raw QML detection can become noisy because many structures may appear valid at first glance, but not all of them carry the same quality. This script attempts to solve that problem by combining pattern detection with context-based filtering.
Instead of only drawing a shape, it asks additional questions:
- Was the structure break strong enough?
- Is momentum aligned?
- Is there RSI divergence?
- Is there Fair Value Gap confluence?
- Was liquidity swept before the reversal?
- Is the level still fresh and untouched?
That layered process is what makes the script more selective and more practical for traders who prefer structured filtering over raw pattern frequency.
How it works
The script uses a ZigZag-style swing engine to track meaningful highs and lows in price structure. Based on those swings, it evaluates whether the sequence forms a valid Quasimodo transition.
Bullish structure:
- price forms a lower low
- price then breaks the prior key high
- the previous shoulder area becomes the projected bullish QML / FTB level
Bearish structure:
- price forms a higher high
- price then breaks the prior key low
- the previous shoulder area becomes the projected bearish QML / FTB level
Once the structure is identified, the setup can be refined through optional confluence filters. The script then calculates a Quality Score and prints the confirmed level only after bar close.
Filtering logic
1) Body Break Filter
This filter requires the break of structure to happen with candle body confirmation rather than wick-only penetration. Its purpose is to reduce weak or cosmetic breaks and focus on clearer structural shifts.
2) Momentum Filter (EMA)
This filter checks whether the setup is aligned with the broader directional bias using an EMA-based trend condition. Bullish setups are generally stronger when price is positioned in bullish momentum context, while bearish setups are generally stronger when price is positioned in bearish momentum context.
3) RSI Divergence Filter
This filter looks for momentum exhaustion. For bullish setups, it checks whether price pushes lower while RSI fails to confirm that weakness. For bearish setups, it checks the opposite. This is the strictest filter and is meant to isolate higher-selectivity reversal conditions.
4) FVG Confluence
This filter checks whether the projected QML level aligns with a Fair Value Gap area. The aim is to add imbalance context and identify zones where inefficient price delivery may support a reaction.
5) Liquidity Sweep Filter
This filter checks whether the head of the QML structure swept prior liquidity before the reversal. It is meant to capture structural traps and stop-hunt style behavior before a turn.
6) Freshness (FTB) Filter
This filter removes levels that have already been touched or used. Its goal is to keep the focus on first-touch reaction opportunities rather than repeatedly tested zones.
Quality Score logic
The script ranks each setup using a normalized Quality Score.
Current score components:
- RSI Divergence: +30
- FVG Confluence: +25
- Liquidity Sweep: +25
- EMA Momentum Alignment: +20
The total score is normalized according to the filters that are currently active, then displayed as a percentage. This allows the indicator to remain usable even when traders prefer a lighter or stricter filter stack.
What it plots on the chart
The indicator can display:
- a thick horizontal QML entry level
- optional dashed ZigZag structure lines
- bullish and bearish QML labels
- a Quality Score percentage
- an additional symbol when RSI divergence is present
The visual design is intentionally simple so the underlying structure remains readable on chart.
Inputs
ZigZag Sensitivity (default: 13)
Controls how sensitive the swing detection is.
- Lower values produce more swing points and more signals, but also more noise.
- Higher values reduce signal frequency and generally improve selectivity, but can introduce more lag.
Body Break Filter (default: true)
Requires structure breaks to happen with body confirmation.
- Usually lowers signal count
- Usually improves reliability
- Best kept enabled in noisier conditions
Momentum Filter / EMA Filter (default: true)
Restricts setups to those aligned with EMA direction.
- Reduces counter-trend signals
- Makes the script more selective
- Generally improves quality in directional markets
EMA Period (default: 50)
Defines the trend filter length.
- Lower values make the filter more responsive
- Higher values make it smoother and slower
RSI Divergence Filter (default: false)
Allows only setups that also show RSI divergence.
- This is the strictest filter
- Strongly reduces signal frequency
- Best used when only higher-selectivity reversal setups are desired
FVG Confluence (default: true)
Requires the level to align with Fair Value Gap context.
- Filters out some otherwise valid patterns
- Can improve contextual quality in imbalanced markets
Liquidity Sweep Filter (default: true)
Requires evidence of liquidity interaction at the head of the structure.
- Helps isolate trap-like reversal conditions
- Adds selectivity around structural extremes
Freshness (FTB) Filter (default: true)
Rejects previously tested levels.
- Keeps the focus on first-touch setups
- Useful for traders who prefer untouched zones
Line Length (bars) (default: 25)
Controls how far the projected QML level is extended to the right.
- This is a visual setting
- It does not change the signal logic
Which settings matter most
The three most important inputs are:
- ZigZag Sensitivity
- Body Break Filter
- Freshness (FTB) Filter
These settings have the biggest impact on how noisy, selective, and practical the final output becomes.
Suggested usage styles
Balanced / default use
For most users, the default settings are the best place to start. They are designed to provide a practical balance between signal frequency and selectivity.
More aggressive use
For traders who want more setups:
- reduce ZigZag Sensitivity toward 8–10
- consider disabling EMA Filter
- consider disabling FVG Confluence
This can increase opportunity count, but it also increases noise and false positives.
More conservative use
For traders who want fewer but stronger setups:
- keep Body Break Filter enabled
- keep Freshness Filter enabled
- enable RSI Divergence Filter
- focus more on higher-score setups, especially 80%+
This creates a much stricter selection process.
Timeframe behavior
This indicator is generally better suited to M15, H1, H4, and Daily charts.
Suggested sensitivity behavior:
- M15 to H1: 13 to 21 is usually more stable
- H4 to Daily: 8 to 13 is often more responsive without becoming overly delayed
Timeframe notes:
- On M1 and M5, low sensitivity settings can produce excessive noise and weak structure breaks.
- In lower timeframes, Body Break confirmation becomes much more important.
- On higher timeframes, very high sensitivity values can reduce opportunities too much and may introduce unnecessary delay.
Market conditions
The script tends to behave more cleanly in liquid markets where structure is clearer, such as:
- crypto majors
- forex majors
- index products
- other actively traded instruments
In very thin or highly irregular markets, the structural quality of setups may degrade.
Why this indicator may be preferred over simpler alternatives
This script is not intended to be just a basic ZigZag visualizer or a simple Quasimodo marker.
Its main differentiator is the way it combines multiple layers of structure validation into one ranked workflow:
- structure recognition
- body-based break confirmation
- momentum alignment
- divergence context
- FVG context
- liquidity sweep context
- freshness filtering
- normalized quality scoring
Instead of showing every possible shape, it tries to separate weaker structural patterns from more meaningful ones.
What makes this script different
The individual concepts used here are known market-structure concepts, but the practical value of the script comes from how they are combined.
Its distinguishing contribution is the orchestration layer:
- the Quality Score model
- the multi-filter ranking process
- the first-touch freshness workflow
- the compact integration of structure, momentum, liquidity, and imbalance into one decision-support tool
In other words, the script is built on generic market-structure concepts, but its filtering and ranking workflow is specific to this implementation.
How to use it in practice
A common workflow is:
- wait for a level to be confirmed
- monitor the first return into that level
- use the score and filter context to judge whether the setup deserves attention
- avoid treating every printed level as a guaranteed reversal
Many users will find it most useful as a structured decision-support tool rather than as a standalone entry engine.
Technical behavior
- Signals are confirmed on bar close.
- Confirmed levels remain fixed after printing.
- The script does not rely on request.security() in the described signal logic.
- No lookahead-based behavior is used in the signal confirmation process.
- The latest developing pivot may evolve while structure is still forming, but confirmed outputs are only printed after confirmation.
Alerts
The script includes on-close alerts when a new bullish or bearish QML level is confirmed.
Alert messages can include contextual details such as:
- direction
- Quality Score
- divergence state
Limitations
This script is a technical analysis tool, not a prediction engine.
Please keep in mind:
- sideways conditions can generate weaker structural setups
- very low timeframes can create more noise and false breaks
- news-driven volatility can invalidate technical levels quickly
- very low ZigZag Sensitivity settings can make ordinary pullbacks look more important than they really are
- no indicator can guarantee that price will react from every marked level
For that reason, the script is best used as a structured analysis tool rather than as a certainty model.
Информация о релизе
V2 Quality UpdateThis update keeps the original indicator name and core QML logic, but improves signal quality, filtering, and chart performance.
What changed:
- Added Signal Mode
Structure mode keeps the original behavior and triggers when the QML structure is confirmed.
First Touch Back mode waits for price to return to the QML level before triggering a signal.
- Added optional strict filters
FVG and Liquidity can now be used as real signal requirements, not only as quality score factors.
- Improved LTF/HTF behavior
Lookback windows are now more adaptive across different timeframes, helping the indicator behave more consistently on lower and higher timeframes.
- Improved drawing management
Historical lines and labels are now limited to reduce chart lag, especially on lower timeframes.
- Improved quality scoring
Disabled filters no longer reduce the quality score unnecessarily.
Expected behavior:
The default Structure mode should remain close to the previous version, but cleaner and lighter. First Touch Back mode will usually produce fewer signals, but those signals are expected to be more selective because they wait for the actual retest of the QML level.
For stricter setups, enable Require FVG and/or Require Liquidity Sweep.
Информация о релизе
V3 Quality UpdateThis update is not a cosmetic revision. It changes the script in three important areas: structure validation, confluence scoring, and signal workflow.
Continuous Quality Scoring
The previous version used a simple boolean-style scoring model, where filters contributed fixed values. In v2.4, each component now produces a continuous quality score. FVG size and freshness, liquidity sweep depth and touch count, and volume participation are evaluated on a graded scale. This results in more granular and more realistic signal ranking.
Multi-Queue First Touch Back Logic
The previous version could only keep one pending FTB setup at a time. In v2.4, pending setups are handled with array-based queues, so multiple levels can remain active simultaneously. A staleness timeout was also added to expire untouched setups after a defined window.
Head Body Validation
Earlier versions could accept wick-only spikes as valid head pivots. The new version requires the candle body to confirm the break beyond the reference level. This reduces false positives caused by isolated wick excursions.
Left Shoulder Fibonacci Validation
The previous version did not enforce a minimum retracement depth for the left shoulder. In v2.4, the left shoulder must retrace at least 38.2% of the prior swing, filtering out shallow and structurally weaker formations.
Higher Timeframe Bias Filter
A new HTF bias filter was added using EMA50/EMA200 alignment on the higher timeframe. It supports Hard Gate, Soft Gate, and Score Only modes, allowing the user to control how strongly higher-timeframe direction affects signal qualification.
Volatility Regime Filter
A new regime filter was added using ADX and ATR conditions to classify market context as trending, ranging, volatile, or compressed. This allows the script to either suppress or down-rank signals during less favorable environments.
Stronger Reclaim Confirmation
Reclaim confirmation is now stricter. Instead of relying only on the close, the reclaim can require both the open and close to finish beyond the QML level, reducing wick-based reclaim noise.
Liquidity Pool Tracking Improvements
Liquidity pools are no longer treated as static boolean checks. Pools are now tracked over time, including sweep state, touch count, and sweep depth, which also feeds into the scoring model.
FVG Mitigation Tracking
Fair value gaps are now monitored for mitigation status. Only active, unmitigated FVGs contribute to confluence, which improves the relevance of the filter.
Combined Signal Mode
A new Both mode allows the script to emit the initial structure signal while also keeping the same setup in the FTB workflow. This gives more flexibility without forcing the user to choose only one signal style.
In short, the earlier version was a simpler QML detector with mostly boolean filters. Version 2.4 moves toward a more selective and context-aware framework with stronger validation, graded confluence scoring, and more robust pending signal management.
Информация о релизе
V3 Update NotesThis update focuses on improving the QML FTB engine with a cleaner user interface, stronger structure validation, and better visual clarity.
What’s new:
- Added a simplified input layout for a cleaner user experience.
- Added Strictness Presets: Loose, Balanced, and Strict.
- Added QML Zone support with Line, ATR Zone, Wick Zone, and Body Zone modes.
- Added FTB Confirmation Modes: Touch Only, Wick Rejection, Close Reclaim, and Displacement Confirmation.
- Added flexible invalidation modes: Wick Beyond Head, Close Beyond Head, ATR Buffer, and Zone Close.
- Added BOS confirmation as part of the QML validation process.
- Added BOS Timeout to avoid outdated structure completion.
- Added grade-based quality labels in alerts: A+, A, B, C, and Low.
- Added sweep marks to show where liquidity was swept.
- Added label collision prevention for cleaner chart readability.
- Added dedicated invalidation alerts for bullish and bearish QML structures.
Improvements:
- Rebuilt the swing detection engine using confirmed chronological swing points.
- Improved QML structure validation with sweep, BOS, FVG, volume, RSI divergence, HTF bias, and regime scoring.
- Improved First Touch Back logic with more precise reaction requirements.
- Improved liquidity sweep scoring with both direct sweep and liquidity pool checks.
- Improved FVG scoring by linking FVGs more closely to the QML structure window.
- Simplified HTF bias handling.
- Internalized many advanced technical settings to reduce input clutter.
- Improved visual management with QML zones, BOS lines, sweep marks, and cleaner default visuals.
Important note:
Because this version changes the swing engine, BOS confirmation, FTB logic, invalidation rules, and quality scoring model, detected structures may differ from older versions. This is expected.
This indicator is designed for educational and analytical use. It does not provide financial advice, trade entries, stop-loss levels, take-profit levels, or performance guarantees.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
💎Get instant access here:
malibuta.com/
malibuta.com/
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
💎Get instant access here:
malibuta.com/
malibuta.com/
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.