Download MetaTrader 5

Help Please on iHighest

To add comments, please log in or register
Have you found an error in our products? Apply to Service Desk!
Deepak
20
Deepak 2016.03.06 06:24 

i am new to MQL scripting and looking for some help. 

 Can someone please help me here to understand this piece of code? Is MaxH/MinL looking into the future by period bar to find the highest High and Lowest Low in "period"? 

 The i as Start parameter in iHighest means High is calculated from the future data in this for loop?

   for(int i=0; i<Bars; i++)

    {

      MaxH = High[iHighest(NULL,0,MODE_HIGH,period,i)];

      MinL = Low[iLowest(NULL,0,MODE_LOW,period,i)]; 

 

Thanks for your help!

 

DK 

Keith Watford
Moderator
9614
Keith Watford 2016.03.06 06:40  
The i as Start parameter in iHighest means High is calculated from the future data in this for loop?
The highest is calculated for index i and previous bars, not future bars
Vasyl Nosal
18537
Vasyl Nosal 2016.03.06 10:17  

looking into the future

yes(in history). Most repainting indicators writes like this. 

Deepak
20
Deepak 2016.03.06 20:40  
eevviill:

looking into the future

yes(in history). Most repainting indicators writes like this. 

Then how would it calculate the value for the most recent bar because the future bars are not available yet
Deepak
20
Deepak 2016.03.06 20:45  
eevviill's response seems contradicting GumRai. Strange!!
Vasyl Nosal
18537
Vasyl Nosal 2016.03.06 21:49  
dkpmba:
Then how would it calculate the value for the most recent bar because the future bars are not available yet
I mean history bars.
Deepak
20
Deepak 2016.03.06 22:25  
eevviill:
I mean history bars.

So is it correct to say that MaxH above is the highest high value of previous "Periods" from current bar (i)

 

This is confusing me when Start parameter in iHighest has i which increases with every increase in for loop

 Say period = 8 and current i = 9 below

Would High[iHighest(NULL,0,MODE_HIGH,period,i)]; calculates highest high value from bar 2-9?

i =>> 1 2 3 4 5 6 7 8 9

^ - current i at 9  

Keith Watford
Moderator
9614
Keith Watford 2016.03.06 22:36  
dkpmba:
eevviill's response seems contradicting GumRai. Strange!!

That is because he seems to be on a campaign to contradict me as much as possible. I have no idea why.

I assure you that iHighest cannot work on future bars. It can only check the start index bar (last parameter) and bars previous to that

Keith Watford
Moderator
9614
Keith Watford 2016.03.06 22:39  
dkpmba:

So is it correct to say that MaxH above is the highest high value of previous "Periods" from current bar (i)

 

This is confusing me when Start parameter in iHighest has i which increases with every increase in for loop

 Say period = 8 and current i = 9 below

Would High[iHighest(NULL,0,MODE_HIGH,period,i)]; calculates highest high value from bar 2-9?

i =>> 1 2 3 4 5 6 7 8 9

^ - current i at 9  

No, the start index bar is 9 and it will check 8 bars

so

9 10 11 12 13 14 15 16

Vasyl Nosal
18537
Vasyl Nosal 2016.03.06 23:07  
dkpmba:

So is it correct to say that MaxH above is the highest high value of previous "Periods" from current bar (i)

 

This is confusing me when Start parameter in iHighest has i which increases with every increase in for loop

 Say period = 8 and current i = 9 below

Would High[iHighest(NULL,0,MODE_HIGH,period,i)]; calculates highest high value from bar 2-9?

i =>> 1 2 3 4 5 6 7 8 9

^ - current i at 9  

from 9 to 16 

Deepak
20
Deepak 2016.03.06 23:37  

Damn man! so it works backward and I was thinking forward. So when we say

 for(int i=0; i<Bars; i++)

 

i = 0 is the most recent bar and i = 1 is the bar previous to the most recent one. And I was thinking that i = 0 is the first (historical) bar in the current chart. Thanks guys you rock! 

12
To add comments, please log in or register