English

## How do you find the high/low of a certain period?

 13130 WHRoeder 2011.01.15 19:36 #   felipefxr 2011.01.14 23:56 I tried looking up at the code base and the book but the Period ends in MN1, which is based on current bar or before. I needed something a bit more specific for the month and year. What's the best way to find the highest high/lowest low of a specific month or group of months in mql4? ```High = iHigh(NULL, 0, iHighest(NULL,0,MODE_HIGH,PERIOD,0) ); Low  =  iLow(NULL, 0, iLowest(NULL,0, MODE_LOW,PERIOD,0) );``` This will return H/L on the current chart for PERIOD bars back. You need find the first and last bars in the period your interested in, either by counting or iBarsShift a specific date. ```datetime fromDT = ...,            toDT = ...; int      fromBar = iBarShift(NULL, 0, fromDT),            toBar = iBarShift(NULL, 0,   toDT),           length = fromBar - toBar + 1,            HHbar = iHighest(NULL,0, MODE_HIGH, length, toBar),            LLbar =  iLowest(NULL,0, MODE_LOW,  length, toBar); double     HH    = High[HHbar], // iHigh(NULL,0, HHbar)            LL    =  Low[LLbar]; // iLow(NULL,0, LLbar)``` If you are looking back beyond the number of bars on the chart (i.e, months back but on a M1 chart) then you'll have to use a higher TF to get the data, E.G. replace NULL,0 with NULL, PERIOD_W1 similar