- enables background gradient color fill in indicators

(AFL 2.90)

SYNTAX SetChartBkGradientFill( topcolor, bottomcolor, titlebkcolor = default, miny= Null, maxy = Null )
FUNCTION Enables background gradient color fill in indicators.

Please note that this is independent from chart background color (background color fills entire pane, gradient fill is only for actual chart interior, so axes area is not affected by gradient fill)

  • topcolor - specifies top color of the gradient fill
  • bottomcolor - specifies bottom color of the gradient fill
  • titlebkcolor - (optional) the background color of title text. If not specified then top color is automatically used for title background.
  • miny, maxy - (optional, new in 5.30) - allows gradient area charts in combination with cloud style (see example 2 below)

Example 1: basic background gradient

SetChartBkGradientFill( ParamColor("BgTop", colorWhite),ParamColor("BgBottom", colorLightYellow));

Example 2: area gradient chart

function PlotGradientArea( array, caption, ColorTop, ColorBottom )
bkclr =

HH =
HighestVisibleValue( array );
if( NOT IsNull( hh ) ) SetChartBkGradientFill( ColorTop, ColorBottom, bkclr, Null, HH );
Plot( array, Caption, ColorBlend( ColorBottom, colorBlack ) );
PlotOHLC( HH, HH, array, HH, "", bkclr, styleNoLabel | styleNoTitle | styleCloud, Null, Null, 0, -10 );

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
C, "Close", ParamColor("Top", colorLightOrange), ParamColor("Bottom", colorPaleGreen ) );


SEE ALSO PLOT() function , PLOTFOREIGN() function , PLOTGRID() function , PLOTOHLC() function , PLOTSHAPES() function , PlotText() function , PLOTVAPOVERLAY() function


The SetChartBkGradientFill function is used in the following formulas in AFL on-line library:

More information:

Updated on-line reference