iHigh iClose

To add comments, please log in or register
Noufel
33
Noufel  

Dear Friends

I was using this codes to get todays high and yesterdays low values in MT4. 

  double ToDayHigh=iHigh(NULL,1440,0);
  double YesterDayLow=iLow(NULL,1440,1);

 Whats the code in MQL5 for the same.

Thanks

 

Noufel 

Paul
744
Paul  
1007:

 

Dear Friends

I was using this codes to get todays high and yesterdays low values in MT4. 

  double ToDayHigh=iHigh(NULL,1440,0);
  double YesterDayLow=iLow(NULL,1440,1);

 Whats the code in MQL5 for the same.

Thanks

 

Noufel 

 

 try this

Paul 

double ToDayHigh=iHigh(_Symbol,PERIOD_D1,0);
double YesterDayLow=iLow(_Symbol,PERIOD_D1,1);

double iLow(string strSymbol,ENUM_TIMEFRAMES tf,int nShift)
{
   double timeseries[1];
   if(CopyLow(strSymbol,tf,nShift,1,timeseries)==1) return(timeseries[0]);
   else return(-1.0);
}
double iHigh(string strSymbol,ENUM_TIMEFRAMES tf,int nShift)
{
   double timeseries[1];
   if(CopyLow(strSymbol,tf,nShift,1,timeseries)==1) return(timeseries[0]);
   else return(-1.0);
}

 

Rashid Umarov
Admin
14262
Rashid Umarov  
1007:

 

Dear Friends

I was using this codes to get todays high and yesterdays low values in MT4.

Please, read article MQL5.community - User Memo :

The   button of the object inserting menu is intended to insert the initial MQL code into the text of the message. An empty window to paste the code in appears as soon as you press this button. In order to finish code adding you should press the Insert button. To cancel the operation you should press the Cancel button. The example of inserting the code is given at the corresponding section.

Noufel
33
Noufel  

Thanks Rosh and Paul

Noufel
33
Noufel  

I am getting the description

'=' - constant expression is required 

when i am trying to compile in mql5 for the code

string symbol=Symbol();

Whats the soln please

 

Noufel 

Rashid Umarov
Admin
14262
Rashid Umarov  
1007:

I am getting the description

'=' - constant expression is required 

when i am trying to compile in mql5 for the code


Don't use such expression on global scope. See sections Initialization of Variables and Visibility Scope and Lifetime of Variables
Baumann Andrea
146
Baumann Andrea  
"CopyLow" on the Low
"CopyHigh" on the high

And now the code works perfect...
To add comments, please log in or register