Download MetaTrader 5

Set Indicator Line Color Through EA

To add comments, please log in or register
Henrique Vilela
1457
Henrique Vilela  

Hi guys,

How to change an indicator line color after add it to the chart by an expert advisor?

My EA uses two moving averages so would be great if I could visually set them apart. 

Marco vd Heijden
Moderator
5306
Marco vd Heijden  

color is the last object parameter and there are many ways to make it change after the EA has been loaded.

ObjectSetInteger(0,name,OBJPROP_COLOR,clrBlack);
Alain Verleyen
Moderator
32809
Alain Verleyen  
HVilela:

Hi guys,

How to change an indicator line color after add it to the chart by an expert advisor?

My EA uses two moving averages so would be great if I could visually set them apart. 

You can't.
Henrique Vilela
1457
Henrique Vilela  
angevoyageur:
You can't.

That's sad.

At the moment I'm thinking about to copy the indicator and change the default color, so I'll have two indicators with the same functionality and different default colors.

I know it's a terrible workaround, but that's the best idea I had so far.

Anyone with a "less terrible" idea to solve this problem?

Alain Verleyen
Moderator
32809
Alain Verleyen  
HVilela:

That's sad.

At the moment I'm thinking about to copy the indicator and change the default color, so I'll have two indicators with the same functionality and different default colors.

I know it's a terrible workaround, but that's the best idea I had so far.

Anyone with a "less terrible" idea to solve this problem?

If you can change the indicator's code, then you have other option, see this topic https://www.mql5.com/en/forum/13373
Henrique Vilela
1457
Henrique Vilela  
angevoyageur:
If you can change the indicator's code, then you have other option, see this topic https://www.mql5.com/en/forum/13373
That's not ideal but is much better. Thank you.
Alain Verleyen
Moderator
32809
Alain Verleyen  
HVilela:
That's not ideal but is much better. Thank you.
The easiest solution when you can modify the indicator's code is to add some parameters for the colors or anything else you want to modify.
Rafael Zimmermann
803
Rafael Zimmermann  
To add comments, please log in or register