Volatility Forecast [EXCAVO]Forward Projection of the Bollinger Envelope with Adaptive Horizon and Slope Clamp
The Volatility Forecast takes the classical Bollinger Bands and
projects the basis and the bands forward by a configurable number of bars.
Slopes of the basis, standard deviation and ATR are estimated from linear
regression over a lookback window, then extrapolated through a smooth
curve into the right side of the chart. Small orange dots mark band
reclaim events on confirmed closed bars.
The forecast horizon adapts to the chart timeframe so the projection
stays meaningful at every TF, and a slope clamp prevents the bands from
ballooning into unrealistic territory after sharp regime shifts.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW TO USE
Step 1 → Add the indicator. The current Bollinger Bands are
plotted on the chart and a dashed envelope extends to the
right with the projected basis and bands.
Step 2 → Read the projection. The projected upper and lower
bands show the most likely volatility envelope over the
next bars under the current trend and volatility regime.
Wider end = expansion expected; narrower end = compression.
Step 3 → Use the reclaim dots. A small orange dot below a bar
marks a confirmed bull band reclaim (price tagged the lower
band and pulled back inside). A dot above a bar marks a
bear reclaim. These are context, not entries.
Step 4 → Check the dashboard. The top right panel reads the
projection mode, current width vs its rolling average,
band state, and the last reclaim.
Step 5 → Combine with structure. The envelope pairs well with
trend and structure tools. A breakout that aligns with an
expanding projected envelope tends to continue; one against
a contracting envelope tends to fade.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ HOW IT CALCULATES
◆ Bollinger Bands
Basis is a simple moving average of the source over Length (default 20).
Standard deviation is computed over the same window. Bands are basis plus
or minus Multiplier times standard deviation (default 2.0). These are the
solid plotted lines on the chart.
◆ Linear Regression Slopes
For the projection, the algorithm estimates per-bar slopes from a linear
regression of the basis, the standard deviation, and the ATR over the
Slope Lookback window (default 40). Slope is taken as the difference
between the linreg value at offset 0 and offset 1 - the per-bar drift
the regression expects to continue.
◆ Slope Clamp
Each slope is then clamped to a safety bound so that the cumulative
projected displacement stays sensible. End to end, the projected basis
cannot drift more than two current band-widths, and the projected
standard deviation or ATR cannot grow more than 50% of its current value.
Sign of the slope is preserved so trend direction is intact, only the
magnitude is bounded. This keeps the projection meaningful after sharp
regime shifts.
◆ Forward Projection
Three modes turn slopes into a projected envelope across the forecast
horizon:
Linear extends basis and width on a straight line using the
current slope at every step.
Smooth Curve (default) eases from the current value toward a
dynamic endpoint via a smoothstep curve so the projection has a
natural arc instead of a hard linear extrapolation.
Adaptive Volatility drives the projected width with ATR slope
instead of standard-deviation slope. Useful when volatility is
regime-dependent and the ATR captures it better than stdev.
A projection floor at 50% ensures the envelope never collapses to a
single point on declining-volatility regimes.
◆ Auto Timeframe Forecast
Forecast Bars defaults to Auto, which picks the horizon from the chart
timeframe: 40 bars on 4h and below, 20 on Daily, 10 on Weekly, 6 on
Monthly+. Manual override is available for operators who want a fixed
bar count regardless of timeframe.
◆ Band Reclaim Markers
A bull reclaim fires when the prior bar's low touched the lower band,
the current bar's low has pulled back above the lower band, and the
close sits below the basis. A bear reclaim is symmetric on the upper
band. Cooldown of Length bars prevents same-direction stacking. The
optional Trend MA filter keeps bull marks only above the MA and bear
marks only below. By default markers fire only on confirmed closed bars
(no repaint); Real-time Markers can be enabled if intra-bar feedback is
preferred.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ WHAT MAKES IT DIFFERENT
◆ Adaptive Horizon
The forecast horizon scales with the chart timeframe. The projection
shows a comparable arc on intraday, daily, weekly and monthly without
manual tuning per chart.
◆ Slope Clamp Safety Net
Linear-regression slopes can overshoot after sharp moves or on long
horizons. The clamp caps the cumulative displacement so the projection
cannot grow into unrealistic ranges, regardless of the underlying slope.
◆ Three Projection Modes
Linear, Smooth Curve and Adaptive Volatility cover the common shapes a
volatility envelope can take. Smooth Curve uses smoothstep easing for
a natural arc; Adaptive Volatility ignores stdev drift and tracks ATR
instead.
◆ Confirmed Reclaim Markers
Small orange dots above or below the bar mark band reclaim events. They
fire on confirmed closed bars by default (no repaint), with an optional
real-time mode for operators who prefer intra-bar feedback. A trend-MA
filter keeps the bias clean.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ DASHBOARD
Real-time panel with the current state read:
Mode - Linear / Smooth Curve / Adaptive Volatility
Width vs Avg - current band width relative to its rolling average
Band State - where price sits in the bands (Above Upper / Below Lower / Upper Half / Lower Half)
Last Marker - direction and bars since the last band reclaim
Legend table explains every on-chart element. Both panels toggle in the
Dashboard settings.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ SETTINGS
Bollinger Bands
Source - close (price series used for basis and stdev)
Length - 20 (lookback for basis and stdev)
Multiplier - 2.0 (band width in stdev units)
Basis / Band / Fill Colors - default palette
Forecast Envelope
Forecast Bars Mode - Auto (adapts to chart TF) or Manual
Forecast Bars (Manual) - 40 (used when Mode = Manual)
Slope Lookback - 40 (linreg window for slope estimation)
Mode - Smooth Curve (Linear / Smooth Curve / Adaptive Volatility)
Projection Style / Width / Colors - dashed, default palette
Fill Projection - ON
Reclaim Markers
Show Markers - ON
Real-time Markers - OFF (no repaint by default; closed bars only)
Filter by Trend MA - ON
Trend MA Type - SMA (SMA / EMA / WMA / HMA)
Trend MA Length - 100
Marker Color - orange (#FF8C00)
Show Trend MA - OFF
Dashboard
Show Dashboard - ON
Dashboard Position - Top Right
Show Legend - ON
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
▸ ALERTS
Two directional alertconditions are exposed:
Bull Band Reclaim - fires on a confirmed bull reclaim event
Bear Band Reclaim - fires on a confirmed bear reclaim event
Set the alert condition to "Once Per Bar Close" for clean, non-repainting
delivery. Trend-MA filter and cooldown apply to alerts the same way they
apply to the on-chart markers.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Best regards,
EXCAVO
Disclaimer
Trading involves significant risk. This indicator is a technical analysis
tool and does not constitute financial advice, investment recommendations,
or a guarantee of future results. Past indicator behavior does not
guarantee future performance. Always use proper risk management and your
own judgment.
Индикатор Pine Script®






















