Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Detecting PartFills and it's simulation.

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

    Detecting PartFills and it's simulation.

    Dear Support.

    I just want to be sure that I do correct things in my strategy and want to ask you some questions, if you don't mind

    1. As I understand there is no way to simulate partial fills on back-testing?
    2. Inside onExecution method: what is difference between Order.Filled, order.Quantity and Position.Quantity at one point of time?
    E.g. I work with single entry for 10 lots. First fill was at 5 lots:
    Code:
    Order.Filled = 5, order.Quantity = 10, Position.Quantity=5, Order.OrderState == OrderState.PartFilled.
    The second fill was 5 lots too (5+5 = 10 lots total):
    Code:
    Order.Filled = 10, order.Quantity = 10, Position.Quantity=10, Order.OrderState != OrderState.PartFilled ( PartFilled ==false ).
    The problem that I want to be sure that I send correct numbers of stop order lots. Please take a look at it:
    Code:
    protected override void OnExecution(IExecution execution)
    {
        IOrder order = execution.Order;
                
        if (_EntryLongOrderId != null && _EntryLongOrderId == order && order.OrderState == OrderState.Filled)
        {                
             if (order.OrderState != OrderState.PartFilled) 
                _EntryLongOrderId = null;
    
            SendBracketsLong("Orig"); //using Position.Quantity inside
        }
        if (_EntryShortOrderId != null && _EntryShortOrderId == order && order.OrderState == OrderState.Filled)
        {                
             if (order.OrderState != OrderState.PartFilled) 
                 _EntryShortOrderId = null;
                    
            SendBracketsShort("Orig"); //using Position.Quantity inside
        }
    }

    #2
    Hello AlexFdv,

    Thank you for your post.

    1. You can simulate partial fills with the use of a simulated intra-bar fill. For information on this and a reference sample please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=6652

    2. For information on the different IOrder parameters please visit the following link: http://www.ninjatrader.com/support/h...nt7/iorder.htm
    For information on the different IPosition parameters please visit the following link: http://www.ninjatrader.com/support/h.../iposition.htm

    I also recommend reviewing our OnOrderUpdate() and OnExecution() reference sample: http://www.ninjatrader.com/support/f...ead.php?t=7499

    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    639 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    572 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X