Changes the color of line segments

 

Define 10 colors for coloring each bar

#property indicator_color1  clrGreen,clrRed,clrYellow,clrViolet,clrBlack,clrGreen,clrRed,clrYellow,clrViolet,clrBlack

Why in Properties only show 8 colors?

Properties

 
Nguyen Van Luong:

Define 10 colors for coloring each bar

Why in Properties only show 8 colors?

Can you use something like this?
string currencyColors[]={
  "clrGreen",
  "clrRed",
  "clrYellow",
  "clrViolet",
  "clrBlack",
  "clrGreen",
  "clrRed",
  "clrYellow",
  "clrViolet",
  "clrBlack"
};

for ( int j=0;j<ArraySize(currencyColors);j++ )
{
    PlotIndexSetInteger(j, PLOT_DRAW_TYPE, DRAW_LINE);
    PlotIndexSetInteger(j, PLOT_LINE_COLOR, StringToColor(currencyColors[j]));
    PlotIndexSetInteger(j, PLOT_LINE_STYLE, STYLE_SOLID);
    PlotIndexSetInteger(j, PLOT_LINE_WIDTH, 1);
}
 
Anthony Garot:
Can you use something like this?

Thank you for your help. But your way DRAW_LINE. I wanna DRAW_COLOR_LINE

 
Nguyen Van Luong:

Thank you for your help. But your way DRAW_LINE. I wanna DRAW_COLOR_LINE

Ah yes. My answer doesn't fit your question. Sorry about that. Not enough coffee when I answered.

The ChangeColors() function here may help:

https://www.mql5.com/en/docs/customind/indicators_examples/draw_color_line

From the documentation, it appears you should be able to do 64 colors. I'm not sure if they can be defined in the #property compiler directive or only dynamically.

 
Anthony Garot:

Ah yes. My answer doesn't fit your question. Sorry about that. Not enough coffee when I answered.

The ChangeColors() function here may help:

https://www.mql5.com/en/docs/customind/indicators_examples/draw_color_line

From the documentation, it appears you should be able to do 64 colors. I'm not sure if they can be defined in the #property compiler directive or only dynamically.

Thank you so much.
Reason: