iHigh() Problem

 

I have a problem with strategy tester.

When applying High[0], Low[0], Close[0], Open[0] it always returns the same values (although the values are in fact different).

If I do High[1], Low[1], Close[1], Open[1] it works as expected.

Any idea why this is?


 

If you are doing this for the first tick of Bar 0 then the first tick is OHLC all at the same time and therefore the values will be equal. I hope I've understood you problem

V

 

When applying High[0], Low[0], Close[0], Open[0] it always returns the same values (although the values are in fact different).

always? eg, if look at a 'first tick' new bar oftentimes it has values <> to each other, yes? Otherwise how can terminal plot bar graphic? ie, the graphic is not just an horizontal bar on the chart is it?

Open[0] will always be same value, that is a constant value established on first tick, just like Time[0] is.

L,C,H are dynamic and can change on each new incoming server data tick.

Perhaps you could show code, which demonstrates your observation. ie, Print()'s

btw, not attempting to patronize you but please remember that truncation (to 4 decimals) happens using Print().

eg, if d = 1.12345 then Print(d); displays "1.1234" but Print(DoubleToStr(d,Digits)); displays "1.12345"

It can easily happen (I bear witness to it all the time ;) that what one printed out is far from what's in memory...

hth

 
fbj:

always? eg, if look at a 'first tick' new bar oftentimes it has values <> to each other, yes? Otherwise how can terminal plot bar graphic? ie, the graphic is not just an horizontal bar on the chart is it?

Open[0] will always be same value, that is a constant value established on first tick, just like Time[0] is.

L,C,H are dynamic and can change on each new incoming server data tick.

Perhaps you could show code, which demonstrates your observation. ie, Print()'s

btw, not attempting to patronize you but please remember that truncation (to 4 decimals) happens using Print().

eg, if d = 1.12345 then Print(d); displays "1.1234" but Print(DoubleToStr(d,Digits)); displays "1.12345"

It can easily happen (I bear witness to it all the time ;) that what one printed out is far from what's in memory...

hth

 

Thanks for your time.

The thing I do not understand is when I do:

Open[0], High[0], Low[0], Close[0] it returns four times

today's open price. I would expect it to return today's open, today's high, today's low and today's close .


If I do Open[1], High[1], Low[1], Close[1] it works fine, i.e. it returns yesterday's open, yesterday's high, yesterday's low and yesterday's close .

 

The only way that happens AFAIK is if it's the first tick of the bar... would need to see some code to advise further.

V

 
Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 0));
Print("iLow: ", iLow(Symbol(), PERIOD_D1, 0));
Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 0));

Print("iClose: ", iClose(Symbol(), PERIOD_D1, 0));

returns four times today's open. Why?


Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 1));
Print("iLow: ", iLow(Symbol(), PERIOD_D1, 1));
Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 1));
Print("iClose: ", iClose(Symbol(), PERIOD_D1, 1));

works fine i.e. it returns yesterday's open, yesterday's high, yesterday's low and yesterday's close .

 

So are you saying if you run that code as a script with no other code, in the middle of the day it produces 4 equal values?

int start()
  {
//----
   Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 0));
   Print("iLow: ", iLow(Symbol(), PERIOD_D1, 0));
   Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 0));
   Print("iClose: ", iClose(Symbol(), PERIOD_D1, 0));
//----
   return(0);
  }
 
Viffer:

So are you saying if you run that code as a script with no other code, in the middle of the day it produces 4 equal values?


so where's the problem? - confused am I...

2010.07.30 18:32:12 34001 EURUSD,M15: removed
2010.07.30 18:32:12 34001 EURUSD,M15: uninit reason 0
2010.07.30 18:32:12 34001 EURUSD,M15: iClose: 1.308
2010.07.30 18:32:12 34001 EURUSD,M15: iHigh: 1.3107
2010.07.30 18:32:12 34001 EURUSD,M15: iLow: 1.2978
2010.07.30 18:32:12 34001 EURUSD,M15: iOpen: 1.2988
2010.07.30 18:32:12 34001 EURUSD,M15: iClose: 1.3047
2010.07.30 18:32:12 34001 EURUSD,M15: iHigh: 1.3094
2010.07.30 18:32:12 34001 EURUSD,M15: iLow: 1.298
2010.07.30 18:32:12 34001 EURUSD,M15: iOpen: 1.3079
2010.07.30 18:32:12 34001 EURUSD,M15: loaded successfully
2010.07.30 18:32:06 Compiling '34001'

as one would expect... all are different.

using:

int start()
{
Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 0));
Print("iLow: ", iLow(Symbol(), PERIOD_D1, 0));
Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 0));
Print("iClose: ", iClose(Symbol(), PERIOD_D1, 0));
//returns four times today's open. Why?

Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 1));
Print("iLow: ", iLow(Symbol(), PERIOD_D1, 1));
Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 1));
Print("iClose: ", iClose(Symbol(), PERIOD_D1, 1));
return;
}

 
If you are running under the tester and NOT on current symbol or current timeframe D1, there's a tester limitation reading bar 0.
 

I only have daily data (OHLC). And as I said the following code return four times today's open.

Print("iOpen: ", iOpen(Symbol(), PERIOD_D1, 0));
Print("iLow: ", iLow(Symbol(), PERIOD_D1, 0));
Print("iHigh: ", iHigh(Symbol(), PERIOD_D1, 0));
Print("iClose: ", iClose(Symbol(), PERIOD_D1, 0));
Reason: