OPEN-SOURCE SCRIPT

Adaptive Forecast Bands [JOAT]

605
Adaptive Forecast Bands [JOAT]

Introduction

Adaptive Forecast Bands is an open-source adaptive regression and mean-reversion framework. It estimates a live fair-value path from price, wraps that path in volatility-aware bands, and marks confirmed re-entry conditions only after the bar closes.

The problem this indicator solves is context around stretched price. A static moving average band can lag badly when volatility changes. Adaptive Forecast Bands uses a recursive regression engine, a live model error estimate, and an ATR blend so the envelope expands and contracts with current market behavior.

תמונת-בזק

Core Concepts

1. Adaptive Regression Mean

The centerline is built from a persistent two-parameter regression state. The script uses normalized local time so the model does not depend on raw bar index growth over long histories.

Pine Script®


2. Error-Based Confidence Bands

Band width is derived from the model's exponentially weighted error plus an ATR component. This keeps the band reactive to both forecast error and realized volatility.

3. Confirmed Re-Entry Signals

The script arms a long or short setup when price reaches an outer band. A signal only prints when price confirms a re-entry back through the relevant band on `barstate.isconfirmed`.

4. Forecast Guide Lines

The right-edge guide projects the current regression slope forward for visual context. It is a guide, not a prediction, and is redrawn on the last bar to avoid object clutter.

Features

  • Adaptive fair-value line: Recursive regression centerline based on current price behavior
  • Volatility-aware envelope: Error variance and ATR combine to form dynamic upper/lower bands
  • Confirmed long/short labels: Re-entry signals use closed-bar logic
  • Right-edge forecast guide: Dashed and dotted guide lines show current slope context
  • Top-right dashboard: Bias, confidence, band width, slope, guide state, and signal state
  • Alert conditions: Long and short confirmed re-entry events


Input Parameters

Model:
  • Source: Price source used by the model
  • Forgetting Factor: How quickly the model adapts to new price information
  • Regression Horizon: Normalization horizon for the regression slope
  • Band Multiplier: Multiplier applied to model error
  • ATR Blend: Extra realized-volatility padding in the band width
  • Rebase Interval: Periodic reset to keep the adaptive model stable


How to Use This Indicator

Step 1: Use the centerline as an adaptive fair-value reference.
Step 2: Treat outer-band touches as stretched conditions, not immediate entries.
Step 3: Wait for confirmed re-entry labels when enabled.
Step 4: Read the dashboard confidence and slope before interpreting the signal.

Indicator Limitations

  • The right-edge guide is a visualization of current model slope, not a forecast guarantee
  • Mean-reversion signals can underperform during strong directional trends
  • The model periodically rebases by design to reduce long-history numerical drift
  • Signals are confirmed on closed bars and can appear after the intrabar extreme occurred


Originality Statement

Adaptive Forecast Bands is an original JOAT implementation combining normalized recursive regression, error-based confidence bands, ATR blending, confirmed re-entry logic, and a compact interpretive dashboard. It does not copy third-party source code.

Disclaimer

This open-source indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Trading involves risk, and historical behavior does not ensure future results. Always use proper risk management.

-Made with passion by jackofalltrades

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.