EA Help, Identifying Highest High

Back to topics list To post a new topic, please log in or register
avatar
4
sebwelch 2015.08.20 08:43
 

Hi,

 

I am having some trouble trying to identify the highest high for the last x number of candles.

I already have a for loop running to identify other Highs and Lows.

- The for loop has to work backwards from eg 10 candles to the live candle. 

Any help is greatly appreciated

 

Thanks in advance 

avatar
Moderator
3427
GumRai 2015.08.20 09:06 #
 
   int highest_shift=iHighest(Symbol(),0,MODE_HIGH,10,0);
   double highest_value =High[highest_shift];
   
   //Or as 1 line
   double highest_value =High[iHighest(Symbol(),0,MODE_HIGH,10,0)];
To find the highest high of the last 10 bars including the current bar
avatar
4
sebwelch 2015.08.20 09:10 #
 

That is great thanks

 

What if I didn't want to include the live candle/bar? 

avatar
Moderator
3427
GumRai 2015.08.20 09:37 #
 
sebwelch:

That is great thanks

 

What if I didn't want to include the live candle/bar? 

int highest_shift=iHighest(Symbol(),0,MODE_HIGH,10,0);

gets the highest shift from bar shift 0 to and including bar shift 9, a total of 10 bars 

 

Just change the last 0 to a 1, then you will get the highest shift of the last 10 closed bars. ie from the bar shift 1 to and including bar shift 10.

   int highest_shift=iHighest(Symbol(),0,MODE_HIGH,10,1);

Make sure that you read the documentation and fully understand the function. 

Back to topics list  

To add comments, please log in or register