SetGradientFill
- set the colors of a gradient fill plot

Indicators
(AFL 3.60)


SYNTAX SetGradientFill( topcolor, bottomcolor, baseline = Null, baselinecolor = -1 )
RETURNS NOTHING
FUNCTION The function defines colors for gradient area charts. Gradient chart is obtained using styleGradient in the Plot() function call. Upper gradient color is specified by topcolor, bottom gradient color is specified by botttomcolor. Optional parameters (baseline/baselinecolor) allow reverse gradient chart (such as underwater equity) and 3 color gradients top->baseline->bottom. See code for Underwater Equity for example usage of reverse gradient chart (with baseline at the top). Baseline parameter specifies the Y-axis position of chart baseline. The baselinecolor parameter specifies the color of gradient that is to be used at that level. If baselinecolor is not specified, then only 2-color gradient is plotted (topcolor->bottomcolor).
EXAMPLE // Underwater Equity chart
// (C)2009 AmiBroker.com
// Should be used only on ~~~EQUITY or ~~~OSEQUITY symbol


EQ =
C;
MaxEQ =
Highest( EQ );
DD =
100 * ( Eq - MaxEQ ) / MaxEq;
MaxDD =
Lowest( DD );

Title = StrFormat("Drawdown = %.2g%%, Max. drawdown %.2g%%", DD, LastValue( MaxDD ) );

SetGradientFill( GetChartBkColor(), colorBlue, 0 );

Plot( DD, "Drawdown ", colorBlue, styleGradient | styleLine );

Plot( MaxDD, "Max DD", colorRed, styleNoLabel );

SetChartOptions( 2, 0, chartGridPercent );

if( Name() != "~~~EQUITY" AND Name() != "~~~OSEQUITY"  ) Title = "Warning: wrong ticker! This chart should be used on ~~~EQUITY or ~~~OSEQUITY only";
SEE ALSO Plot() function

References:

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

More information:

Updated on-line reference