OPEN-SOURCE SCRIPT

AlphaX Consolidation Engine Squeeze Detection Breakout Signals

4 442
AlphaX Consolidation Engine — Squeeze Detection, Breakout Signals & Range Intelligence

AlphaX Consolidation Engine is a professional-grade volatility and range analysis system built on a proprietary 5-Factor Consolidation Scoring engine. It identifies low-volatility compression zones, tracks range boundaries in real-time, and delivers high-probability breakout signals governed by institutional-grade confluence filters. Designed for traders who want to capture explosive moves after periods of market calm on instruments like XAUUSD, indices, and forex majors.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📸 Visual Overview


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔬 The Consolidation Engine — How It Works

At the core of AlphaX Consolidation Engine is the 5-Factor Consolidation Score — a proprietary composite metric calculated on every bar to determine if the market is truly compressing or just moving sideways. It evaluates five independent volatility and trend factors:

  • ATR Percentile — Measures if current volatility is historically low compared to recent price action
  • Bollinger Band Width — Detects price compression via narrowing band width percentiles
  • TTM Squeeze — Confirms energy building when Bollinger Bands sit inside Keltner Channels
  • Linear Regression Slope — Mathematically confirms flat price movement (lack of directional bias)
  • ADX Filter — Validates the absence of a strong trend (ranging market confirmation)


Each factor contributes to a score from 0 to 100. When the score exceeds the threshold (default 50), the market is marked as Consolidating.

The system then tracks the Active Range — the high and low boundaries established during the consolidation period. This range is visually displayed as a shaded box with dotted boundary lines.

Consolidation Zone expanding as price compresses — darker shading indicates higher confidence

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Four Signal Layers

AlphaX Consolidation Engine produces four distinct types of signals, each with a specific role in the trade lifecycle:

1 ─ Consolidation Zones (Shaded Boxes)

Shaded boxes with dashed borders marking confirmed consolidation areas

These are not entry signals but context markers. When a box appears, it tells you the market is building energy. The box expands dynamically as the range widens during compression. When the box border changes color (Green for Bull, Red for Bear), it indicates a breakout has occurred.

  • Green Box — Bullish consolidation context
  • Red Box — Bearish consolidation context
  • Gray/Neutral — Forming or weak consolidation


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

2 ─ Breakout Labels ( ▲ / ▼ )

tradingview.com/x/YourScreenshotLink2/
Primary breakout labels appearing when price escapes the consolidation range with confidence

These are the primary entry signals. A label appears when price closes beyond the range boundary with sufficient momentum and volume.

How the breakout is detected:
  • Price closes beyond Range High/Low + ATR Threshold
  • Candle body is strong (no weak wicks)
  • Volume confirms the move (optional filter)
  • Confidence Score meets minimum threshold


Once a breakout label fires, it sets the directional bias. The system then switches from "Range Tracking" mode to "Trend Follow" mode for that specific setup.

  • ▲ Green Label (Bull Breakout) — Dark text on bright green background for maximum readability
  • ▼ Red Label (Bear Breakout) — White text on deep red background for maximum readability


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

3 ─ Retest Entries ( ▲ RETEST / ▼ RETEST )

Secondary entry signals appearing when price pulls back to the breakout level and holds

Breakouts often fake out before continuing. The Retest Engine monitors for price returning to the breakout level (old range high/low) within a configurable window.

  • ▲ RETEST (Teal) — Price pulled back to bull breakout level, held support, and confirmed with bullish candle
  • ▼ RETEST (Light Red) — Price rallied back to bear breakout level, rejected resistance, and confirmed with bearish candle


Retest signals often offer better risk-to-reward than the initial breakout because the stop loss can be placed tighter around the retest candle.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

4 ─ Exit Markers ( ✕ )

Small X marks indicating where the system detects trend exhaustion or reversal — time to consider taking profit

Exit signals appear as small marks and fire only after an entry has occurred. This prevents premature exit markers from cluttering the chart during strong trends.

  • TRAIL — Price hit the dynamic ATR trailing stop
  • FAILED — Price re-entered the original consolidation range (failed breakout)
  • FLIP — Opposite breakout signal fired (trend reversal)


Exit markers indicate that the trade thesis is no longer valid. Use them to close positions or tighten stops manually.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🧠 Multi-Confluence Confidence Scoring

Every breakout signal is scored by a real-time confidence engine that evaluates multiple independent factors and produces a score from 0 to 100. Only signals meeting your configured Min Breakout Confidence % threshold are displayed.

The scoring factors include:

Squeeze Quality (up to 20 points)
  • Was the TTM Squeeze active immediately before breakout?
  • Higher scores for breaks occurring after prolonged squeeze conditions


Consolidation Quality (up to 15 points)
  • How high was the 5-Factor Consolidation Score during the range?
  • Scores higher for "Extreme" or "Strong" consolidation zones vs "Weak" ones


