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 SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    47 views
    0 likes
    Last Post SalmaTrader  
    Started by CarlTrading, 07-05-2026, 01:16 PM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 06-17-2026, 10:32 AM
    0 responses
    15 views
    0 likes
    Last Post CaptainJack  
    Started by kinfxhk, 06-17-2026, 04:15 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 06-17-2026, 04:06 AM
    0 responses
    23 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Working...
    X