Skip to main content

hline

Syntax Format

hline(source, "name", "color")

Overview

The hline function draws a horizontal line that spans the full width of the chart. The level of the horizontal line is set in the parameters. You can use this function to draw support and resistance lines, overbought and oversold levels, and other similar indicators.

Parameters

ParameterTypePurposeDefault State
sourceseries or numericInput series or a value-
namestringName of the plot"hline(source)"
color colorLine color"white"
line_width integerLine width1
offsetintegerOffset in bars. Not yet handled by the engine 0
plot_style plot_stylePlot style. One of style.solid_line, style.dashed_line. Not yet handled by the enginestyle.solid_line
show_label booleanControls whether the value label is shown for the linetrue

Example

overbought = input(80, "Overbought")
hline(overbought, "Overbought", "red")