OPEN-SOURCE SCRIPT

Foresight Cone (Holt • F1 • VWAP) [KedArc Quant]

36
Description:

This is a time-series forecasting indicator that estimates the next bar (F1) and projects a path a few bars ahead. It also draws a confidence cone based on how accurate the recent forecasts have been. You can optionally color the projection only when price agrees with VWAP.

Why it’s different

* One clear model: Everything comes from Holt’s trend-aware forecasting method—no mix of unrelated indicators.
* Transparent visuals: You see the next-bar estimate (F1), the forward projection, and a cone that widens or narrows based on recent forecast error.
* Context, not signals: The VWAP option only changes colors. It doesn’t add trade rules.
* No look-ahead: Accuracy is measured using the forecast made on the previous bar versus the current bar.

Inputs (what they mean)

* Source: Price series to forecast (default: Close).
* Preset: Quick profiles for fast, smooth, or momentum markets (see below).
* Alpha (Level): How fast the model reacts to new prices. Higher = faster, twitchier.
* Beta (Trend): How fast the model updates the slope. Higher = faster pivots, more flips in chop.
* Horizon: How many bars ahead to project. Bigger = wider cone.
* Residual Window: How many bars to judge recent accuracy. Bigger = steadier cone.
* Confidence Z: How wide the cone should be (typical setting ≈ “95% style” width).
* Show Bands / Draw Forward Path: Turn the cone and forward lines on/off.
* Color only when aligned with VWAP: Highlights projections only when price agrees with the trend side of VWAP.
* Colors / Show Panel: Styling plus a small panel with RMSE, MAPE, and trend slope.

Presets (when to pick which)

* Scalp / Fast (1-min): Very responsive; best for quick moves. More twitch in chop.
* Smooth Intraday (1–5 min): Calmer and steadier; a good default most days.
* Momentum / Breakout: Quicker slope tracking during strong pushes; may over-react in ranges.
* Custom: Set your own values if you know exactly what you want.

What is F1 here?

F1 is the model’s next-bar fair value. Crosses of price versus F1 can hint at short-term momentum shifts or mean-reversion, especially when viewed with VWAP or the cone.

How this helps

* Gives a baseline path of where price may drift and a cone that shows normal wiggle room.
* Helps you tell routine noise (inside cone) from information (edges or breaks outside the cone).
* Keeps you aware of short-term bias via the trend slope and F1.

How to use (step by step)

1. Add to chart → choose a Preset (start with Smooth Intraday).
2. Set Horizon around 8–15 bars for intraday.
3. (Optional) Turn on VWAP alignment to color only when price agrees with the trend side of VWAP.
4. Watch where price sits relative to the cone and F1:
* Inside = normal noise.
* At edges = stretched.
* Outside = possible regime change.
5. Check the panel: if RMSE/MAPE spike, expect a wider cone; consider a smoother preset or a higher timeframe.
6. Tweak Alpha/Beta only if needed: faster for momentum, slower for chop.
7. Combine with your own plan for entries, exits, and risk.


Accuracy Panel — what it tells you

Preset & Horizon: Shows which preset you’re using and how many bars ahead the projection goes. Longer horizons mean more uncertainty.
RMSE (error in price units): A “typical miss” measured in the chart’s currency (e.g., ₹).
Lower = tighter fit and a usually narrower cone. Rising = conditions getting noisier; the cone will widen.
MAPE (error in %): The same idea as RMSE but in percent.
Good for comparing different symbols or timeframes. Sudden spikes often hint at a regime change.
Slope T: The model’s short-term trend reading.
Positive = gentle up-bias; negative = gentle down-bias; near zero = mostly flat/drifty.

How to read it at a glance

Calm & directional: RMSE/MAPE steady or falling + Slope T positive (or negative) → trends tend to respect the cone’s mid/upper (or mid/lower) area.
Choppy/uncertain: RMSE/MAPE climbing or jumping → expect more whipsaw; rely more on the cone edges and higher-TF context.
Flat tape: Slope T near zero → mean-revert behavior is common; treat cone edges as stretch zones rather than breakout zones.

Warm-up & tweaks

