Sidechair

hline()

Browse the reference

Draws a horizontal line across the whole pane at a fixed price, and returns a handle that fill can use.

Try it in the editor

hline draws one horizontal line at price. The price is read on the first bar and cannot change, so use plot with a constant series if the level must move.

Style, width and color are fixed from the first bar as well. The returned handle can be given to fill to shade the band between two lines.

Syntax

Pine Script
hline(price: input int/float, title: const string (optional), color: input color (optional), linestyle: input hline_style (optional), linewidth: input int (optional), editable: input bool (optional), display: input plot_simple_display (optional)) -> hline

Arguments

NameTypeDefaultDescription
priceinput int/floatrequiredThe level to draw. A fixed number, read once.
titleconst string"Level"Name shown in the Settings dialog.
colorinput color#787B86Color of the horizontal line. It takes an input color or a fixed color, not a series.
linestyleinput hline_stylehline.style_dashedLine style: hline.style_solid, hline.style_dotted or hline.style_dashed.
linewidthinput int1Line thickness in pixels. A whole number of 1 or more.
editableinput booltrueAccepted for compatibility and ignored.
displayinput plot_simple_displaydisplay.allWhere the line is shown. display.none hides it.

Returns

hline: an hline handle, accepted by fill.

Remarks

  • On Sidechair: line widths above 4 are drawn as 4.
  • Two hline handles passed to fill shade the band between the levels, which is how oscillator zones are drawn.

Example

Pine ScriptOscillator zonesOpen in editor
//@version=6
indicator("RSI zones")
upper = hline(70, "Upper", color.red, hline.style_dotted)
lower = hline(30, "Lower", color.green, hline.style_dotted)
fill(upper, lower, color.new(color.purple, 92), "Neutral zone")
plot(ta.rsi(close, 14), "RSI", color = color.purple)

See also

Runs on Sidechair