retrieving Open and Close values in MQL5

 

Hi MQL5 experts,

I'm trying to retrieve the dynamic array values for the Open and Close values in MQL5 - the equivalent of Open[] and Close[] in MQL4

Here is my attempt which is not working.

Do you guys see any obvious errors in my code? Or is there a more efficient way to retrieve the values?

double Open[];
int counto=0;   // number of elements to copy
ArraySetAsSeries(Open,true);
CopyHigh(_Symbol,_Period,0,counto,Open);

double Close[];
int countc=0;   // number of elements to copy
ArraySetAsSeries(Close,true);
CopyHigh(_Symbol,_Period,0,countc,Close);
 
timothysmith78:

Hi MQL5 experts,

I'm trying to retrieve the dynamic array values for the Open and Close values in MQL5 - the equivalent of Open[] and Close[] in MQL4

Here is my attempt which is not working.

Do you guys see any obvious errors in my code? Or is there a more efficient way to retrieve the values?

Sorry guys, school buy error. I've used "CopyHigh" for my Close code!

Still, always looking for more efficient ways to do things, so chime in if there's a better way!


Regards, Tim

 

Hello you can also directly use 

iOpen(_Symbol,PERIOD_CURRENT,position);

and

iClose(_Symbol,PERIOD_CURRENT,positon); 
 
Marco vd Heijden:

Hello you can also directly use 

Thank you
 
Marco vd Heijden: Hello you can also directly use iOpen() iClose()

Allowed since New MetaTrader 5 Platform build 1860: MQL5 functions for operations with bars and Strategy Tester improvements - MQL5 programming forum 2018.06.14

Two years later still not in the documentation.

Reason: