I am trying to use getFirstBarIndexOfDay() to get the first bar index of the second last trading day. I run the following code snippet on 1min chart.
if ( getBarState() == BARSTATE_NEWBAR && getCurrentBarIndex() == 0 ) {
var fbi = getFirstBarIndexOfDay(getValueAbsolute( "rawtime", 0 ));
var fbi2 = getFirstBarIndexOfDay(getValueAbsolute( "rawtime", fbi-1 ));
debugPrintln(fbi + " " + fbi2);
}
Can someone tell me why the above code snippet prints out the same value for fbi and fbi2.
if ( getBarState() == BARSTATE_NEWBAR && getCurrentBarIndex() == 0 ) {
var fbi = getFirstBarIndexOfDay(getValueAbsolute( "rawtime", 0 ));
var fbi2 = getFirstBarIndexOfDay(getValueAbsolute( "rawtime", fbi-1 ));
debugPrintln(fbi + " " + fbi2);
}
Can someone tell me why the above code snippet prints out the same value for fbi and fbi2.
Comment