timeCycles
Syntax
Parameters
Return Value
Example
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 80 === 0) { // draw every 80 bars
// 1) Define anchors
const O = newPoint(time(120), closeC(120)); // starting cycle
const T = newPoint(time(80), closeC(80)); // interval
// 2) Style settings
const style = {
fillBackground: true,
transparency: 85,
showLabels: true,
line: { linestyle: 2, linewidth: 1, color: color.blue },
background: color.rgba(0, 0, 255, 0.15)
};
// 3) Draw time cycles
timeCycles(O, T, style);
}
};Tips
Warning
Good Practice
Last updated