How to find the Highest High and Lowest Low between time A and time B

 

I am trying to loop through the candles to find the highest high and lowest lowest low between time A and time B. How could I go about doing this in MQL5?

 

Use the below code (MT4 & MT5):

int strt= iBarShift(_Symbol,_Period,datetimeA,false);
int end= iBarShift(_Symbol,_Period,datetimeB,false);
double highest= iHigh(_Symbol,_Period,iHighest(_Symbol,_Period,MODE_HIGH,strt-end+1,end));
double lowest= iLow(_Symbol,_Period,iLowest(_Symbol,_Period,MODE_LOW,strt-end+1,end));
 
Keni Chetankumar Gajanan - #:

Use the below code (MT4 & MT5):

Thank You Keni, I appreciate the assistance.