Download MetaTrader 5

Set Indicator Line Color Through EA

To add comments, please log in or register
Sign up for MQL5.community to post your Forum topic
Henrique Vilela
1231
Henrique Vilela 2015.01.07 16:32 

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
4684
Marco vd Heijden 2015.01.07 18:53  

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
30721
Alain Verleyen 2015.01.07 18:54  
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
1231
Henrique Vilela 2015.01.08 17:23  
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
30721
Alain Verleyen 2015.01.08 18:36  
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
1231
Henrique Vilela 2015.01.08 20:24  
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
30721
Alain Verleyen 2015.01.08 20:27  
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
734
Rafael Zimmermann 2016.03.02 16:41  
To add comments, please log in or register