barsPattern
Syntax
Parameters
Return Value
Example
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 70 === 0) { // draw every 70 bars
// 1) Select anchors for the copied range
const from = newPoint(time(110), closeC(110)); // pattern start
const to = newPoint(time(70), closeC(70)); // pattern end
// 2) Style configuration
const style = {
fillBackground: true,
transparency: 80,
showLabels: true,
line: { linestyle: 0, linewidth: 2, color: color.orange },
background: color.rgba(255, 165, 0, 0.2)
};
// 3) Draw Bars Pattern
barsPattern(from, to, style);
}
};Tips
Warning
Good Practice
Last updated