forecast
Syntax
Parameters
Return Value
Example
//@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
Warning
Good Practice
Last updated