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 dustydbayer, Today, 01:59 AM
    0 responses
    1 view
    0 likes
    Last Post dustydbayer  
    Started by inanazsocial, Today, 01:15 AM
    0 responses
    2 views
    0 likes
    Last Post inanazsocial  
    Started by trilliantrader, 04-18-2024, 08:16 AM
    5 responses
    22 views
    0 likes
    Last Post trilliantrader  
    Started by Davidtowleii, Today, 12:15 AM
    0 responses
    3 views
    0 likes
    Last Post Davidtowleii  
    Started by guillembm, Yesterday, 11:25 AM
    2 responses
    10 views
    0 likes
    Last Post guillembm  
    Working...
    X