highest/lowest over a period

 

I try to find highest and lowest price during the last 3 months with following code
double highestprice, lowestprice;
highestprice=High[iHighest(NULL,PERIOD_D1,MODE_HIGH,90,1)];
lowestprice=Low[iLowest(NULL,PERIOD_D1,MODE_LOW,90,1)];

It works fine if chart window is D1 but gives wrong results if chart window is other than D1. Looked up on forum and other places, some suggested using ihigh/ilow in place of high/low but it gives error. if use ihigh/ilow like this way iHigh(Null,PERIOD_D1,90) it gives high and low of 90th bar rather than highest of previous 90 bars of PERIOD_D1. I feel it is a bug. Suggestions would be very much appreciated. Thanks

 
highestprice=iHigh(symbol, PERIOD_D1, iHighest(symbol,PERIOD_D1,MODE_HIGH,90,1));
 
phy wrote >>
highestprice=iHigh(symbol, PERIOD_D1, iHighest(symbol,PERIOD_D1,MODE_HIGH,90,1));

Excellent, working very well. Thank you very much

 
hamidraza:

Excellent, working very well. Thank you very much

Is there a way to define a specific time period rather than 90 days? For example, from 0100 - 0900?


Thanks.

 

i want


when i make

sell order the Bid price should not be less       than the Ask price of last buy order or position 

buy order the Ask price should not be greater than the Bid price of  last sell  order or position 

and also how i can get highestprice and lowest price and average price so i can inclde the to buy or sell instead of Ask and Bid price

thanks