I use to launch Exit Limit orders as a profit target with LiveUntil Cancelled set to true:
ProfitOrder = ExitLongLimit(0,true,Position.Quantity,ProfitPrice ,"","");
This is thi only active order. So, there are not other orders competing with this one. I allways manage to have only one active limit order.
The strange thing is that those orders sometimes dissapear from the Orders tab. When I print the order state of ProfitOrder it appears as filled (while the position is still open) , Cancelled or simply equals to null.
In this case what I do is to recover again the order. To do this I check that the market position is Long or Short and if ProfitOrder is null I set it again:
ProfitOrder = ExitLongLimit(0,true,Position.Quantity,ProfitPrice ,"","");
When doing this two thing happen: the order is not set again or I receive a message like this
"**NT** You can't change the order quantity below the amount of already filled units. Affected order: Order='03c9bc614a1c44f39851526af9b8e76f/Sim101' Name='Buy to cover' State=PartFilled Instrument='$AUDUSD' Action=BuyToCover Limit price=1.0155 Stop price=0 Quantity=130,400 Strategy='FOREX2' Type=Limit Tif=Gtc Oco='' Filled=104453 Fill price=1.0155 Token='03c9bc614a1c44f39851526af9b8e76f' Gtd='12/1/2099 12:00:00 AM'"
This later error message appears even when the Position.Quantity = 25947
Perhaps there is any previous step to take before setting up again the order?
thanks
Comment