I couldn't find a simple way to determine the change in the ES H4 contract from the close yesterday at 1615, so I came up with this simple efs which determines the open and close as soon as the first bar of the day forms. I use a 930 to 1615 template so this works for me.
var newDay=0;
today = new Date;
function main(){
if(newDay==0 && today.getDate() == getValue("Day")){
newDay=1;
yestC = close(-1);
todyO = open();
debugPrintln(yestC, todyO);
}
}
var newDay=0;
today = new Date;
function main(){
if(newDay==0 && today.getDate() == getValue("Day")){
newDay=1;
yestC = close(-1);
todyO = open();
debugPrintln(yestC, todyO);
}
}