NormGradientColor (Function)

image\trumpet2.gif Disclaimer

The NormGradientColor function returns a gradient color relative to the current bar value over the specified range of bars.

Syntax

NormGradientColor(DataSeriesValue, CrossesZero, ColorNormLength, UpColor, DnColor)

Returns (Integer)

A numeric color value relative to a range of color gradient values over a specified number of bars.

Parameters

Name

Type

Description

DataSeriesValue

Numeric

Specifies which bar value (price, function, or formula) to use.

CrossesZero

TrueFalse

Set to True if the DataSeries value can ever be negative, otherwise False.

ColorNormLength

Numeric

Set  the number of bars to consider for the high and low values

UpColor

Numeric

Sets the highest color value of the gradient.

DnColor

Numeric

Sets the lowest color value of the gradient.

Remarks

If the current bar value is at or near the highest value over the past ColorNormLength bars, the color returned will be close to UpColor.  If the current bar's closing value is at or near its lowest closing value over the last n bars, the color value returned will be close to DnColor.

Example

To calculate the gradient color value within the range of colors from Red to Yellow of MyVolume based on the last 20 bars, you would write:

Value1 = NormGradientColor(MyVolume,false,20,Yellow,Red);