Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

occasional "Order quantity has to be greater than 0" error

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

    occasional "Order quantity has to be greater than 0" error

    Hi guys,

    My strategy fails to send orders through in some rare cases. Although I have the strategy print the order size it's about to deal with, it sometimes somehow mistakes it.

    What happens is:
    -> My variable OrderSize (as integer) is calculated and printed, e.g. "order size = 1".
    -> the strategy attempts to send an order via ExitLong(OrderSize).

    In 95% of cases, it all goes through smoothly. But I occasionally get the "Order quantity has to be greater than 0" error (and my strategy therefore terminated), although in the print line above it correctly states the OrderSize it's about to deal with as 1.

    Any suggestions?

    Thanks,
    noincome

    #2
    Is this NinjaTrader 7 or 6.5 ?
    RayNinjaTrader Customer Service

    Comment


      #3
      The error occurred with NT 7.

      I'm running the strategy on 6.5 since this morning, without a problem so far (the error occurred on NT 7 only after 1.5 days, so it might still show up on 6.5, too.)

      Comment


        #4
        Will respond back Monday since need to look into this further.
        RayNinjaTrader Customer Service

        Comment


          #5
          The next step would be that we would need to see TraceOrders enabled so we can see what value is actually in the internal order methods. You would need the output window open when running a strategy so we could capture this information.
          RayNinjaTrader Customer Service

          Comment


            #6
            Roger that, will post the results when the error occurs again.

            Comment


              #7
              And here we go:

              // This is my Print line from the code:
              02.12.2009 00:48:00: NQ 12-09: + + + Reducing from 10 to 4, OrderSize = 6

              // This is the line that comes from TraceOrders
              02.12.2009 00:48:08 Entered internal PlaceOrder() method at 02.12.2009 00:48:08: Action=Sell OrderType=Market Quantity=6 LimitPrice=0 StopPrice=0 SignalName='RL 21604' FromEntrySignal=''

              // And this is the error that kills the strategy
              **NT** Error on calling 'OnBarUpdate' method for strategy 'a1125MuMiv1/630700b0e39448b4af09a0426d3ff2e6': Order quantity has to be greater than 0

              As I said, this only seems to be happening in NT7 - I had the strategy running for about six hours when the error occurred, whereas I previously ran it on NT 6.5 for several days without a problem. The crash happened after dozens of similar trades that all went through correctly.

              Regards
              noincome

              Comment


                #8
                noincomenojobnoassets,

                Can you please provide the complete log entries for this occurrence? Thank you.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Here it comes. Thanks, Josh!
                  Attached Files

                  Comment


                    #10
                    Do you also have complete trace logs? Thanks.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      I'm not sure I get what you mean. These are the lines from the logfile I got out of the "log" folder in the NinjaTrader 7 folder in My Documents.

                      Comment


                        #12
                        Documents\NinjaTrader 7\traces. Please attach that file.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          Sorry. Here you go.
                          Attached Files

                          Comment


                            #14
                            noincomenojobnoassets,

                            This looks to be an extremely stripped down version. Can you please provide the complete trace logs? Thank you.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Of course it's stripped down - the whole tracefile is 6 MB large. I wanted to spare you all the stuff that was in front of and behind the event. There are no gaps in the trace log I uploaded, it just includes the very time when the error occurred. Do you still want the whole thing?

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              628 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              359 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              105 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              562 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              568 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X