CiMA changing indicator colour

 

Hi guys below is a code for a simple moving average add to chart expert. How would I change the colour of the indicator from the code??? What if I had several indicators such as bollinger bands, momentum in a sub-window and two moving averages what would be the easiest way to change the colour???

 Is there anyway to do it by calling a method of the "_EMA" variable???

 Thank you for help again. 

 

//+------------------------------------------------------------------+
//|                                                      testing.mq5 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

#include <Expert\Expert.mqh>
#include <Indicators\Trend.mqh>

CExpert ExtExpert;

CiMA *_EMA = new CiMA;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  
 if(!ExtExpert.Init(Symbol(),Period(),false, 10089))
     {
      //--- failed
      Alert(GetLastError(),": error initializing expert");
      return(INIT_FAILED);
     }
     
       if(_EMA==NULL)
     {
      //--- failed
      Alert(GetLastError(), ": error creating signal, _EMA");
      return(INIT_FAILED);
     }
     
   bool EMAcreate =_EMA.Create(_Symbol, _Period, 100, 0, MODE_EMA, PRICE_CLOSE);
   
    if (!EMAcreate)
   {
   Alert(GetLastError(), ": error creating indicator, _EMA");
      return(INIT_FAILED);
   }

   _EMA.AddToChart(0,0);
   
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
 
You can't change indicator's colors from an EA.
 
ok thank you for reply :)
 
angevoyageur:
You can't change indicator's colors from an EA.

hi Alain,

if we use " ChartIndicatorAdd "  in our indicator, in this case can change as we want ?

 
TIMisthebest:

hi Alain,

if we use " ChartIndicatorAdd "  in our indicator, in this case can change as we want ?

No, the standard indicator's colors can't be changed by an EA.

To do that you need to change the indicator's code in some way. Either by using input parameters for colors or any other technique.