Home/Dovee/Function reference

line

Draw a straight line between two bars. Use inside when.

Reference/Language/Language

line price [to price] from N bars ago [extend right | until touched] [keep N] color [dashed]

The first price is placed N bars ago (from N bars ago, default: the same bar), and the price after to on the bar the rule fires. Without to, the line is flat at the first price. extend right carries its slope to the right edge of the chart. until touched carries it to the first later bar whose high-low range reaches the line. Outside a when, the line is drawn once, on the last bar. Each line statement keeps its newest 50 lines; keep N (1 to 500) changes that. dashed draws a dashed line. line stays usable as a variable name: line = ema(close, 9).

Return value

—

Example

// Trend line through the last two higher lows
when low > low 5 bars ago and close crosses above high 1 bars ago
  line low 5 bars ago to low from 5 bars ago extend right green
// Today's opening price as a ray from the last bar
line today open extend right gray dashed

See also