…sometimes I have more than one trade open for the same market/instrument. The trades are always in the same direction i.e. buy/long as hedging must be disabled but that’s not the issue either. The problem is that FXCM does not recognize which stop/target OCO order pair is linked to which entry; it closes trades on a first in/first out basis. I don’t use tiered exits either; I always close out an entire position whenever the stop or target is hit.
So say for example I go long on a specific instrument (call it ‘Trade A’) and then sometime later I go long again on that same instrument (call it ‘Trade B’) then FXCM will close out Trade A first, even if the stop or target from Trade B has been triggered first. That will leave me with Trade B open and Trade A’s stop and target orders alive. Note the order quantities of Trade A and Trade B are not always the same, so I could be left with part of Trade A still open as well as Trade B, or all of Trade A plus a part of Trade B gets closed.
I am using unique order names for each trade and I pass that name into the entry, stop and target. I can see in the NT7 order window that the OCO stop/target pair is linked to it’s respective entry as the value in the OCO column will match up with the value in the ID column. Unfortunately there is no way to confirm this in TradeStation; it simply shows an entry order in the opposite direction for the specified price and the same quantity as the entry order.
Now it doesn’t make a difference in terms of trade outcomes if the stop/target order from ‘Trade A’ is used to close out ‘trade B’ and vice versa, but (aside from messing up my reporting) it causes the strategy to error and disable itself when the stop/target orders from ‘Trade A’ get triggered but only ‘Trade B’ is open. Here’s a copy of the error from the log:
7/03/2022 10:56:25 PM|0|128|Strategy submitted an order that generated the following error 'UnableToChangeOrder'. Strategy has sent cancel requests, attempted to close the position and terminated itself.
I realize you cannot see what TradeStation is doing and nor can you do anything about it, but I was hoping someone might be able to shed some light. I wondered if removing the order names from the entry, stop and target or using the Exit() methods instead of Set() methods would at least prevent the strategy from erroring when the second trade closes.
Comment