So here's the issue I'm having, If you place two orders through strategy automation, one a sell above the current bar and one a buy below the current bar, Tradestation on their end will hold both but only place the order you are closer to. If the price action starts to become very fast an error can occur where Tradestation attempts to cancel an order before it is sent. Now, this issue is on Tradestations side not in the code which I know for certain from troubleshooting with Tradestation Easylanguage support. What I'm trying to do as a work around and not having any luck with yet is in 'using elsystem' to listen for a rejection and then recalculate(restart) the strategy so it continues in automation. Of that attempted solution my only problem is I have been unable to find any way to listen for a rejected order. Mind you, I'm not actually placing the order again, it's only calculated end of bar, Tradestation is holding both orders and placing one or the other based on proximity so I need to not listen for a rejection on an order I'm placing but just any rejection at all on the account. Thanks for the help! And let me know if my explanation isn't cutting I'm still finding it a little confusing myself!
This post has been selected as an answer to the original posters question
have you checked the OCOOrderTicket object, this should allow what you have in mind with automated cancellation of the opposite order? Alternatively you might want to look at the Orders Class. This should allow you to monitor for changes of particular order.
Unfortunately that's not really what I'm looking to do. The rejection is after both orders have been placed; Tradestation platform then automatically will take away and place orders as you gain proximity to them, in rapid succession you end up with a rejection. What I really would love to do is watch for a rejection, flatten, and recalculate the strategy. Normally when an automated strategy gets a rejection it turns itself off which in rare circumstances can leave you in a trade. Now, I would always recommend not running a live strategy with you not present but that does not mean that all people do so my goal is rather than automation shutting off just recalculate and proceed or at least flatten the position if it is going to shut off! Any Ideas?