Hello,
I'm having a problem understanding the results returned from getValue functions versus getValueAbolute.
Here's my situation....I had a formula running today and it puts time into a 24hour format, eg:
function tsTime() {
var h = getHour(0);
var m = getMinute(0);
debugPrintln("h:"+h+" m:"+m);
h *=100;
h += m;
debugPrintln("ret:"+h);
return h;
}
I was running formulas that use this function on two symbols today, ZLC and EZ on 5 minute intervals. I noticed a weird time values at 1:05pm today EST, so I turned on debugging of minute and hour variables in my function, here is what I got with getHour and getMinute (as above):
ret: 930
h: 9 m: 30
I can't figure out why this is happening, I also tried using getValue("hour",0) and got same result. I have "Auto" time template selected, time and time zone set properly on my machine, never had a problem with this function before.
When I switched to use getValueAbsolute rather than getValue, everything worked properly and I got:
re: 1305
h: 13 m: 5
Why does this happen? From the documentation I see that getValueAbsolute returns values at bar index relative to 0 regardless of bar currently being processed... but I don't understand why getValue(0) and getValueAbsolute(0) wouldn't return the same value... or where getValue("hour",0) was getting a 9 from???
isn't the EFS formula always processing the current bar unless you're initially loading the formula, or if it's operating in tick playback mode? I'm really confused about this discrepency, documentation is a little sparse on these serious objects in the knoweldge base.
Please help!
thanks.
-josh
I'm having a problem understanding the results returned from getValue functions versus getValueAbolute.
Here's my situation....I had a formula running today and it puts time into a 24hour format, eg:
function tsTime() {
var h = getHour(0);
var m = getMinute(0);
debugPrintln("h:"+h+" m:"+m);
h *=100;
h += m;
debugPrintln("ret:"+h);
return h;
}
I was running formulas that use this function on two symbols today, ZLC and EZ on 5 minute intervals. I noticed a weird time values at 1:05pm today EST, so I turned on debugging of minute and hour variables in my function, here is what I got with getHour and getMinute (as above):
ret: 930
h: 9 m: 30
I can't figure out why this is happening, I also tried using getValue("hour",0) and got same result. I have "Auto" time template selected, time and time zone set properly on my machine, never had a problem with this function before.
When I switched to use getValueAbsolute rather than getValue, everything worked properly and I got:
re: 1305
h: 13 m: 5
Why does this happen? From the documentation I see that getValueAbsolute returns values at bar index relative to 0 regardless of bar currently being processed... but I don't understand why getValue(0) and getValueAbsolute(0) wouldn't return the same value... or where getValue("hour",0) was getting a 9 from???
isn't the EFS formula always processing the current bar unless you're initially loading the formula, or if it's operating in tick playback mode? I'm really confused about this discrepency, documentation is a little sparse on these serious objects in the knoweldge base.
Please help!
thanks.
-josh
Comment