Sidechair

line.set_width()

Browse the reference

Changes the stroke thickness of a line in pixels.

Try it in the editor

Use whole numbers from 1 upward. The width is in screen pixels, so it stays the same when you zoom the chart.

A weight that depends on a condition turns a plain level into a signal: thin when quiet, heavy when it matters.

Syntax

Pine Script
line.set_width(id: series line, width: series int) -> void
line.set_width(width: series int) -> void

Arguments

NameTypeDefaultDescription
idseries linerequiredThe line whose stroke thickness changes.
widthseries intrequiredThickness in pixels as a whole number. 1 is the thinnest; larger values stand out more on a busy chart.

Returns

Nothing.

Example

Pine ScriptHeavier lines on high-volume barsOpen in editor
//@version=6
indicator("line.set_width: weight by volume", overlay = true)
vavg = ta.sma(volume, 20)
if bar_index % 10 == 0
    ln = line.new(bar_index, low, bar_index + 8, low, color = color.teal)
    line.set_width(ln, volume > vavg ? 4 : 1)

See also

Runs on Sidechair