How to get 1hr candle high/low values in 30m chart?

 

Hi,

I have written EA using 2 strategies.

one is using custom indicator with 30 minute timeframe. another strategy is no indicators. its pure breakout system. i take first 10 1hr candle high/low and place buystop/sellstop with highest/lowest price .my custom indicator startegy works well with 30min timeframe.i don't like to write different EA for breakout.so i coded combined 2 strategies.

when i test the ea with 30min timeframe it takes only 10 30min candles high/low.

here is code where i take highest/lowest price.

Please support me to get solved.

#define  ZEROAM 00
#define ELEVENAM 11
elevenAM=0; while( TimeHour(Time[elevenAM]) != ELEVENAM ) elevenAM++;
High0To11 = High[iHighest(NULL,0,MODE_HIGH, ELEVENAM-ZEROAM+1,elevenAM)];
Low0To11 = Low[iLowest(NULL,0,MODE_LOW, ELEVENAM-ZEROAM+1,elevenAM)];
 
Looking at your code, it appears to find the high and low of the first 12 candles of each day on the H1 chart
 
GumRai:
Looking at your code, it appears to find the high and low of the first 12 candles of each day on the H1 chart

Yes. but i apply EA in 30min timeframe. so it takes last 12 candles 30min. not 1hour.


Any one support!

 
sheriffonline:

Yes. but i apply EA in 30min timeframe. so it takes last 12 candles 30min. not 1hour.


Any one support!

Read the documentation for iHighest() and iLowest() and specify the correct timeframe . . . PERIOD_H1 and then read the documentation for iHigh() and iLow()
 
RaptorUK:
Read the documentation for iHighest() and iLowest() and specify the correct timeframe . . . PERIOD_H1 and then read the documentation for iHigh() and iLow()


Yes.i changed timeframe for1hour.but still it reads 30min tf datas.


High0To11 = High[iHighest(NULL,PERIOD_H1,MODE_HIGH, ELEVENAM-ZEROAM+1,elevenAM)];
Low0To11 = Low[iLowest(NULL,PERIOD_H1,MODE_LOW, ELEVENAM-ZEROAM+1,elevenAM)];
 
sheriffonline:

Yes.i changed timeframe for1hour.but still it reads 30min tf datas.

You need to read all the information I posted . . .

RaptorUK:
. . . . and then read the documentation for iHigh() and iLow()
 
sheriffonline:

Yes.i changed timeframe for1hour.but still it reads 30min tf datas.



With your code it reads the shift of the current chart, not H1.

eg if the highest bar is shift 5 on the H1 chart, you are reading High[5] on the M30 chart which is obviously not what you want.

Raptor has already pointed you towards iHigh and iLow

 
RaptorUK:

You need to read all the information I posted . . .


Yes. got it. works fine.


High0To11 = iHigh(NULL,PERIOD_H1,iHighest(NULL,PERIOD_H1,MODE_HIGH, ELEVENAM-ZEROAM+1,elevenAM));
Low0To11 = iLow(NULL,PERIOD_H1,iLowest(NULL,PERIOD_H1,MODE_LOW, ELEVENAM-ZEROAM+1,elevenAM));
Reason: