Liquidity Sweep Retracements [MarkitTick]💡An advanced analytical framework designed to decode market micro-structure by evaluating the depth, speed, and statistical probability of price pullbacks. Rather than relying solely on static Fibonacci levels, this tool dynamically tracks the historical characteristics of an asset's swing behavior, alerting the user to structural anomalies and shifts in momentum. By intersecting retracement analysis with liquidity sweep detection and a built-in heatmap, this framework offers a comprehensive lens into market behavior, isolating environments where trend continuation is highly probable versus areas prone to exhaustion.
✨ Originality and Utility
Standard market analysis often relies on rigid tools that do not adapt to changing volatility conditions. This script introduces a highly original dynamic evaluation method by actively saving the characteristics of recent price swings into an internal array and establishing a moving statistical baseline.
The primary utility of this script lies in its multidimensional analysis. It does not just measure how far price has pulled back; it calculates how fast the pullback occurred and compares this velocity to the asset's recent historical baseline. This enables the framework to categorize price action not merely as a "pullback," but as a statistically significant "Anomaly" or an "Aggressive" move. Furthermore, by weaving Higher Timeframe (HTF) trend alignments and localized liquidity sweep detections into a single, cohesive dashboard and visual charting environment, it reduces chart clutter while exponentially increasing the depth of available data.
🔬 Methodology and Concepts
● Swing Structuring and Pivot Detection
The foundational logic relies on identifying structural pivot highs and lows through a localized lookback and look-forward window. The algorithm requires a definitive peak or trough isolated by user-defined left and right bars, establishing the anchor points for all subsequent mathematical measurements.
● Dynamic Retracement Scoring
Once a swing structure is confirmed, the script calculates the exact percentage of the retracement relative to the preceding impulse. These percentages are continuously categorized into defined behavioral zones:
Impulse (Less than 23%)
Shallow (Less than 38%)
Healthy (Up to 61.8%)
Deep (Up to 78.6%)
Reversal (Beyond 78.6%)
● Retracement Momentum Velocity (RMV)
Time and price are merged to extract velocity. By dividing the total percentage of the retracement by the number of bars it took to form, the script generates a velocity reading. This reading is dynamically compared against an array of historical velocities to determine if the current counter-trend move is unusually aggressive.
● Statistical Anomaly Detection
The script manages historical arrays of past retracement data, calculating a rolling mean (average) and standard deviation. An anomaly is triggered when a live retracement deviates significantly from this moving baseline, determined by a user-defined standard deviation multiplier. This mathematically highlights structural shifts before they mature into full trend reversals.
● Liquidity Sweep Verification
The indicator actively monitors price interactions with localized structural extremes. A bullish sweep occurs when price pierces a recent significant low but closes decisively above it, creating a structural trap. Bearish sweeps apply the inverse logic to structural highs.
🎨 Visual Guide
● Heatmap Candles
The script overrides standard candle colors with a dynamic heatmap that visually translates the health and speed of the current retracement:
Green indicates a healthy, standard retracement zone.
Orange highlights a weak zone, suggesting the trend is losing foundational strength.
Red warns of a deep structural violation bordering on a reversal.
Purple explicitly signifies an aggressive Retracement Momentum Velocity (RMV), warning of high counter-trend momentum.
● Price Action Overlays and Labels
Pivot Highs and Lows are marked precisely with small red and green crosses. (Note: These appear retroactively once the defined right-side bars confirm the pivot).
Data Labels are plotted at swing extremes. These carry a dark blue-gray background with dynamic text colors. They display the exact retracement percentage alongside quality badges, anomaly alerts (orange for opportunity, red for danger), and RMV warnings.
● Liquidity Markers
When a sweep is detected, small distinct shapes appear. "LS" text markers are plotted in bright green below bullish sweeps and bright red above bearish sweeps, visually anchoring liquidity traps directly onto the price action.
● The Analytical Dashboard
Located in the top right corner, this panel serves as the central intelligence hub. It utilizes shaded backgrounds to organize critical data natively on the chart.
Retracement and Health bars utilize block characters (█/░) to visualize strength out of 100%.
HTF Alignment displays the macro bias via clear text and color codes (Green for Bullish, Red for Bearish).
The dashboard aggregates averages, velocities, and quality metrics into a readable, high-contrast matrix.
📌 Note : the best way to resolve visual overlap is to navigate to the Object Tree and drag the indicator above the main chart layer, or simply hide the native candles in your chart settings.
📖 How to Use
Traders should monitor the dynamic relationship between the visual candle heatmap and the dashboard metrics.
Trend Continuation: Look for retracements that remain within the "Healthy" or "Shallow" zones (highlighted by green candles and positive dashboard health scores) that align with a bullish HTF signal.
Anomaly Exploitation: If an anomaly label appears marking a shallow retracement (orange text warning), this historically suggests an unusually strong impulse where standard deep pullbacks may not materialize.
Exhaustion Warnings: If the candles shift to purple, indicating an RMV Aggressive state, the counter-trend velocity is statistically high. Traders may use this to delay entries until momentum normalizes, or to identify structural traps if this aggression ends in a marked Liquidity Sweep (LS marker).
⚙️ Inputs and Settings
• Swing Settings
Controls the sensitivity of pivot detection. Higher values filter out market noise for major swing structures, while lower values react quickly to micro-trends.
• Retracement and Anomaly Parameters
Dictates the maximum number of historical retracements held in the memory array. The Standard Deviation Threshold allows users to expand or contract the mathematical boundary for what qualifies as an anomaly.
• RMV (Velocity) Limits
Controls the aggression threshold. Adjusting the multiplier determines how much faster a retracement must be compared to the historical average to trigger the purple heatmap and aggressive warnings.
• Liquidity Sweeps
Defines the lookback length for identifying local highs and lows that act as liquidity pools.
• Alerts and Dashboard Configuration
Enables fully customizable JSON-formatted alerts based on statistical deviations, and allows users to toggle or completely restyle the visual dashboard and heatmap components.
🔍 Deconstruction of the Underlying Scientific and Academic Framework
This indicator is heavily anchored in statistical mechanics and kinematics principles applied to financial time-series data.
• Gaussian Distribution and Variance
Instead of utilizing fixed geometric sequences (such as the Golden Ratio), the framework treats market swings as a dataset exhibiting normal distribution characteristics. By calculating the variance and extracting the standard deviation of historical swing depths, the script establishes mathematically sound confidence intervals. When price action breaches these standard deviation bands, it represents a statistically significant outlier, formally alerting the user to a fat-tail market event.
• Financial Kinematics
The integration of Retracement Momentum Velocity (RMV) introduces physics-based kinematic principles to price action. In traditional mechanics, velocity is the rate of change of position with respect to a frame of reference. The algorithm defines the frame of reference as the structural swing, calculating velocity as the percentage of displacement per unit of time (bars). By tracking the rolling average of this velocity, the script can algorithmically determine when kinetic energy in a counter-trend direction is statistically abnormal, independent of the actual price level reached.
⚠️ Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. We expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
Pine Script® インジケーター






















