forecast
The Forecast tool projects a possible future price path between two anchors. It helps visualize potential continuation or reversal scenarios, giving traders a forward-looking view based on past swings.
Syntax
forecast(fromPoint, toPoint, styles?)
Parameters
fromPoint (PricedData) · First anchor (time & price) where the forecast begins.
toPoint (PricedData) · Second anchor (time & price) that defines the projected path.
styles (ForecastStyleOverrides) · Options for customization:
fillBackground(boolean) · Fill the projection area.transparency(number) · Background transparency (0–100).showLabels(boolean) · Show labels on projected points.line(LinesLevels without coeff) · Style of projection lines (linestyle,linewidth,color).background(RGBAColor | BaseColors) · Color fill for projection zones.
Return Value
(string) · The drawing ID of the created Forecast.
Example
Every 60 candles, draw a forecast projection from a past swing low to a later swing high, extending forward.
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 60 === 0) { // draw every 60 bars
// 1) Select two anchors
const from = newPoint(time(100), low(100)); // base point
const to = newPoint(time(60), high(60)); // reference point
// 2) Style setup
const style = {
fillBackground: true,
transparency: 75,
showLabels: true,
line: { linestyle: 2, linewidth: 2, color: color.blue },
background: color.rgba(0, 0, 255, 0.15)
};
// 3) Draw forecast
forecast(from, to, style);
}
};Tips
Use meaningful swing highs/lows for anchors so projections align with market rhythm.
Forecasts are visual guides, not trade signals — combine them with your system rules.
Try layering multiple forecasts from different swings to see overlapping “future zones.”
Warning
If anchors are too close together, the projection won’t be useful — make sure they cover a significant move.
Good Practice
Keep forecast lines semi-transparent to avoid cluttering your chart.
Compare forecast projections with Fibonacci extensions for extra confirmation.
Last updated