Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Market position not uptodate after order filled

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

    Market position not uptodate after order filled

    Hi,

    I see that in rare occasions the market position of the strategy is not uptodate. For example, what that I see is that the order has been filled on tick #1000 (I check that during Onorderupdate) but the market position is updated 10 ticks later (tick #1010). Is there way to get the position to be updated when the order is filled?

    Thanks!

    Juan


    #2
    Hello Aquatrade,

    Thank you for your reply.

    Who is your data provider?

    You could certainly use the unmanaged approach and calculate the position internally to the strategy. The strategy could then rely on it's own calculated position in lieu of relying on position updates from the broker. I've attached an example of this below.

    An overview of using the unmanaged approach may be found in our help guide here:



    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Thanks,

      My data provider is CQG. The example is very useful, I'll try to use some of the ideas in your code for my strategy.

      Thanks one more time

      Juan

      Comment


        #4
        I have an additional question. In the code you provide I see:
        Code:
        if (shortEntry != null && shortEntry == order)
        {
        // Reset the shortEntry Order object to null if order was cancelled without any fill
        if (order.OrderState == OrderState.Cancelled && order.Filled == 0)
        {
        shortEntry = null;
        }
        }
        what is the difference between:

        order.OrderState == OrderState.Cancelled && order.Filled == 0

        and

        order.OrderState == OrderState.Cancelled


        In other words, why checking for number of orders filled? is it because of partial fill?

        Thanks!

        Comment


          #5
          Hello Aquatrade,

          Thank you for your reply.

          Yes, that's exactly right, because if the order is partially filled but not fully filled we would want to handle that differently than simply just setting that reference back to null immediately.

          Please let us know if we may be of further assistance to you.
          Kate W.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          39 views
          0 likes
          Last Post jeronymite  
          Started by bill2023, Today, 08:51 AM
          2 responses
          15 views
          0 likes
          Last Post bill2023  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          167 responses
          2,260 views
          0 likes
          Last Post jeronymite  
          Started by warreng86, 11-10-2020, 02:04 PM
          7 responses
          1,362 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by Perr0Grande, Today, 08:16 PM
          0 responses
          5 views
          0 likes
          Last Post Perr0Grande  
          Working...
          X