Lipi Reference
Lipi

Functions

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.

Syntax

                bgcolor(series color color, const string title, input int offset, const bool force_overlay) → void
              

Arguments

color series color Color of the filled background. You can use predefined constants such as 'blue' or '#00ff7f', as well as complex expressions like 'close >= open ? color.yellow : color.blue'. This is a required argument.
title const string Title of the bgcolor. Optional argument
offset input int Shifts the color series to the left or to the right on the given number of bars. Default is 0.
force_overlay const bool If true, the plotted results will display on the main chart pane, Optional. The default is false.

Return Type

void

Example


          //@lipi=2
indicator("Custom Background Color", overlay=true)
bullish = close > open
bearish = close < open
bgColor = bullish ? color.green : bearish ? color.red : na
bgcolor(bgColor)