I want to print out to the Formula output window every hour when the hourly bar opens. This I can do.
var newDateObject = new Date();
if (nBarState == BARSTATE_NEWBAR) {
debugPrintln(newDateObject.getHours()
}
However, when it first load, its goes through all the bars and prints out 20 times (roughly, possibly more or less). I don't want it to do all that. I want it to just print out the current hour when it first loads, and then each time a new bar runs, print out the time again.
I am running this on an hourly chart.
Thanks,
var newDateObject = new Date();
if (nBarState == BARSTATE_NEWBAR) {
debugPrintln(newDateObject.getHours()
}
However, when it first load, its goes through all the bars and prints out 20 times (roughly, possibly more or less). I don't want it to do all that. I want it to just print out the current hour when it first loads, and then each time a new bar runs, print out the time again.
I am running this on an hourly chart.
Thanks,
Comment