Thanks for the help I can now get it to work perfectly except for one problem, I can not get Fridays open & close to work no matter what I try...

Quote:

static var DailyOpen = 0, DailyClose = 0;
if(dow(0) > 1 && dow(0) <= 5 && day(0) != day(1)) { // midnight has passed.
DailyOpen = priceOpen(timeOffset(UTC,1,0,0));
DailyClose = priceClose(timeOffset(UTC,1,23,59));
printf("\nDayOpen: %.5f",DailyOpen);
printf("\nDayClose: %.5f",DailyClose);
}
else if(dow(0) == 5 && hour(0) == 0) {
DailyOpen = priceOpen(0);
printf("\nDayOpen: %.5f",DailyOpen);
}
else if(dow(0) == 7 && hour(0) == 23 && minute(0) == 59) {
DailyClose = priceClose(0);
printf("\nDayClose: %.5f",DailyClose);
}


If I just use the original if statement then I get everydays open and close price except Friday like I said above. Now I know because Ive used less than or equal to Friday(5) its not going to work but I was using 6 for Sat too and that didnt seem to make any difference. So I wrote the else if statements to try and get the Friday open and Sunday close a different way. In theory that code to me should work but I can not get data for Friday still... Posting the code for others and if you could help with the Friday problem jcl would be appreciated.

Edit: Using <= 7(Sunday) gives you supposed values for Friday but they are incorrect and dont marry up exactly like the rest of the days just an observation I made.

Last edited by TankWolf; 12/09/12 10:39.