Hi,
I think you should set FillOnQuote to true and all other FillOnXXX to false. Built-in executiom simulator doesn't use Level2/order book. This is reserved for custom user simulators (note that you can plug your own execution simulator) and matching engines.
You should also note this information (can be found in FAQ)
How to use ExecutionSimulator.Queued property
What potentially may happen if you do something “too fast”, like sending an order and then replacing/cancelling it in the same OnBar or OnReminder, is that you send an order to the Execution Simulator, the simulator accepts the order, fills it, and places execution report into the Event Bus queue. This execution report is in the queue, but not in the Order Manager yet, so that the order still has New status although it has already been filled in the Execution Simulator. Then you can try to replace/cancel the order in your strategy but the Execution Simulator rejects your request sending out cancel/replace reject report. This is pretty normal and reflects real life. Your order can already be filled on the broker server but you don’t know about it yet and ask broker to cancel it. Indeed your cancel request will be rejected. You can control this scenario using ExecutionSimulator.Queued = false. Then your order will be executed directly without sending reports via EventBus queue.
Regards, Anton
|