rayLine
Syntax
Parameters
Helper you’ll use
Return Value
Example
//@version=1
init = () => {
// Configure the indicator:
// - format: 'inherit' → use the chart’s format (price, decimals, etc.)
indicator({ onMainPanel: true, format: 'inherit' });
};
onTick = () => {
// --- Condition to control when to draw ---
// index is the bar counter. We check "index % 100 === 0":
// → Only every 100th bar will trigger the drawing.
if (index % 100 === 0) {
// time(10), low(10) = 10 bars ago → starting point of the ray (older pivot).
const start = newPoint(time(10), low(10));
// time(0), low(0) = current bar’s low → end point, where the ray passes through.
const end = newPoint(time(0), low(0));
// --- Draw the ray line ---
// Style options:
// - linecolor: red (taken from color set:contentReference[oaicite:1]{index=1})
// - linewidth: 2 → thicker line
// - showLabel: true → display a text label on the chart
// Label: "Support Ray"
rayLine(
start,
end,
{ linecolor: color.red, linewidth: 2, showLabel: true },
'Support Ray'
);
}
};
Result

Last updated