iHigh in Visual Mode?

 

Hi,

I'm writing a code which is used in Visual Mode(F12), it's to simply draw candles of different timeframe. 

Say I'm in M15 chart, and I want to draw H1 candles in separate window. I did a test : draw a line with "iHigh", time is in year 2009. It's odd: the indicator line value is actually today's value: 1.3420. But in the main chart I can see candle high is 1.48xx, in year 2009.

The code is as usual:

...
for(int i=0; i<limit; i++)
      ind_buffer1[i]=iHigh(NULL,60,i);
...

The data (M15 and H1 and others) was created with "period converter auto". 

Any idea? 


 
joshatt:

Hi,

I'm writing a code which is used in Visual Mode(F12), it's to simply draw candles of different timeframe. 

Say I'm in M15 chart, and I want to draw H1 candles in separate window. I did a test : draw a line with "iHigh", time is in year 2009. It's odd: the indicator line value is actually today's value: 1.3420. But in the main chart I can see candle high is 1.48xx, in year 2009.

You have 4 times as many bars on M15 than on H1 so your   limit   value may well be incorrect.
 
for(int i=0; i<limit; i++)
      ind_buffer1[i]=iHigh(NULL,60,i);
Don't mid apples and oranges
for(int iChart=0; iChart<limit; iChart++){
   int iH1 = iBarShift(NULL, PERIOD_H1, Time[iChart]);
   ind_buffer1[iChart]=iHigh(NULL,60,iH1);
}
 
Works great! Thanks a lot.

Reason: