Sidechair

chart.is_linebreak

Browse the reference

True when the chart shows Line Break bars, where a reversal needs a close beyond the last three lines.

Try it in the editor

A Line Break chart adds a line in the trend direction whenever the close extends the trend. It reverses only when the close goes past the extreme of the previous three lines, which is why it is called a three line break.

Quiet periods draw nothing, so bars are uneven in time. Counting consecutive same-direction lines is the natural statistic.

Type

simple bool

Example

Pine ScriptCount consecutive lines in one directionOpen in editor
//@version=6
indicator("chart.is_linebreak: line streak", overlay = false)
var int streak = 0
if chart.is_linebreak
    streak := close > close[1] ? (streak > 0 ? streak + 1 : 1) : (streak < 0 ? streak - 1 : -1)
plot(streak, "Line streak", color.teal, style = plot.style_columns)

See also

Runs on Sidechair