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

When using order.Filled, the program will not work

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

    When using order.Filled, the program will not work

    because the program could not get this information in historical data. Is this a known issue? Or I was wrong.

    My program was working pretty good. However, I would add some code to make sure that the previous order is fully filled, and then submit new order. However, the program stop some where, and I believe it is because it could not get the right number for order.Filled in historical data. How should I deal with this issue?

    #2
    Working with IOrders works regardless of real-time data or historical data. You will have to track down what is breaking your strategy logic through debugging.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks, Josh! I will debug it. However, how does Ninjatrader

      deal with the code, such as "if (order.Filled == intTradedShares)" in historical data? My code does not allow any further trading if the previous order is not fully filled. So if there is no way to deal with this in historical data, my program will stuck in the first trade in historical data. That is what happened to me right now. Thanks again!

      Comment


        #4
        You can't just do order.Filled == something. You need to actually check that order is not null first. A check like that is just like any other comparison between double values provided it can access order.

        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thanks, Josh. I did it just like you suggeted. I checked the order is not null, and I assigned the order.Filled to an integer variable, then I compared if the integer variable equals to the shared the original order sent. My questions is that what ninjatrader deals with the order.Filled for historical data? i.e. what does order.Filled return when using historical data?

          Comment


            #6
            Unfortunately not following you at all.

            order is whatever you set it to be. There is no "order" unless you set this to take on some IOrder which has made some trade.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks, Josh. I debuged it using print command. The order.Filled returns 0 for historical data. So my code will never go further because it means that my initial order has never been filled, and no more order will be submitted if the initial order is still pending. I will find a way to deal with this issue. If you can give me a simple hint to make it a easy fix, it will be great.

              Comment


                #8
                atrader, maybe you could post the complete code? Are you checking order.Filled in OnOrderUpdate()?

                If you give us a little more information we'll probably be able to help you better.
                AustinNinjaTrader Customer Service

                Comment


                  #9
                  Thanks, Austin. I debugged it over the weekend. I got the order.Filled from OnOrderUpdate. It returns 0 when running through historical data. And when it is 0, it means my order will never been filled. And it stucks there forever. However, after I fixed this problem. More problems happened, and I made a new post.

                  Comment


                    #10
                    order.Filled will return 0 if your IOrder has never filled. It does NOT mean anything about whether or not your order will fill in the future.
                    Josh P.NinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by moneyexe, Today, 11:22 AM
                    0 responses
                    4 views
                    0 likes
                    Last Post moneyexe  
                    Started by stevec1824, Today, 11:00 AM
                    1 response
                    4 views
                    0 likes
                    Last Post NinjaTrader_ChristopherJ  
                    Started by sofortune, Today, 10:05 AM
                    2 responses
                    6 views
                    0 likes
                    Last Post sofortune  
                    Started by sofortune, 05-10-2024, 10:28 AM
                    6 responses
                    46 views
                    0 likes
                    Last Post sofortune  
                    Started by ETFVoyageur, Today, 08:54 AM
                    3 responses
                    31 views
                    0 likes
                    Last Post ETFVoyageur  
                    Working...
                    X