DefineColor ( String name, CustomColor color);
Defines a named color for a plot with the default color value. This color can be changed in the Edit Studies dialog.
|name||-||Defines the name of the color.|
|color||-||Defines color to be used with specified name.|
input length = 12;
plot Momentum = close - close[length];
Momentum.AssignValueColor(if Momentum >= 0 then Momentum.Color("Positive") else Momentum.Color("Negative"));
This example paints the
Momentum plot in different colors according to its trend. The
DefineColor function defines Positive and Negative color names as aliases for
Color.DOWNTICK constants. You can change the colors in the Edit Studies dialog and their order is the same as in the source code. If the trend of the plot is positive then it is painted in Positive (Uptick) color. If the trend is negative, the plot is painted in Negative (Downtick) color.
Note that in order to refer to a specific color the code uses the