Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnExecution() PartialFills

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    OnExecution() PartialFills

    Question re the sample posted on http://www.ninjatrader.com/support/f...ead.php?t=7499

    When submitting target / stop orders in the OnExecution method, in the sample, we have ...

    if (execution.Order.OrderState == OrderState.Filled || execution.Order.OrderState == OrderState.PartFilled ... ) {
    // Stop-Loss order 4 ticks below our entry price
    stopOrder = ExitLongStop(0, true, execution.Order.Filled, execution.Order.AvgFillPrice - 4 * TickSize, "MyStop", "MyEntry");

    // Target order 8 ticks above our entry price
    targetOrder = ExitLongLimit(0, true, execution.Order.Filled, execution.Order.AvgFillPrice + 8 * TickSize, "MyTarget", "MyEntry");
    Should the order quantity given to the stop and the target order be execution.Quantity instead of execution.Order.Filled? Because lets say we have an entry order with 10 contracts ... we get a partial fill of 4 contracts and then a second partial fill of 6 contracts. If we use execution.Order.Filled, then wouldn't that mean that first a stop + target order will be sent for 4 contracts and then instead of sending an additional order for 6 contracts, an additional order for 10 contracts will be sent.

    Please let me know if my understanding of execution.Order.Filled versus execution.Quantity is correct.

    #2
    Hello shiva_mohan,

    execution.Order.Filled is what you will want to use here, even in partial fill cases. You can test this in a simulated environment by enabling enforce partial fills, under tools > options > simulator tab.

    Change the order quantity on the enter method to something like 200, and run in real time. You will get partial fills but the resulting quantity of the target and stop loss orders will be 200.
    Ryan M.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by DayTradingDEMON, Yesterday, 08:54 AM
    13 responses
    41 views
    0 likes
    Last Post DayTradingDEMON  
    Started by DJ888, Yesterday, 05:57 PM
    2 responses
    20 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by mtamaku, Today, 05:21 PM
    0 responses
    4 views
    0 likes
    Last Post mtamaku
    by mtamaku
     
    Started by rbeckmann05, Yesterday, 11:37 PM
    2 responses
    13 views
    0 likes
    Last Post rbeckmann05  
    Started by reekotubbs, Today, 01:09 PM
    1 response
    19 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X