Download MetaTrader 5

High[1] & High[iHighest(NULL,0,MODE_HIGH,x,1)]

To add comments, please log in or register
Add our Twitter channel to friends and follow the news!
inquisiteur
69
inquisiteur 2010.02.19 13:02 

Dear All,

 

First I appologize if this question has been answered thouroughly somewhere else in the forum, but I have read anything I could found on that and still lost.

 

If somone could just tell me how to write in MQL5:

 

(in MQL4 )   

If High[1]>High[2] then ...

 

 and

 

the formula for finding the highest value in the last 30 bars:  

(in MQL4)                  -               

High[iHighest(NULL,0,MODE_HIGH,x,1)]

 

I reached a certain level of proficieny in MQL4 after 2 years of non-intensive coding, but now I must admit I am lost again, if anyone could help I would be grateful.

Paul
784
Paul 2010.02.21 15:49  
inquisiteur posted  :

Dear All,

 

First I appologize if this question has been answered thouroughly somewhere else in the forum, but I have read anything I could found on that and still lost.

 

If somone could just tell me how to write in MQL5:

 

(in MQL4 )   

 

 and

 

the formula for finding the highest value in the last 30 bars:  

(in MQL4)                  -               

 

I reached a certain level of proficieny in MQL4 after 2 years of non-intensive coding, but now I must admit I am lost again, if anyone could help I would be grateful.

 

 

Check out the timeseries porting library at https://www.mql5.com/en/forum/121011/page14

Paul

http://paulsfxrandomwalk.blogspot.com/ 

Beta Testing of MetaTrader 5 Has Started! - MQL4 forum
  • www.mql5.com
Beta Testing of MetaTrader 5 Has Started! - MQL4 forum
inquisiteur
69
inquisiteur 2010.02.23 11:16  
phampton:

Check out the timeseries porting library at https://www.mql5.com/en/forum/121011/page14

Paul

http://paulsfxrandomwalk.blogspot.com/ 

 

Thank you for your response.

 

What I am looking for is not workarounds but how the code should be done in MQL5, unless this is the only way to proceed ?

 

I mean how can I proceed to have If High[1]>High[2] then using the MQL5 way, as if MQL4 never existed ?

 

Many thanks and regards,

 

inquisiteur 

Paul
784
Paul 2010.02.23 13:09  
inquisiteur:

Thank you for your response.

 

What I am looking for is not workarounds but how the code should be done in MQL5, unless this is the only way to proceed ?

 

I mean how can I proceed to have If High[1]>High[2] then using the MQL5 way, as if MQL4 never existed ?

 

Many thanks and regards,

 

inquisiteur 

It's not really a workaround - the code that's in the timeseries file I posted gives a strong pointer to the way that you must code it in MQL5, although you don't need a function call each time.

Here's the relevant function

double iHigh(string symbol,int tf,int index)
{
   if(index < 0) return(-1);
   double Arr[];
   ENUM_TIMEFRAMES timeframe=TFMigrate(tf);
   if(CopyHigh(symbol,timeframe, index, 1, Arr)>0) return(Arr[0]);
   else return(-1);
}

In your case you can take advantage of pulling both values at once

double High[];
if(CopyHigh(_Symbol,_Period,1,2,High)<2)
  {
   Print("error getting high values");
  }
// High[0] and High[1] because CopyHigh starts at shift=1
if(High[0]>High[1])
  {
// 
  }

 

Paul

http://paulsfxrandomwalk.blogspot.com/ 

Regularly emailing the status of an account
  • 2012.06.14
  • Paul
  • paulsfxrandomwalk.blogspot.com
Prompted by a query, I thought I'd post a useful little utility that I have used for ages which emails the status of the account every hour.  After lengthy deliberation I decided to call it .... EmailStatus.  With only a small modification it could be used to log the status to a file, and the time...
inquisiteur
69
inquisiteur 2010.02.24 18:15  
phampton:

It's not really a workaround - the code that's in the timeseries file I posted gives a strong pointer to the way that you must code it in MQL5, although you don't need a function call each time.

Here's the relevant function

In your case you can take advantage of pulling both values at once

 

Paul

http://paulsfxrandomwalk.blogspot.com/ 

 

 

 

Thank you so much
To add comments, please log in or register