triangle
Syntax (one line)
Parameters
Return Value
Example
//@version=1
init = () => {
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
if (index % 42 === 0) { // draw occasionally to keep charts clean
// 1) Pick three anchors
const A = newPoint(time(80), high(80));
const B = newPoint(time(55), low(55));
const C = newPoint(time(30), closeC(30));
// 2) Style (TriangleLineToolOverrides)
const style = {
color: color.orange, // outline
linewidth: 2,
fillBackground: true, // fill the interior
backgroundColor: color.rgba(255, 165, 0, 0.2),
transparency: 80
};
// 3) Draw the triangle
triangle(A, B, C, style);
}
};Tips
Warning
Good Practice
Last updated