I am trying to get the first bar index for any given date. In the following example, getFirstBarIndexOfDay(newDateObject) results in "null". Please help. Thanks.
function preMain() {
setPriceStudy(true);
}
var BarCntr = 0;
function main() {
if (getBarState() == BARSTATE_NEWBAR) {
BarCntr +=1;
var newDateObject = new Date(2003, 02, 1);
debugPrint("Bar=" + getCurrentBarIndex() + " v=" + getFirstBarIndexOfDay(newDateObject) + "\n");
if (getCurrentBarIndex() == getFirstBarIndexOfDay(newDateObject)) {
}
}
}
function preMain() {
setPriceStudy(true);
}
var BarCntr = 0;
function main() {
if (getBarState() == BARSTATE_NEWBAR) {
BarCntr +=1;
var newDateObject = new Date(2003, 02, 1);
debugPrint("Bar=" + getCurrentBarIndex() + " v=" + getFirstBarIndexOfDay(newDateObject) + "\n");
if (getCurrentBarIndex() == getFirstBarIndexOfDay(newDateObject)) {
}
}
}
Comment