Skip to Main Content

Drawing Rays

The following script paints a ray connecting last 2 of Fractal High points.

const fHighs = fractal_high(high, 15);
const lastFHighs = indexed_points_of(fHighs).slice(-2);

if (lastFHighs.length == 2) {
    // on some charts, you simply do not have 2 fractals!
    paint(line(
        lastFHighs[0].candleIndex,
        lastFHighs[0].value,
        lastFHighs[1].candleIndex,
        lastFHighs[1].value
        ));
} else {
    paint(constants.empty_series);
}
Drawing Rays