OPEN-SOURCE SCRIPT
تم تحديثه

Consolidation Tracker

172
🧭 Consolidation Tracker — Visualize Market Reversals in Real Time
The Consolidation Tracker is a minimalist yet powerful tool designed to map the anatomy of market reversals and trend transitions. It highlights the structural evolution of price through four key phases, helping traders anticipate shifts with clarity and confidence.

🔄 The Four Stages of a Market Reversal:
Failure to Displace — Price fails to break beyond recent highs or lows, signaling potential exhaustion of the current trend.

Consolidation (CAMP) — A range-bound phase where price compresses between a dynamic high and low. These zones are shaded gray, representing indecision and balance.

Engulfing (ENGULF) — A decisive candle closes beyond the CAMP high or low, suggesting a directional shift. These are highlighted in orange.

Fair Value Gap (FVG) — A three-candle pattern forms a price imbalance. If this FVG also engulfs the CAMP range, it confirms the reversal and resets the CAMP. Bullish FVGs are shaded green, bearish FVGs in red.

🔁 From Reversal to Trend:
Once a reversal is confirmed via an FVG, the market often transitions into a trend cycle characterized by:

Displacement — Strong directional movement away from the prior range.

Fair Value Gaps — Continuation imbalances that offer high-probability entries on retracements.

🧠 How It Works:
The indicator dynamically tracks CAMP highs and lows, updating only when a candle engulfs the range or a valid FVG forms.

FVGs are detected when a three-candle sequence creates a gap between candle 2 and 0, and the middle candle (candle 1) breaks the CAMP boundary.

CAMP levels are plotted as horizontal lines, while background colors narrate the evolving structure in real time.

This tool is ideal for traders who value market structure, price efficiency, and narrative clarity. Whether you're anticipating reversals or riding trends, the Consolidation Tracker offers a clean, actionable lens into price behavior.
ملاحظات الأخبار
🛠️ Update: Consolidation Tracker v2.1
What's New:

HTF CAMP Boundaries Added You can now overlay higher timeframe CAMP levels for multi-horizon structural awareness. The HTF timeframe is configurable, with a default set to 16× your current chart resolution. Toggle visibility via the new Show HTF CAMP Levels input.

Refined ENGULF Logic We've separated ENGULF detection into two distinct triggers:

High/Low Breach: Updates the CAMP boundary silently when price exceeds the current range.

Close Breach: Triggers visual highlights (orange bgcolor) only when the candle closes outside the CAMP range.

This change improves clarity by distinguishing structural updates from actionable breakout signals, making the indicator more expressive and precise.
ملاحظات الأخبار
🛠️ Update: Consolidation Tracker v2.2
What's New:

Refined Fair Value Gap Logic Fair Value Gaps (FVGs) now require a closing displacement through the CAMP boundary to be valid.

A bullish FVG must close above the CAMP high.

A bearish FVG must close below the CAMP low.

This change filters out weak or indecisive gaps and ensures that only structurally confirmed imbalances are counted. It improves signal quality by aligning FVG detection with true directional intent.
ملاحظات الأخبار
🔄 HTF Regime Logic Overhaul
Directional Memory Added: Introduced htfHighLastDir and htfLowLastDir to track the direction ("up" or "down") of the last update for each HTF CAMP line.

Staggered Regime Confirmation: Regime now shifts when one line updates and the last update of the other line was in the same direction — enabling delayed transitions (e.g., high drops, then low drops later → bearish).

Persistent Regime State: Regime (htfRegime) persists until a confirmed directional match, avoiding false resets to neutral.

🧱 HTF Fill Logic Refined
Non-overlapping Fill Zones: HTF shading now respects LTF CAMP boundaries:

Fills only above LTF high if htfHigh > campHigh

Fills only below LTF low if htfLow < campLow

Removed Full HTF Fill: Deprecated fill(htfHighPlot, htfLowPlot) to prevent HTF shading from obscuring LTF structure.

🎨 Visual Clarity Improvements
Layering Preserved: LTF CAMP fills always render on top of HTF fills for clearer structural interpretation.

Neutral Regime Coloring: Gray fill used when regime is unconfirmed or mixed, maintaining visual neutrality.
ملاحظات الأخبار
📘 Consolidation Tracker Changelog
🧠 HTF Timeframe Selection
Auto HTF Option Added: Introduced useAutoHTF checkbox to toggle between manual and automatic HTF selection.

Auto HTF Mapping Logic: Automatically selects HTF as 16× the chart timeframe using a validated mapping of Pine-compatible strings (e.g., "15" → "240", "D" → "16D").

Fallback Protection: Ensures valid HTF string is always passed to request.security() to prevent runtime errors.
ملاحظات الأخبار
📘 CAMP Logic Update
More Responsive to Price Action: CAMP levels now react to both fair value gaps (FVGs) and directional breaches, even if they happen close together.

No Missed Breakouts: A strong move that breaches a prior high or low will now update the CAMP level, even if an FVG was already detected — ensuring key shifts aren't ignored.

Sharper Structural Tracking: This makes the overlay more sensitive to evolving price structure, especially in fast-moving or volatile zones where multiple signals may stack.
ملاحظات الأخبار
🎯 Looser FVG Qualification for Tighter CAMPs
Broader FVG Detection: The fair value gap (FVG) condition now checks for a prior close beyond the CAMP boundary two bars back, rather than requiring the current close to break out.

More Frequent CAMP Updates: This allows the overlay to recognize more subtle structural imbalances, leading to more responsive and timely CAMP high/low adjustments.

Tighter Structural Zones: By accepting a wider range of valid FVGs, CAMP levels adapt more quickly to evolving price action, helping to better frame emerging consolidation and breakout zones.
ملاحظات الأخبار
🔄 FVG-Driven CAMP Tightening
Direct High/Low Assignment on FVG: When a fair value gap (FVG) is detected, CAMP high and low now update directly to the current bar’s high and low, rather than referencing prior bars.

Sharper Zone Anchoring: This change makes CAMP boundaries more reactive to fresh structural imbalances, anchoring levels to the most recent decisive move.

Tighter Consolidation Framing: By using the current bar’s extremes, CAMP zones become more compact and precise — ideal for tracking breakout setups and regime transitions with greater clarity.

إخلاء المسؤولية

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.