How to make EMA colored by default for an EA using MQL5?

Viewed 16

May I ask how to change color of EMA in MQL5? I have two EMA in an EA and both of them by default has a same color (red), and I want to display them in different colors by default.

struct EMA_STRUCT
  {
   double            ema[];
   int               handle;

  };

input int ema1_period= 10; //EMA1 period(lowest)
input int ema2_period= 25; //EMA2 period

int OnInit()
  {
   if(ema1_period !=0)
     {
      ArrayResize(ema_struct,ArraySize(ema_struct)+1);
      ema_struct[ArraySize(ema_struct)-1].handle= iMA(_Symbol,PERIOD_CURRENT,ema1_period,0,MODE_EMA,PRICE_CLOSE);
      ChartIndicatorAdd(0,0,ema_struct[ArraySize(ema_struct)-1].handle);
      ArraySetAsSeries(ema_struct[ArraySize(ema_struct)-1].ema,true);
     }
   if(ema2_period !=0)
     {
      ArrayResize(ema_struct,ArraySize(ema_struct)+1);
      ema_struct[ArraySize(ema_struct)-1].handle= iMA(_Symbol,PERIOD_CURRENT,ema2_period,0,MODE_EMA,PRICE_CLOSE);
      ChartIndicatorAdd(0,0,ema_struct[ArraySize(ema_struct)-1].handle);
      ArraySetAsSeries(ema_struct[ArraySize(ema_struct)-1].ema,true);
     }
   panel_creator();
   panel_updater();
//---
   return(INIT_SUCCEEDED);
  }

Would hihgly appreciate any suggestion, to make this ema into colored lines by default. Thanks, look forward to the suggestions.

Regards.

0 Answers
Related