Change color of line dynamically

 

It is so hard to code to make the line (i.e. MyBuffer1) to have different colors while some conditions change...


How to do that? Is there any update?

 
You use two buffers with different colors. HOW CAN I hide CONNECTION lines of plots? (ttt) - MQL4 forum
 

and what if i want use line with 3,4,5,6 different colors?


why wont MQL give a simplest simplest thing, like :    


if(myCond) {

   MyBuffer1[i].color = red;

}


or etc...

 
selnomeria: why wont MQL give a simplest simplest thing, l
  1. Because that's how they wrote it a decade plus years ago.
  2. This isn't Burger King - you don't get it your way. Live with it, or move on.
 
selnomeria:

and what if i want use line with 3,4,5,6 different colors?


why wont MQL give a simplest simplest thing, like :    


if(myCond) {

   MyBuffer1[i].color = red;

}


or etc...

In metatrader 4, if you want to draw multi color lines, you have to use additional 2 buffers for each additional color. If you don't (if you use only one buffer per additional color), you will get a repainting indicator

That condition is true if you want to draw muti color LINES. For other types of drawing styles you do not have to do that

 
Mladen Rakic: ou have to use additional 2 buffers for each additional color.
  1. No you need one buffer per color. You set all the others to empty. No repainting.
  2. Previously answered. See link in #1