The second to last line of the following code returns vEOS = true at 1300 hours even if the root symbol is ES or NQ. If the root symbol is ES or NQ, that 1300 line is supposed to return false, and at 1330 hours the following 1330 line is supposed to return true. What am I missing here?
Thanks.
var vEndOfDayFound = false;
function main() {
// initialize upon first loading formula
if(getBarState() == BARSTATE_ALLBARS) {
vInterval = getInterval();
vSymbol = getSymbol().toUpperCase();
// for RTH, eg, to convert, ES Z3 to ES Z3=2
var rootSymbol = vSymbol.substring(0,3);
if (rootSymbol == "ES " || rootSymbol == "NQ ")
if ( vSymbol.indexOf("=2") == -1 ) vSymbol += "=2";
vSymbol += ",D";
return null;
}
// return null if not an intraday chart
if(vInterval == null || vInterval == "D" || vInterval == "W" || vInterval == "M" || vInterval == "T")
return null;
// if first bar in new day, get and save yesterday's data
var vThisday = null;
if (getDay(-1) != getDay()) vEndOfDayFound = false;
//check for end of session.
var vEOS = false;
if (vEndOfDayFound == false) {
var vBarHour = getHour()*100;
var vBarMin = getMinute();
var vBarTime = vBarHour + vBarMin;
if ((vBarTime >= 1300) && (rootSymbol != "ES " || rootSymbol != "NQ ")) vEOS = true; //Change Time here; e.g. "1600" for 4:00 (Eastern Time).
if ((vBarTime >= 1330) && (rootSymbol == "ES " || rootSymbol == "NQ ")) vEOS = true; //Change Time here; e.g. "1630" for 4:30 (Eastern Time).
}
Thanks.
var vEndOfDayFound = false;
function main() {
// initialize upon first loading formula
if(getBarState() == BARSTATE_ALLBARS) {
vInterval = getInterval();
vSymbol = getSymbol().toUpperCase();
// for RTH, eg, to convert, ES Z3 to ES Z3=2
var rootSymbol = vSymbol.substring(0,3);
if (rootSymbol == "ES " || rootSymbol == "NQ ")
if ( vSymbol.indexOf("=2") == -1 ) vSymbol += "=2";
vSymbol += ",D";
return null;
}
// return null if not an intraday chart
if(vInterval == null || vInterval == "D" || vInterval == "W" || vInterval == "M" || vInterval == "T")
return null;
// if first bar in new day, get and save yesterday's data
var vThisday = null;
if (getDay(-1) != getDay()) vEndOfDayFound = false;
//check for end of session.
var vEOS = false;
if (vEndOfDayFound == false) {
var vBarHour = getHour()*100;
var vBarMin = getMinute();
var vBarTime = vBarHour + vBarMin;
if ((vBarTime >= 1300) && (rootSymbol != "ES " || rootSymbol != "NQ ")) vEOS = true; //Change Time here; e.g. "1600" for 4:00 (Eastern Time).
if ((vBarTime >= 1330) && (rootSymbol == "ES " || rootSymbol == "NQ ")) vEOS = true; //Change Time here; e.g. "1630" for 4:30 (Eastern Time).
}
Comment