Download MetaTrader 5

how to convert the Open[x] High[x] Low[x] Close[x] from MQL4 to MQL5 ?

To add comments, please log in or register
madruga trader
66
madruga trader  

these variables are not available on mql5

 

what function can i construct to better emulate these Open[0] High[0] Low[0] Close[0]  ? 

honest_knave
Moderator
2326
honest_knave  

You'll find your answer in here.

PS - probably best not to double post, people don't like it ;-)

madruga trader
66
madruga trader  
honest_knave:

You'll find your answer in here.

PS - probably best not to double post, people don't like it ;-)

i was already following this article.... but they not tell everything there...

 

to simplify the conversion i did these functions.. im not experienced enough to see if these are the best commands for indicators could you tell about ? 

 -----------------------------

 -----------------------------

 -----------------------------

 

  double _open(int index)

{   

   if(index < 0) return(-1);

   double Arr[];

   if(CopyOpen(_Symbol,_Period, index, 1, Arr)>0) return(Arr[0]);

   else return(-1);

}

double _low(int index)

{

   if(index < 0) return(-1);

   double Arr[];

  

   if(CopyLow(_Symbol,_Period, index, 1, Arr)>0) return(Arr[0]);

   else return(-1);

}

double _high(int index)

{

   if(index < 0) return(-1);

   double Arr[];


   if(CopyHigh(_Symbol,_Period, index, 1, Arr)>0) return(Arr[0]);

   else return(-1);

}

double _close(int index)

{

   if(index < 0) return(-1);

   double Arr[];


   if(CopyClose(_Symbol,_Period, index, 1, Arr)>0) return(Arr[0]);

   else return(-1);

}

datetime _time(int index)

{

   if(index < 0) return(-1);


   datetime Arr[];

   

   if(CopyTime(_Symbol,_Period, index, 1, Arr)>0) return(Arr[0]);

   else return(-1);

}


int _bars(){


return Bars(_Symbol,_Period);


//int teste = Bars(_Symbol,_Period);


}

double _bid(){

 

 //double Ask=SymbolInfoDouble(_Symbol,SYMBOL_ASK);

return SymbolInfoDouble(_Symbol,SYMBOL_BID);

   

Alain Verleyen
Moderator
34448
Alain Verleyen  

Forum on trading, automated trading systems and testing trading strategies


I strongly suggest you to do some searches before creating new topics.

Your questions have been asked and  answered numerous times.

This topic will be removed.

To add comments, please log in or register