Can anyone tell me how to correct datetime for this update?
This is a snippet that had been working for over a year. It's purpose is to detect when a new bar has drawn. Was bullet proof. Not now. Doesn't work following the upgrade.
int thisBarOpened=datetime Time;
// do stuff if newBar
4 errors produced:
'Time' - unexpected token
'[' - unexpected token
'[' - array required
'datetime' - expression expected
Any help would be greatly appreciated. Otherwise, I guess I go back to mod arithmetic, which is how I did it before using this method.
to cast a value use brackets eg thisBarOpened = (datetime)Time;
But datetime is now 64 bit and wont fit in an int (which is 32bit), so why not just leave thisBarOpened as a datetime ?
Make some proper code:
//somewhere in the global scope:
//somewhere in OnTick() handler:
if(Time > lasttime)
lasttime = Time;
// do something on new bar //