Download MetaTrader 5

Timeframe as input parameter with CExpert class

To add comments, please log in or register
FiaMeta5admiral
372
FiaMeta5admiral  

Can the timeframe be the input parameter when it is transmitted to the CExpert class?

I try 

input ENUM_TIMEFRAMES pPeriod = PERIOD_CURRENT;


int OnInit() {  

pPeriod = iPeriod; if(pPeriod == PERIOD_CURRENT ){pPeriod = Period();}

ChartFirstID = ChartFirst(); if(ChartPeriod(ChartFirstID)!= pPeriod){

      Print("Not the same");       if(ChartSetSymbolPeriod(ChartFirstID,ChartSymbol(ChartFirstID),pPeriod)){          Print("Ok");          Print(" pPeriod "+pPeriod+" Period() "+Period()+" ChartPeriod(ChartFirstID) "+ChartPeriod(0));       }       while ( ChartPeriod(0) != pPeriod){ Sleep(1500);          ChartSetSymbolPeriod(0,_Symbol,pPeriod);       }    } else {        Print("Same");    }

But chart Timeframes has not been changed and  CExpert on Init   class 

   if(!ExtExpert.Init(Symbol(),pPeriod,EveryTick, magic)) { printf(__FUNCTION__+": error initializing expert"); ExtExpert.Deinit(); return(INIT_FAILED); }


return error wrong symbol or timeframe (must be EURUSD:PERIOD_H2)


To add comments, please log in or register