I have a strategies that leaves positions on during rollovers during the week daily (rollover between 4:50 pm est---5:10 pm est) and only closes and flattens all and disables strategies on Friday at 4:50 pm est.
What can I do to add to the code to make it pause taking any orders whatsoever so it does not accidentally try to order and then disable the strategy during this period of time? Right now, sometimes it will try to make a order and then because of rollover it can not do it as the account is unavailable and then it disables the strategy. Then, I have to manually close the position and re-enable the the instrument that was disabled. This effectively messes up the position and it has to wait, then, for another valid reentry...would rather have it leave the position on seamlessly throughout the rollover period daily, and only have it exit all positions/flatten and disable all strategies on Friday at 4:50 pm est.
If you could include sample code to put into the strategy I could use to test per above that would be great.
Please let me know where it should be place in the code for the least intrusion (onBarupdate, Initialize, etc)...smile.
Thanks...
Greg

Comment