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 charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    61 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    148 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    98 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X