QTP - Breakout ForecasterQTP - Breakout Forecaster
🔬 Overview
The QTP Breakout Forecaster uses a statistical probability engine to forecast the likelihood of price breaking above or below its current consolidation range. Instead of reacting to breakouts after they happen, this indicator tells you the probability of a breakout occurring within a configurable number of future bars — giving you time to prepare entries before the move begins.
Built on a random walk model with Normal CDF approximation, it translates raw volatility and price position into clean, actionable probability readings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚙️ How It Works
The indicator defines a consolidation range using the highest high and lowest low over a configurable lookback period. It then calculates the statistical probability that price will exceed either boundary within the forecast horizon, using the standard deviation of log returns as the volatility input.
The model assumes a geometric random walk — the same framework used in options pricing. The Normal CDF (Abramowitz & Stegun approximation) converts the distance-to-boundary into a percentage probability. When price sits near the upper boundary with low volatility, bullish breakout probability rises. When volatility compresses (squeeze), both probabilities increase as the range tightens relative to expected movement.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 Key Features
◆ Statistical Probability Engine — Uses Normal CDF approximation on log-return volatility to calculate the mathematical probability of price exceeding the consolidation range. Not a pattern — a calculation.
◆ Volatility Squeeze Detection — Compares current ATR to its historical average. When the squeeze reading exceeds 50%, volatility is compressed and a breakout becomes statistically more likely. Above 70% triggers an alert condition.
◆ Bias Indicator — Automatically classifies the current state as BULLISH, BEARISH, or NEUTRAL based on the differential between the two breakout probabilities. Displayed in the dashboard with color coding.
◆ Neon Glow Effect — A wider, semi-transparent line renders behind each probability line, creating a high-visibility neon effect in electric blue (bullish) and hot pink (bearish). Toggleable on/off.
◆ Donchian Channel Overlay — The consolidation range is plotted directly on the main price chart with a subtle fill, showing exactly where the upper and lower boundaries sit. Toggleable on/off.
◆ Breakout Arrows on Main Chart — When either probability crosses above 50%, a triangle arrow appears on the price chart — blue up-arrow for bullish, pink down-arrow for bearish. These fire at the moment of statistical significance, not after the breakout.
◆ Gradient Probability Fill — The area between each probability line and the zero line fills with a gradient that intensifies as probability rises, giving instant visual feedback on breakout strength.
◆ Professional Dashboard — Floating table displays bullish probability, bearish probability, bias direction, squeeze intensity, and forecast horizon in a compact, dark-themed panel.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📐 How To Use
Add the indicator to your chart — the probability oscillator appears in a lower panel with a black background, and the consolidation range appears on the main chart.
Watch the bullish probability line (blue) — when it rises above 50%, the model calculates that price is more likely than not to break above the range within the forecast horizon.
Watch the bearish probability line (pink) — when it rises above 50%, a downside breakout is statistically favored.
The squeeze reading in the dashboard tells you how compressed volatility is. High squeeze (above 50%) means the range is tight relative to historical movement — breakouts from these conditions tend to be explosive.
Use the bias indicator to quickly assess directional lean. BULLISH means the upside probability significantly exceeds downside. BEARISH is the opposite. NEUTRAL means both sides are roughly equal — watch for the first one to cross 50%.
Adjust the Forecast Horizon to match your trading timeframe. Shorter horizons (5-10 bars) give more immediate signals. Longer horizons (20-50 bars) capture bigger consolidation breakouts.
The Range Length controls how far back the consolidation boundaries are calculated. Shorter lengths (10-15) react to recent structure. Longer lengths (30-50) define major support and resistance zones.
Combine with a trend indicator — when the breakout forecaster shows high bullish probability AND price is above a key moving average, conviction for a long entry is highest.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Settings Overview
◆ Range Length — Lookback period for consolidation high/low (default: 20)
◆ Forecast Horizon — Number of future bars for probability calculation (default: 10)
◆ Volatility Lookback — Period for log-return standard deviation (default: 50)
◆ Bullish / Bearish Colors — Customizable color scheme
◆ Fill Transparency — Controls the gradient fill intensity (default: 70)
◆ Neon Glow Effect — Toggle the glow behind probability lines
◆ Show Range on Chart — Toggle the Donchian channel overlay on the main chart
◆ Dashboard — Enable/disable, position, and size controls
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔔 Alerts
3 built-in alert conditions ready for automation:
• Bullish Breakout Forecast — bullish probability crossed above 50%
• Bearish Breakout Forecast — bearish probability crossed above 50%
• High Squeeze Detected — volatility squeeze intensity above 70%, breakout imminent
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠️ Disclaimer
This indicator is a technical analysis tool designed to assist with market analysis. It does not constitute financial advice. Past performance is not indicative of future results. Always use proper risk management and perform your own due diligence before making trading decisions.
Pine Script®指标






















