GetColor

GetColor ( int index );

Default values:

index: 0

Description

Returns a color from the color palette. Note that colors in color palettes vary based on the Look and Feel you are using. Regardless of the current Look and Feel, the selection of colors in the palettes ensures optimal data visualization.

The following table lists the available colors for different look and feel settings.

Index

Dark

Light

0

 

 

 

1

2

3

4

5

6

 

7

8

9

Calling GetColor with any index outside of this range is equal to calling GetColor(AbsValue(index) % 10), that is, the same 10 colors are repeated in a cycle.

Input parameters

Parameter Default value Description
index - Defines the number of the color from the predefined palette.

Example

input length = 12;
plot SMA = SimpleMovingAvg(close, length);
plot EMA = MovAvgExponential(close, length);

SMA.SetDefaultColor(GetColor(1));
EMA.SetDefaultColor(GetColor(5));

This script plots two lines: the 12 period simple moving average and the exponential moving average of the Close price using colors 1 and 5 from the predefined palette, respectively.