I have a custom strategy running on a chart. Everything works as it should, until I try and reverse the position. A reverse situation occurs rarely.
Hopefully someone can help me find the flaw in my logic.
I am using IOrders for the entry, target and stop orders. The order variables are:
entryOrder for entry, stop limit
targetOrder for target, limit
stopOrder for stop, market
My thought was to create two order entry ID's and alternate between them.
entryOrder one is placed with "entry ID #1". If the order fills, a targetOrder and stopOrder are generated tied to "entry ID #1". After the target and stop orders are placed in the OnExecution section of code "entry ID #2" is set as the next available entry ID.
If a reverse situation occurs entryOrder two is placed in the opposite direction with "entry ID #2". I don't want to simply double my stop order, because it is a market order, and I only want to enter with Stop Limit Orders.
I have tried selecting UniqueEntries and 2 for Entries per Direction when starting the strategy.
The order is fired, but nothing happens and in the log section I get a message that the Enter() command has been ignored, see order handling rules.
Even though entryOrder is null after it is filled, is it still tied to the original position, even though the string entry name is different?
Thanks in advance,
Tiara

Comment