Duration Bonus (up to 10 points)
  • Longer consolidation periods typically yield stronger breakouts
  • Scores increase for ranges lasting >15 bars


Volume Confirmation (up to 15 points)
  • Volume on the breakout bar relative to the 20-bar average
  • Volume bias during consolidation (Accumulation vs Distribution) adds/subtracts points


Momentum Alignment (up to 17 points)
  • MACD Histogram direction and strength
  • EMA Alignment (Fast vs Slow)
  • RSI position (not overextended)


Candle Quality (up to 5 points)
  • Body-to-range ratio of the breakout candle
  • Strong bodies score higher than wicky candles


Penalty Deductions
  • RSI overextension (already too high/low) — up to -8 points
  • Contradicting Volume Bias — up to -12 points
  • EMA against trend — up to -5 points


The default minimum confidence is set to 35% — optimized to filter noise while capturing valid setups. Increase to 50–60% for higher probability but fewer signals.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🛡 Range Intelligence & Volume Bias


Understanding what happened inside the range is key to predicting the breakout direction. AlphaX Consolidation Engine tracks volume flow during consolidation:

  • Accumulation — More bullish volume during consolidation suggests upward breakout probability
  • Distribution — More bearish volume during consolidation suggests downward breakout probability
  • Neutral — Balanced volume suggests a wait-and-see approach


This bias is factored into the Confidence Score. A bullish breakout with bearish accumulation bias receives a penalty, reducing the likelihood of a false signal.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Identifying Choppy / Ranging Markets — When NOT to Trade

Knowing when to stay out is just as important as knowing when to enter. AlphaX Consolidation Engine is designed to help you identify the chop so you can trade the break.

How to identify low-probability conditions:
  • No Consolidation Box — If the 5-Factor Score never reaches threshold, the market is too noisy. No box = no edge.
  • Low Confidence Scores — If breakout labels rarely appear, the market lacks directional conviction.
  • Frequent "FAILED" Exits — If multiple breakouts immediately re-enter the range, the market is still ranging despite brief spikes.
  • Dashboard Shows "NEUTRAL" — If Vol Bias and Momentum are conflicting, wait for clarity.


What to do during low-confidence periods:
  • Do not force entries — wait for the Consolidation Score to rise
  • Wait for the Confidence Score on the breakout label to exceed 50%
  • Look for the Retest signal instead of the initial breakout for better confirmation
  • Consider switching to a higher timeframe to find the broader range structure


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📐 Dashboard Intelligence

A comprehensive dashboard provides real-time metrics at a glance:

  • Consol Score — Current 5-Factor score (0-100) and intensity (Weak/Mod/Strong/Extreme)
  • State — Active, Forming, or None
  • TTM Squeeze — Status and bar count
  • Range Info — High/Low levels, Width in ATR, Price Position %
  • Vol Bias — Accumulation vs Distribution percentage
  • Momentum — RSI, MACD, EMA Trend status
  • Breakout Conf — Current Bull/Bear confidence scores and tiers (S/A/B)
  • Trade Status — Position direction and Open P&L


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🚀 How to Trade with AlphaX Consolidation Engine — Step by Step

Step 1 — Identify Consolidation
  • Wait for a shaded Consolidation Box to appear
  • Check the Dashboard: Is Consol Score > 50? Is Squeeze ON?
  • If no box → do not trade. Wait for compression.


Step 2 — Wait for Breakout Label
  • A Green ▲ or Red ▼ label appears when price escapes the box
  • Check the Confidence % on the label (e.g., "A 65%")
  • If confidence is below your minimum → wait.


tradingview.com/x/YourScreenshotLink4/
Complete trade flow: Consolidation Box → Breakout Label → Retest → Exit

Step 3 — Enter on Breakout or Retest
  • Aggressive: Enter on the Breakout Label close
  • Conservative: Wait for the RETEST label after the breakout
  • Place stop loss below the breakout candle or opposite side of the range


Step 4 — Manage with Trailing Stop
  • The system plots a dynamic trailing stop line (stepped line)
  • Stay in the trade as long as price does not cross the line
  • Add to position on additional Retest signals if trend is strong


