Skip to main content
barcolor recolors the price bars; bgcolor shades the background behind a bar. Neither draws a value. Both stand at the top level and take their condition in the color: a color of na means no change.

barcolor and bgcolor

  • barcolor(color, title, offset, display)
  • bgcolor(color, title, offset, force_overlay, display)
color may be a series. title is a const string, offset an input int. barcolor has no force_overlay.
A gradient shades the background by a value (see Color):

display accepts only all and none

display takes only display.none and display.all on both. The editor accepts other constants; adding the script to the chart refuses them:
The compiler says (when added to the chart): bgcolor() display argument only supports display.none and display.all. For barcolor the message names barcolor(). To own the whole bar rather than recolor it, use plotcandle (see Plotting).