Change Indicator Line Color(Repeated Question After 5 Years)

To add comments, please log in or register
Boob Wood
181
Boob Wood  

this is a way to use MA in our code. but how can we change the style of line in the code?

I want two MOVING AVERAGE indicatror showed in page with two different color.

MA_Handle =iMA(NULL,PERIOD_M1,MA_Period,MA_Shift,MODE_SMA,PRICE_CLOSE);

something like this, with-ought using Chart Templates.

MA_Handle =iMA(NULL,PERIOD_M1,MA_Period,MA_Shift,MODE_SMA,PRICE_CLOSE,MA_Line_Color,MA_Line_Width);
                                                                      ?????????????,????????????? 
Keith Watford
Moderator
23535
Keith Watford  
Boob Wood:

this is a way to use MA in our code. but how can we change the style of line in the code?

I want two MOVING AVERAGE indicatror showed in page with two different color.

something like this, withought using chart Templet.

What is a templet?

You get a handle to be able to access the MA values. Nothing is shown on the chart. You can't change line style/colour with the handle.

Boob Wood
181
Boob Wood  
Keith Watford:

What is a templet?

You get a handle to be able to access the MA values. Nothing is shown on the chart. You can't change line style/colour with the handle.

Sorry,  Chart Templates is correct.

Boob Wood
181
Boob Wood  

seems I have same problem.

Still no way to do it.

https://www.mql5.com/en/forum/38961

Set Indicator Line Color Through EA
Set Indicator Line Color Through EA
  • 2015.01.07
  • www.mql5.com
Hi guys, How to change an indicator line color after add it to the chart by an expert advisor...
Marco vd Heijden
Moderator
13068
Marco vd Heijden  

Create another copy of the same indicator just with a different color and call them both.

Or copy the buffers and redraw them, you can use a different color for each candle.

Or create the indicator with 20 buffers that have the same data just a different color and only use the one with the desired color.

There are so many ways to accomplish something why do you say 

Boob Wood:

Still no way to do it.

Boob Wood
181
Boob Wood  
Boob Wood:

seems I have same problem.

Still no way to do it.

https://www.mql5.com/en/forum/38961

I temporarily solved the problem.   

Copied MA.MQL5 into MA_RED.MQL5 And MA_BLUE.MQL5 I changed the color in the source of them and using handles using ICustom.

I know it is not a processional solution, but it solved my problem. 

Will be happy to see your solutions too. 

  MA_Blue_Handle  =iCustom(NULL,PERIOD_M1,"MA_Blue",MovingBluePeriod,0,MODE_SMA,PRICE_CLOSE);
  MA_Red_Handle   =iCustom(NULL,PERIOD_M1,"Ma_Red" ,MovingRedPeriod ,0,MODE_SMA,PRICE_CLOSE);
Boob Wood
181
Boob Wood  
Marco vd Heijden:

Create another copy of the same indicator just with a different color and call them both.

Or copy the buffers and redraw them, you can use a different color for each candle.

Or create the indicator with 20 buffers that have the same data just a different color and only use the one with the desired color.

There are so many ways to accomplish something why do you say 

Thanks. I found one of them. Your comment appriciated.

thanks so much.

Alain Verleyen
40437
Alain Verleyen  
Boob Wood:

I temporarily solved the problem.   

Copied MA.MQL5 into MA_RED.MQL5 And MA_BLUE.MQL5 I changed the color in the source of them and using handles using ICustom.

I know it is not a processional solution, but it solved my problem. 

Will be happy to see your solutions too. 

If you are to make a custom version, just add the colors as standard parameters and apply them to your buffers in the code.
Ahmet Metin Yilmaz
5369
Ahmet Metin Yilmaz  
Boob Wood :

I temporarily solved the problem.   

Copied MA.MQL5 into MA_RED.MQL5 And MA_BLUE.MQL5 I changed the color in the source of them and using handles using ICustom.

I know it is not a processional solution, but it solved my problem. 

Will be happy to see your solutions too. 

You now have 2 MA indicators :)

Congratulations

To add comments, please log in or register