Warm-up: Right after adding the indicator, the panel may be blank for a short time while it gathers enough bars.
Too twitchy? Switch to Smooth Intraday or increase the Residual Window.
Too slow? Use Scalp/Fast or Momentum/Breakout to react quicker.

Timeframe tips

* 1–3 min: Scalp/Fast or Momentum/Breakout; horizon \~8–12.
* 5–15 min: Smooth Intraday; horizon \~12–15.
* 30–60 min+: Consider a larger residual window for a steadier cone.

FAQ

Q: Is this a strategy or an indicator?
A: It’s an indicator only. It does not place orders, TP/SL, or run backtests.

Q: Does it repaint?
A: The next-bar estimate (F1) and the cone are calculated using only information available at that time. The forward path is a projection drawn on the last bar and will naturally update as new bars arrive. Historical bars aren’t revised with future data.

Q: What is F1?
A: F1 is the indicator’s best guess for the next bar.
Price crossing above/below F1 can hint at short-term momentum shifts or mean-reversion.

Q: What do “Alpha” and “Beta” do?
A: Alpha controls how fast the indicator reacts to new prices
(higher = faster, twitchier). Beta controls how fast the slope updates (higher = quicker pivots, more flips in chop).

Q: Why does the cone width change?
A: It reflects recent forecast accuracy. When the market gets noisy, the cone widens. When the tape is calm, it narrows.

Q: What does the Accuracy Panel tell me?
A:
* Preset & Horizon you’re using.
* RMSE: typical forecast miss in price units.
* MAPE: typical forecast miss in percent.
* Slope T: short-term trend reading (up, down, or flat).
If RMSE/MAPE rise, expect a wider cone and more whipsaw.

Q: The panel shows “…” or looks empty. Why?
A: It needs a short warm-up to gather enough bars. This is normal after you add the indicator or change settings/timeframes.

Q: Which timeframe is best?
A:
* 1–3 min: Scalp/Fast or Momentum/Breakout, horizon \~8–12.
* 5–15 min: Smooth Intraday, horizon \~12–15.
Higher timeframes work too; consider a larger residual window for steadier cones.

Q: Which preset should I start with?
A: Start with Smooth Intraday. If the market is trending hard, try Momentum/Breakout.
For very quick tapes, use Scalp/Fast. Switch back if things get choppy.

Q: What does the VWAP option do?
A: It only changes colors (highlights when price agrees with the trend side of VWAP).
It does not add or remove signals.

Q: Are there alerts?
A: Yes—alerts for price crossing F1 (up/down). Use “Once per bar close” to reduce noise on fast charts.

Q: Can I use this on stocks, futures, crypto, or FX?
A: Yes. It works on any symbol/timeframe. You may want to adjust Horizon and the Residual Window based on volatility.

Q: Can I use it with Heikin Ashi or other non-standard bars?
A: You can, but remember you’re forecasting the synthetic series of those bars. For pure price behavior, use regular candles.

Q: The cone feels too wide/too narrow. What do I change?
A:
* Too wide: lower Alpha/Beta a bit or increase the Residual Window.
* Too narrow (misses moves): raise Alpha/Beta slightly or try Momentum/Breakout.

Q: Why do results change when I switch timeframe or symbol?
A: Different noise levels and trends. The accuracy stats reset per chart, so the cone adapts to each context.

Q: Any limits or gotchas?
A: Extremely large Horizon may hit TradingView’s line-object limits; reduce Horizon or turn
off extra visuals if needed. Big gaps or news spikes will widen errors—expect the cone to react.

Q: Can this predict exact future prices?
A: No. It provides a baseline path and context. Always combine with your own rules and risk management.

Glossary

* TS (Time Series): Data over time (prices).
* Holt’s Method: A forecasting approach that tracks a current level and a trend to predict the next bars.
* F1: The indicator’s best guess for the next bar.
* F(h): The projected value h bars ahead.
* VWAP: Volume-Weighted Average Price—used here for optional color alignment.
* RMSE: Typical forecast miss in price units (how far off, on average).
* MAPE: Typical forecast miss in percent (scale-free, easy to compare).

Notes & limitations

* The panel needs a short warm-up; stats may be blank at first.
* The cone reflects recent conditions; sudden volatility changes will widen it.
* This is a tool for context. It does not place trades and does not promise results.

⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.