I am using Unmanaged mode to submit a pair of breakout orders. These are intended to be OCO.
Because the GetAtmStrategyUniqueId() doesn't work historically, I am using System.Guid.NewGuid() to generate OCO ids. Example of an OCO from this is 07b3efe27009250433008906709f03d05009f01602a
This works fine on historical charts. But live in Market Replay even the first orders sent in realtime generate a rejection, because of a non-unique OCO. But it IS unique - at least it has not been used before.
Is there a problem with placing a bracket of entry orders with an OCO?
Here is the entry code:
LE1 = SubmitOrderUnmanaged(tbip,OrderAction.Buy, (rnd(GetCurrentAsk()) >= longEntryPrice ? OrderType.Market : OrderType.StopLimit),
positionSize,rnd(longEntryPrice+stopLimitOrderWidt h*TickSize),longEntryPrice,oco,"LE1");
SE1 = SubmitOrderUnmanaged(tbip,OrderAction.SellShort, (rnd(GetCurrentBid()) <= shortEntryPrice ? OrderType.Market : OrderType.StopLimit),
positionSize,rnd(shortEntryPrice-stopLimitOrderWidth*TickSize),shortEntryPrice,oco, "SE1");
By the way, when this happens it seems to blow up something inside Ninja. I have to quit it and restart, sometimes restarting the computer because it says the DLL is being used by another process.
Thanks,
saltminer
Comment