I use what you call "Advanced Order Handling".
I use 3 IOrders: EntryOrder, StopOrder and PTOrder.
For longs I issue in OnBarUpdate() an EntryOrder=EnterLong(TradeQuantity, Name)
Then in OnExecution() if Long:
StopOrder = ExitLongStop(SLPrice, "Stop", Name)
PTOrder = ExitLongLimit(PTPrice, "PT", Name)
Those orders are executed and then canceled (see order_bug.txt). Why are they canceled and why the quantity is Zero.
Second attempt :
StopOrder = ExitLongStop(TradeQuantity, SLPrice, "Stop", Name)
PTOrder = ExitLongLimit(TradeQuantity, PTPrice, "PT", Name)
In this scenario (order_bug2.txt) The quantity is correct, but still cancellation.
So now I do:
StopOrder = ExitLongStop(0, true, TradeQuantity, SLPrice, "Stop", Name)
PTOrder = ExitLongLimit(0, true, TradeQuantity, PTPrice, "PT", Name)
The question is: Why exit orders are canceled and why do I need the quantity? and do I need the last overload or there is something other wrong?
Baruch
Comment