How to Change the color of iMA()?

 

 I tried to change the color of the 2 iMA lines below, but failed.

What's wrong with the codes? How to fix? Thanks. 

 

   double MAShortCur=iMA(NULL,MaPeriod,MaShort,0,MaMode,MaPrice,0);
   double MAShortPar=iMA(NULL,MaPeriod,MaShort,0,MaMode,MaPrice,1);
   double MALongCur=iMA(NULL,MaPeriod,MaLong,0,MaMode,MaPrice,0);
   double MALongPar=iMA(NULL,MaPeriod,MaLong,0,MaMode,MaPrice,1);
   SetIndexStyle(0,DRAW_LINE,clrWhite);
   SetIndexStyle(1,DRAW_LINE,clrYellowGreen);
 
moonsboy:

 I tried to change the color of the 2 iMA lines below, but failed.

What's wrong with the codes? How to fix? Thanks. 

 

You're trying to change the indicator buffers 0 and 1, have you assigned the iMA values to buffer 0 and 1 elsewhere in your code? If not, then those buffers will be empty, regardless of what colour you set.