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

Performance metrics for indicator processing speed

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

    Performance metrics for indicator processing speed

    I've written an indicator which allows the user unlimited opportunities by specifying user parameters for overloading NT7 and the CPU.

    It's not something that I can easily control by putting limits directly on the max values entered for the parameters. The user can easily combine multiple parameters in the hope of seeing 'everything' and cause the machine to grind to a halt for 5 minutes.

    I have put a piece of code around the OnBarUpdate() and the Plot() functions to shut the indicator processing off if the number of milliseconds exceeds a chosen number. I am currently using 50ms for both functions.

    But is 50ms desirable? Especially if a user is combining this indy with another CPU-intensive indy, or has a slow machine.

    Apart from the temporary total lock-up of NT7 while it processes, what I want to avoid is the chart becoming slow to re-draw when switching to the chart window. Is this purely down to the time taken by the Plot function, or are there other areas of an indicator to watch?

    Thanks to anyone for any input.

    #2
    Hello adamus,

    Could you clarify what method you are using to inside of your indicator when you are checking the time it takes to load up?
    JCNinjaTrader Customer Service

    Comment


      #3
      This is the loop I have in the OnBarUpdate. The one in Plot is similar and is the one I'm not happy with. This one in OnBarUpdate only kicks in during Historical processing, so it can stop the indicator even before it plots.

      I have multiple time-frames, so it means the load could be spread across multiple OnBarUpdate events.

      Code:
      protected override void OnBarUpdate()
      {
          if (performanceOverload) return;
          ....
          
          if (CurrentBar > 0)
          {
              long durationInMs = (System.DateTime.Now.ToFileTime() - start) / 10000;
              if (Historical && durationInMs > warningCount)
              {
                  performanceOverload = true;
                  OnTermination();
                  doWarning();
              }
          }
          start = System.DateTime.Now.ToFileTime();
      }
      My Plot method is simplistic:
      Code:
      public override void Plot(Graphics graphics, Rectangle bounds, 
          double min, double max)
      {
          if (Bars == null || ChartControl == null || performanceOverload)
              return;
          long start = System.DateTime.Now.ToFileTime();
          ... // process it all
          long durationInMs = (System.DateTime.Now.ToFileTime() - start) / 10000;
          if (durationInMs > warningCount)
          {
              performanceOverload = true;
              OnTermination();
              doWarning();
          }

      Comment


        #4
        Adamus,

        Thank you for the information.

        It sounds like 50ms is a good start for the loading time. However, I will admit that I have not tested this kind of method before.

        Are you getting the results you want? Have you tried testing it with someone else's machine and see if they like the resutls?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          I'm going to give it a try on other people's machines. I have to iron out the worst bugs first though. Don't want to annoy anyone with a crappy indicator.

          Comment


            #6
            Adamus,

            Sounds great. Let me know what results you end up getting
            Cal H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by rocketman7, Today, 09:41 AM
            2 responses
            4 views
            0 likes
            Last Post rocketman7  
            Started by traderqz, Today, 09:44 AM
            1 response
            3 views
            0 likes
            Last Post traderqz  
            Started by rocketman7, Today, 02:12 AM
            7 responses
            31 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by guillembm, Yesterday, 11:25 AM
            3 responses
            16 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by junkone, 04-21-2024, 07:17 AM
            10 responses
            149 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Working...
            X