Step 5 — Exit on Signal
  • When a ✕ mark appears, the system detects exhaustion or reversal
  • Close position or tighten stop manually
  • Wait for the next Consolidation Box to form for the next cycle


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Key Features
  • 🔬 Proprietary 5-Factor Consolidation Scoring (ATR, BB, KC, LR, ADX)
  • ☁ Dynamic shaded consolidation zones with auto-expanding boundaries
  • 🏷 Confidence-scored breakout labels (S/A/B Tier) with readable text colors
  • ▲▼ High-probability retest entries after breakout confirmation
  • ✕ Smart exit markers (Trail/Failed/Flip) to protect profits
  • 🧠 Multi-factor confidence scoring — squeeze, volume, momentum, candle quality
  • 📊 Volume Bias Analysis — tracks accumulation vs distribution inside ranges
  • 📈 Comprehensive Dashboard — real-time range, momentum, and trade stats
  • 🎨 Cohesive dual-tone color theme — Green for bull, Red for bear, Gray for neutral
  • 🔔 15+ alert conditions — consolidation, squeeze, breakouts, retests, and exits
  • ⚙ Fully configurable — all scoring weights, thresholds, and visuals adjustable


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Settings Reference

Consolidation Detection
  • ATR / BB / KC Periods — Core volatility calculation lengths
  • Squeeze Percentile — Threshold for defining "low volatility"
  • Min Consolidation Bars — Minimum bars required to confirm a range
  • LR Slope Threshold — Sensitivity for detecting flat price action


Breakout Settings
  • Breakout ATR Threshold — How far price must close beyond range
  • Breakout Volume Ratio — Minimum volume required on breakout bar
  • Min Breakout Confidence % — Filter for signal quality (Default 35%)
  • Require Close Beyond Range — Prevents wick fake-outs


Momentum Confirmation
  • RSI / MACD / EMA Periods — Used for confidence scoring
  • RSI Levels — Overbought/Oversold thresholds for scoring penalties


Exits
  • Trailing Stop ATR Multiple — Distance for dynamic stop loss
  • Exit on Re-Enter Range — Close trade if price falls back into consolidation
  • Exit on Opposite Breakout — Close trade if reverse breakout occurs


Appearance & Dashboard
  • Show Consolidation Zones / Lines / Dots — Toggle visual elements
  • Label Size / Dashboard Text — Adjust readability
  • Colors — Fully customizable bull/bear/neutral palette


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🔔 Alert Conditions
  • Consolidation Detected — Fires when a new range is confirmed
  • Squeeze Activated / Released — TTM Squeeze state changes
  • Extreme Squeeze — Consolidation Score > 80
  • S/A/B-Tier Bull/Bear Breakout — Confidence-based breakout alerts
  • Bull/Bear Retest Entry — Pullback entry signals
  • Any Exit — Trail, Failed, or Flip exit signals

All alert messages include {{ticker}} and {{interval}} placeholders for clean webhook integration.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

🎯 Default Settings — Optimized For

The default configuration is specifically tuned for XAUUSD (Gold) and Major Indices on the 5-minute timeframe:
  • Confidence threshold at 35% filters out low-quality noise while keeping valid setups
  • ATR and BB periods calibrated for intraday volatility profiles
  • Volume filters enabled to prevent low-liquidity fakeouts
  • Trailing stop set to 2.0 ATR for breathable trend following


For other instruments or timeframes, adjust:
  • Higher timeframes (1H, 4H) — Increase Min Confidence to 45–55%, increase ATR periods
  • Forex majors — Reduce Min Confidence to 25–30%, enable Strict Volume Filters
  • Crypto — Increase ATR Thresholds (higher volatility), increase Trailing Stop multiple
  • Less noise — Increase Min Confidence %, Increase Min Consolidation Bars
  • More signals — Decrease Min Confidence %, Disable Volume Filters


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

👥 Who This Is For
  • 🥇 Breakout Traders — Specifically designed to capture volatility expansions after compression
  • 📉 Range Traders — Visual boxes help identify support/resistance boundaries clearly
  • 📊 Index & Gold Traders — Tuned for assets with distinct consolidation/expansion cycles
  • 🧠 Systematic Traders — Confidence scoring provides a quantitative framework for entry selection
  • 📈 Traders who value clean charts — No indicator soup. Boxes, labels, and a dashboard.
  • Traders who struggle with choppy markets — The 5-Factor Score physically prevents signals during low-quality ranges


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📝 Notes
  • All calculations are non-repainting — signals are confirmed on bar close
  • Dashboard updates on the last bar only for performance optimization
  • Maximum 500 labels and 500 bars lookback are used — on very low timeframes, oldest labels may be automatically removed by TradingView's rendering limits
  • Volume Bias requires volume data — may be less accurate on forex pairs without tick volume


━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Disclaimer

This indicator is a technical analysis and visualization tool intended for educational and informational purposes only. It does not constitute financial advice or a recommendation to buy or sell any financial instrument. All signals are generated from historical and real-time price data using mathematical calculations — their accuracy or profitability is not guaranteed. Past performance of any signal type does not guarantee future results. Always conduct your own analysis, use proper risk management, and consult a licensed financial advisor before making any trading decisions. The author accepts no responsibility for any losses incurred from the use of this indicator.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Built for traders who demand clarity, confidence, and precision from their charts.

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。