OPEN-SOURCE SCRIPT

Forecast

82
Forecast (FC), indicator documentation

Type: Study, not a strategy
Primary timeframe: 1D chart, most plots and the on-chart table only render on daily bars
Inspiration: Robert Carver’s “forecast” concept from Advanced Futures Trading Strategies, using normalized, capped signals for comparability across markets



What the indicator does

FC builds a volatility-normalized momentum forecast for a chosen symbol, optionally versus a benchmark. It combines an EWMAC composite with a channel breakout composite, then caps the result to a common scale. You can run it in three data modes:
• Absolute: Forecast of the selected symbol
• Relative: Forecast of the ratio symbol / benchmark
• Combined: Average of Absolute and Relative

A compact table can summarize the current forecast, short-term direction on the forecast EMAs, correlation versus the benchmark, and ATR-scaled distances to common price EMAs.



PineScreener, relative-strength screening

This indicator is excellent for screening on relative strength in PineScreener, since the forecast is volatility-normalized and capped on a common scale.

Available PineScreener columns
PineScreener reads the plotted series. You will see at least these columns:
• FC, the capped forecast
• from EMA20, (price − EMA20) / ATR in ATR multiples
• from EMA50, (price − EMA50) / ATR in ATR multiples
• ATR, ATR as a percent of price
• Corr, weekly correlation with the chosen benchmark

Relative mode and Combined mode are recommended for cross-sectional screens. In Relative mode the calculation uses symbol / benchmark, so ensure the ratio ticker exists for your data source.



How it works, step by step
1. Volatility model
Compute exponentially weighted mean and variance of daily percent returns on D, annualize, optionally blend with a long lookback using 10y %, then convert to a price-scaled sigma.
2. EWMAC momentum, three legs
Daily legs: EMA(8) − EMA(32), EMA(16) − EMA(64), EMA(32) − EMA(128).
Divide by price-scaled sigma, multiply by leg scalars, cap to Cap = 20, average, then apply a small FDM factor.
3. Breakout momentum, three channels
Smoothed position inside 40, 80, and 160 day channels, each scaled, then averaged.
4. Composite forecast
Average the EWMAC composite and the breakout composite, then cap to ±20.
Relative mode runs the same logic on symbol / benchmark.
Combined mode averages Absolute and Relative composites.
5. Weekly correlation
Pearson correlation between weekly closes of the asset and the benchmark over a user-set length.
6. Direction overlay
Two EMAs on the forecast series plus optional green or red background by sign, and optional horizontal level shading around 0, ±5, ±10, ±15, ±20.



Plots
• FC, capped forecast on the daily chart
• 8-32 Abs, 8-32 Rel, single-leg EWMAC plus breakout view
• 8-32-128 Abs, 8-32-128 Rel, three-leg composite views
• from EMA20, from EMA50, (price − EMA) / ATR
• ATR, ATR as a percent of price
• Corr, weekly correlation with the benchmark
• Forecast EMA1 and EMA2, EMAs of the forecast with an optional fill
• Backgrounds and guide lines, optional sign-based background, optional 0, ±5, ±10, ±15, ±20 guides

Most plots and the table are gated by timeframe.isdaily. Set the chart to 1D to see them.



Inputs

Symbol selection
• Absolute, Relative, Combined
• Vs. benchmark for Relative mode and correlation, choices: SPY, QQQ, XLE, GLD
• Ticker or Freeform, for Freeform use full TradingView notation, for example NASDAQ:AAPL

Engine selection
• Include:
• 8-32-128, three EWMAC legs plus three breakouts
• 8-32, simplified view based on the 8-32 leg plus a 40-day breakout

EMA, applied to the forecast
• EMA1, EMA2, with line-width controls, plus color and opacity

Volatility
• Span, EW volatility span for daily returns
• 10y %, blend of long-run volatility
• Thresh, Too volatile, placeholders in this version

Background
• Horizontal bg, level shading, enabled by default
• Long BG, Hedge BG, colors and opacities

Show
• Table, Header, Direction, Gain, Extension
• Corr, Length for correlation row

Table settings
• Position, background, opacity, text size, text color

Lines
• 0-lines, 10-lines, 5-lines, level guides



Reading the outputs
• Forecast > 0, bullish tilt; Forecast < 0, bearish or hedge tilt
• ±10 and ±20 indicate strength on a uniform scale
• EMA1 vs EMA2 on the forecast, EMA1 above EMA2 suggests improving momentum
• Table rows, label colored by sign, current forecast value plus a green or red dot for the forecast EMA cross, optional daily return percent, weekly correlation, and ATR-scaled EMA9, EMA20, EMA50 distances



Data handling, repainting, and performance
• Daily and weekly series are fetched with request.security().
• Calculations use closed bars, values can update until the bar closes.
• No lookahead, historical values do not repaint.
• Weekly correlation updates during the week, it finalizes on weekly close.
• On intraday charts most visuals are hidden by design.



Good practice and limitations
• This is a research indicator, not a trading system.
• The fixed Cap = 20 keeps a common scale, extreme moves will be clipped.
• Relative mode depends on the ratio symbol / benchmark, ensure both legs have data for your feed.



Credits

Concept inspired by Robert Carver’s forecast methodology in Advanced Futures Trading Strategies. Implementation details, parameters, and visuals are specific to this script.



Changelog
• First version



Disclaimer

For education and research only, not financial advice. Always test on your market and data feed, consider costs and slippage before using any indicator in live decisions.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.