How to get the highest price within a given minutes ?

 

For instance,I need to get the highest price in the past 75 minutes on the current chart .

I used the following codes to get it, but it did not work well, because there are always some bars missing,especially on M1 charts.

......
extern int StartBar = 0;
extern int BarsBack = 75;
......
int lowest_bar = iLowest(NULL,0,MODE_LOW,BarsBack,StartBar);
int highest_bar = iHighest(NULL,0,MODE_HIGH,BarsBack,StartBar);

double higher_point = 0;
double lower_point = 0;

higher_point=High[highest_bar];
lower_point=Low[lowest_bar];

Thanks

 

iHighest(NULL,0...) will only have you in the past 75 minutes if you run on the 1 minute chart. On the hour chart you get the last 75 hours

Change the 0 to 1

 
WHRoeder wrote >>

iHighest(NULL,0...) will only have you in the past 75 minutes if you run on the 1 minute chart. On the hour chart you get the last 75 hours

Change the 0 to 1

Got it.

Thank you.