Line styles for hline(): hline.style_solid, hline.style_dashed and hline.style_dotted.
hline.style_* constants go in the linestyle argument of hline(), which draws a horizontal line at a fixed price level. hline.style_dashed is the default.
The price you give hline must be known before the script runs, so it cannot depend on bar data. For a level that moves, plot a series or draw a line.new instead.
Constants
| Name | Value | Description |
|---|---|---|
hline.style_dashed | A dashed horizontal line; the default. | |
hline.style_dotted | A dotted horizontal line. | |
hline.style_solid | A solid horizontal line. |
Remarks
- Keep the returned hline handle when you want to fill between two levels with fill().
Example
//@version=6
indicator("RSI levels")
rsi = ta.rsi(close, 14)
plot(rsi, "RSI", color.purple)
top = hline(70, "Overbought", color.red, hline.style_dashed)
mid = hline(50, "Middle", color.gray, hline.style_dotted)
bot = hline(30, "Oversold", color.green, hline.style_solid)
fill(top, bot, color.new(color.purple, 92))See also
Runs on Sidechair