This correction applies to real time (bar currently being processed whether intraday or daily).
For historical bars like those used in backtesting there are no ticks within each bar, just the OHLC so there is only one returned value, not repeated for each tick in the processed bar.
PHP Code:
debugClear();
function main(){
if (day(0)!=day(-1)) {
debugPrintln();
debugPrintln(day(-1)+"/"+month(-1)+"/"+year(0)+","+(hour(-1)+":"+minute(-1)+":"+second(-1))+", close-1: "+close(-1));//on a 3 min int chart
//on a dynamic time template, line 4 outputs the close at 23:57:00 for the previous day
//on a RTH East Coast time template, line 4 outputs the close at 15:57:00 for the previous day
debugPrintln(day(0)+"/"+month(0)+"/"+year(0)+","+(hour(0)+":"+minute(0)+":"+second(0))+", close0: "+close(0));//on a 3 min int chart
//on a dynamic time template, line 7 outputs the close at 00:00:00 for the current day
//on a RTH East Coast time template, line 7 outputs the close at 9:30:00 for the current day
}//the above outputs only once pre day.
if(hour(0)*100+minute(0)==330){//change the 330 time to the time of your choice using a 2400 hour format
//debugPrintln("13: "+(hour(0)*100+minute(0)));
debugPrintln("14: "+day(0)+"/"+month(0)+"/"+year(0)+","+(hour(0)+":"+minute(0)+":"+second(0))+", close0: "+close(0));//outputs on every tick of the bar at 3:30 am
}
}
//In real time it outputs on every tick within the bar that meets the conditional regardless of interval
//In backtesting historical bars in executes only once on the bar that meets the conditional.
Leave a comment: