bgcolor

Shades the pane’s background. Like barcolor it adds no value to the chart. It differs from barcolor in one way that matters: it takes a force_overlay argument and barcolor does not.

bgcolor(series color color, const string title, input int offset, const bool force_overlay) → void
ParameterTypeRequiredDescription
colorseries colornoThe colour applied to the background. Series-form. Optional.
titleconst stringnoThe name of the colouring. Const-form.
offsetinput intnoShifts the colouring along the chart. Input-form.
force_overlayconst boolnoSets this drawing’s overlay, separately from the script-wide setting.

Returns void — void.

indicator("Shade the background")
plot(close)
bgcolor(color.new(color.blue, 0.1), title = "Background")

See also bars and background

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade