Builds a ticker id that serves a Line Break chart for a symbol, using a set number of lines.
ticker.linebreak(symbol, number_of_lines) returns an id that request.security turns into a Line Break series. A new line forms only when the close goes beyond the previous line in the same direction; a reversal needs the close to break the extreme of the last number_of_lines lines.
More lines means fewer reversals and a smoother chart.
Syntax
ticker.linebreak(symbol: simple string, number_of_lines: simple int) -> simple string
ticker.linebreak(symbol: series string, number_of_lines: series int) -> series stringArguments
| Name | Type | Default | Description |
|---|---|---|---|
| symbol | simple/ | required | The ticker id to convert, such as syminfo.tickerid. |
| number_of_lines | simple/ | required | How many previous lines the close must break to reverse the chart. Three is the usual choice. |
Returns
simple/series string: A ticker id string. Pass it to request.security as its symbol argument.
Remarks
- Like other non-time charts, a new line is not guaranteed on every bar.
Example
//@version=6
indicator("Line break close", overlay = true)
lbId = ticker.linebreak(syminfo.tickerid, 3)
lbClose = request.security(lbId, timeframe.period, close)
plot(close, "Close", color.gray)
plot(lbClose, "Line break close", color.orange, style = plot.style_stepline)See also
Runs on Sidechair