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

More than 100 subsequent events?

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

    More than 100 subsequent events?

    Hi,

    I'm trying something a little kooky for more efficient back-testing purposes... it basically involves placing multiple orders within the same bar.

    As a result, I'm ending up with this:

    4/21/2009 11:16:06 PM Strategy Error on calling the 'OnOrderUpdate' method for strategy 'ProtectDownMulti': More than 100 subsequent user events

    ...? What's a user event? I should probably have about 20 stop orders queued up (on the same bar) at this point, not 100. What's the fundamental constraint here?

    #2
    User event = NinjaScript method call

    > 100 stacked NinjaScript method calls would be invoked. This is an indication, that there could be something wrong with your code, probably a infinite recursion.

    Comment


      #3
      Originally posted by NinjaTrader_Dierk View Post
      User event = NinjaScript method call

      > 100 stacked NinjaScript method calls would be invoked. This is an indication, that there could be something wrong with your code, probably a infinite recursion.
      Dierk,

      Thanks, I'll take a closer look at what I'm doing.

      But can you give me an idea of how I could generate a "stacked" call? Would it have to be within the OnOrderUpdate or OnExecution methods, like where I'm submitting additional orders?

      Comment


        #4
        Sample:
        - NT calls A
        - A triggers some order(s)
        - which then triggers B
        - B then triggers some order(s)
        - which then triggers A

        A, B = NinjaScript methods

        This is just a sample. Your scenario would be very different. Bottom line is: As NT calls a NinjaScript method, your logic in that method would trigger more than 100 additional direct NinjaScript method before actually control would be returned to NT.

        Comment


          #5
          Originally posted by heech View Post
          Dierk,

          Thanks, I'll take a closer look at what I'm doing.

          But can you give me an idea of how I could generate a "stacked" call? Would it have to be within the OnOrderUpdate or OnExecution methods, like where I'm submitting additional orders?
          Oh I bet I can guess what I'm doing.

          I have probably 30-60 orders sitting on the same BarsInProgress value. And of course, each order can generate multiple events for OnOrderUpdate (pendingsubmit, submitted, accepted, etc...). And it's probably this combination that can push me over the 100 limit.

          Does that sound reasonable as a possibility...?

          Comment


            #6
            I see. I'll change that limit to 1000. Pls fire me again a mail so I could provide you a custom build.

            Comment


              #7
              Actually even better: there is the undocumented .MaxProcessedEvents property which you could set in Initialize() to your liking.

              Comment


                #8
                Originally posted by NinjaTrader_Dierk View Post
                Actually even better: there is the undocumented .MaxProcessedEvents property which you could set in Initialize() to your liking.
                Beautiful, that did it.

                Now I can test probably 20x faster than I had been...

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by GussJ, 03-04-2020, 03:11 PM
                11 responses
                3,222 views
                0 likes
                Last Post xiinteractive  
                Started by andrewtrades, Today, 04:57 PM
                1 response
                10 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Started by chbruno, Today, 04:10 PM
                0 responses
                7 views
                0 likes
                Last Post chbruno
                by chbruno
                 
                Started by josh18955, 03-25-2023, 11:16 AM
                6 responses
                438 views
                0 likes
                Last Post Delerium  
                Started by FAQtrader, Today, 03:35 PM
                0 responses
                10 views
                0 likes
                Last Post FAQtrader  
                Working...
                X