Download MetaTrader 5

iHigh iClose

To add comments, please log in or register
Thousands of developers have already published their products in the Market. Join them!
Noufel
28
Noufel 2010.06.20 23:55 

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
784
Paul 2010.06.21 05:35  
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
11815
Rashid Umarov 2010.06.21 10:17  
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
28
Noufel 2010.06.21 11:21  

Thanks Rosh and Paul

Noufel
28
Noufel 2010.06.21 11:38  

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
11815
Rashid Umarov 2010.06.21 11:40  
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
Zar88
64
Zar88 2016.10.13 21:14  
"CopyLow" on the Low
"CopyHigh" on the high

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