CExpert:Init : adjust period and symbol

 

According to the CExpert class (of StandardLib), we must always use the current symbol (_Symbol) or period (_Period):

// See line 240
//+------------------------------------------------------------------+
//| Initialization and checking for input parameters                 |
//+------------------------------------------------------------------+
bool CExpert::Init(string symbol,ENUM_TIMEFRAMES period,bool every_tick,ulong magic)
  {
//--- returns false if the EA is initialized on a symbol/timeframe different from the current one
   if(symbol!=::Symbol() || period!=::Period())
     {
      PrintFormat(__FUNCTION__+": wrong symbol or timeframe (must be %s:%s)",symbol,EnumToString(period));
      return(false);
     }

Why? I mean, why does the StandardLib provide a method with the parameters symbol and period if we can't actually use those parameters freely? I could override this method to allow it, but then I would have to consider what consequences this extended option (=setting arbitrary symbols or periods) has on the initialization of the other components.

Has anyone here had the same experience and found a correct solution to the problem?

 
harryma23:

According to the CExpert class (of StandardLib), we must always use the current symbol (_Symbol) or period (_Period):

Why? I mean, why does the StandardLib provide a method with the parameters symbol and period if we can't actually use those parameters freely? I could override this method to allow it, but then I would have to consider what consequences this extended option (=setting arbitrary symbols or periods) has on the initialization of the other components.

Has anyone here had the same experience and found a correct solution to the problem?

Ok. Found the answer: https://www.mql5.com/en/forum/406072

Not really nice to start from scratch..