retrieving Open and Close values in MQL5

To add comments, please log in or register
Timothy Smith
213
Timothy Smith  

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);
Timothy Smith
213
Timothy Smith  
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

Marco vd Heijden
Moderator
12989
Marco vd Heijden  

Hello you can also directly use 

iOpen(_Symbol,PERIOD_CURRENT,position);

and

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

Hello you can also directly use 

Thank you
William Roeder
22318
William Roeder  
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.

To add comments, please log in or register