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 GussJ, 03-04-2020, 03:11 PM
    11 responses
    3,221 views
    0 likes
    Last Post xiinteractive  
    Started by andrewtrades, Today, 04:57 PM
    1 response
    10 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by chbruno, Today, 04:10 PM
    0 responses
    7 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    438 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    9 views
    0 likes
    Last Post FAQtrader  
    Working...
    X