I've made a strategy that runs 24 hours a day on forex and I'm noticing that at the 5pm rollover time and sometimes at midnight if it tries to send an order through I get a terminating error message saying that the account was unavailable. I can work around it by restarting my strategy, however I'm interested in knowing if there is simply a coding method to check if the account is available or not before placing the orders.
If not, another workaround would be to cancel all pending orders and halt action at 5pm to 5:10pm and then resume, but that would require a lot of extra code to accommodate that.
Thanks for any ideas or suggestions guys!
Edit: I added "suspend pending orders" because my OnOrderUpdate handling includes followup orders to be submitted when one gets filled so it would make the same terminating error

Comment