I have a one minute chart of "ES H11" and my "Time Template" is set for 24 hours in the advanced chart.
I am trying to determine the current price (curPrice) of a stock, say "X", between 9:30 and 9:59, inclusive at one minute intervals. But the debugPrintln statement does not give the correct prices for the one minute times and is "null" for all previous days than today. The Day times are correct though. I can't for the life me figure out what I am doing wrong. This has to be an easy one, I think I am staring at the screen to long. Can someone help?
I am trying to determine the current price (curPrice) of a stock, say "X", between 9:30 and 9:59, inclusive at one minute intervals. But the debugPrintln statement does not give the correct prices for the one minute times and is "null" for all previous days than today. The Day times are correct though. I can't for the life me figure out what I am doing wrong. This has to be an easy one, I think I am staring at the screen to long. Can someone help?
PHP Code:
debugClear()
var curPrice = 0;
var closePrice = 0;
function main() {
var ibarDay = getDay(0);
var ibarHour = getHour(0);
var ibarMinute = getMinute(0);
if (ibarHour == 9 && ibarMinute >= 30 && ibarMinute <= 59) {
curPrice = open(0,sym("X,1"));
closePrice = close(0,sym("X,D"));
debugPrintln(closePrice," closePrice= ",curPrice," curPrice= ",ibarDay," Day= ",ibarHour," Hour= ",ibarMinute," Minute= ");
}
return
}
Comment