sanfrancisco
Experience: Advanced
Platform: Ninjatrader,TS,IRT
Broker: IQfeed
Trading: ES
Posts: 45 since Feb 2012
Thanks Given: 26
Thanks Received: 21
|
Hi,
I am trying to understand the IOrder object OrderState property. It will be great if you can clarify below questions along with the below example process.
With the unmanaged approach, strategy prevents internal signal tracking and internal order handling rules. Is this correct?
Can you please suggest the best place to submit the profit target and stop loss orders and explain why you think that is the best method to submit PT and Stop loss orders?
Example process: we have a working order in the exchange with quantity 20 submitted from ninja strategy using unmanaged approach and gets below partial fills to fill the total quantity and an over fill, can I expect below IOrder object properties in onOrderUpdate and iexecution object properties in OnExecution methods? Correct me if I am wrong.
Fill 1: market has filled 2 out of 20.
Broker Account will have 2 filled quantity and working order for 18 in the exchange
At what point of time strategy quantity will get updated with this partial fill 2 quantity?
As soon as 2 quantity gets filled in the exchange, I am expecting below sequence of calls will get executed in the order in the strategy.
Call 1: OnOrderUpdate(IOrder order) method will get called with below IOrder object properties.
order .OrderState == OrderState.PartFilled
order. Filled == 2
order. Quantity == 20
order. OverFill == False
Call 2: After the OnOrderUpdate call, strategy will call OnExecution(IExecution execution) method
Case 1: assuming No fill (in flight) between Call 1 and Call 2
execution.Order.OrderState == OrderState.PartFilled
execution. order. Filled == 2
execution. order. Quantity == 20
execution. Quantity == 2
execution. order. OverFill == False
Case2: assuming 3 more quantity got filled between call 1 and call 2 or during the execution of Call 1 (In Flight Fill)
execution.Order.OrderState == OrderState.PartFilled
execution. order. Filled == 5 (2 + 3) ??
execution. order. Quantity == 20
execution. Quantity == 5 ( is this correct ??)
execution. order. OverFill == False
at what point of time OnOderUpdate will be called for this 3 quantity? Are there any important properties that I am missing other than price related?
Assuming market has filled 16 quantities during the process and left with final 4 quantity.
Final Fill : remaining 4 quantity got filled ( total order quantity got filled)
Call 11: OnOrderUpdate(IOrder order) method will get called with below IOrder object properties.
order .OrderState == OrderState.PartFilled ( is this OrderState.PartFilled or OrderState.Filled ?)
order. Filled == 20 ( is this 4 or 20?)
order. Quantity == 20
order. OverFill == False
Call 22: After the OnOrderUpdate call, strategy will call OnExecution(IExecution execution) method
execution.Order.OrderState == OrderState.PartFilled
execution. order. Filled == 20
execution. order. Quantity == 20
execution. Quantity == 4
execution. order. OverFill == False
do I need to compare order. Filled with order. Quantity to check whether the complete order quantity got filled or not in OnOrderUpdate or in OnExecition methds?
Assuming quantity 5 got filled instead of remaining 4 quantity ( Over Fill case)
Call 111: OnOrderUpdate(IOrder order) method will get called with below IOrder object properties.
order .OrderState == OrderState.PartFilled
order. Filled == 21
order. Quantity == 20
order. OverFill == True
Call 222: After the OnOrderUpdate call, strategy will call OnExecution(IExecution execution) method
execution.Order.OrderState == OrderState.PartFilled
execution. order. Filled == 21
execution. order. Quantity == 20
execution. Quantity == 5
execution. order. OverFill == False
sorry for the long list of questions, I am trying to understand the execution process before I design and code order executions in my strategy.
Thanks
gsreddy.
|