I have a loop that generates a sequence of previous trading days:
Usually this works fine, generating a sequence of trading days. However, if I increase nLength beyond a certain point, getPreviousTradingDay returns null. For example if nLength is 13 on a 15-minute chart the function doesn't fail; increased to 14, it fails.
Does anyone have an idea about why this is happening?
PHP Code:
var currentTime = getValue( "rawtime", 0 );
for(var i = 0; i < nLength; i++) {
prevTime = getPreviousTradingDay(currentTime);
var firstPrevBar = getFirstBarIndexOfDay(prevTime);
//do some stuff here
currentTime = prevTime;
}
Does anyone have an idea about why this is happening?
Comment