Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Profiling NinjaScript

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

    Profiling NinjaScript

    This is a general question to the community...

    Has anyone tried to profile NinjaScript code with VS? Specifically for memory leaks and performance bottlenecks? If yes, how successful was it? And, would you be willing to share how you went about it?

    Your thoughts would be greatly appreciated. Thank you.

    #2
    Hello,

    Thank you for the post.

    I wanted to check, was the reason for this post a general question to see if anyone has done this before or are you seeing some performance issue to where you are trying to debug the platform with visual studio?

    You can attach visual studio to NinjaTrader but this would generally only be helpful/relevant to your custom NinjaScript items as the source of NinjaTrader is not available. If you are seeing some case that spurred this question, I would be interested in further details or steps to see what you are. In a situation where you are seeing poor performance, you may also try to remove/disable all third party items prior to testing to make sure nothing extra is causing what you may be seeing.


    Please let me know if I may be of additional assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      Thank you for following up. The question in fact was originally prompted by a performance issue. I have an indicator that draws a fair number of lines on the chart. The lines are updated in real time. If I have say 10 charts in a workspace, each running this indicator, NT freezes.

      This led to the general thought that perhaps the indicator might have other performance issues and could be recoded more efficiently. To do this effectively would require profiling so that I could see where the performance bottlenecks are. At the same time, a check could be made for memory leaks. Currently I am doing optimizations in my head which we both know is not the best way to go. So I'd like to find a way to profile my indicator using VS so that I can make the indicator code as efficient as possible and check it for any potential memory leaks.

      Comment


        #4
        Hello Zeos6,

        How are you drawing your lines on the chart? OnRender()? OnBarUpdate()?
        Josh G.NinjaTrader Customer Service

        Comment


          #5
          Hi Josh,

          Thanks for the reply. The lines are currently drawn via OnBarUpdate().

          Comment


            #6
            Hello Zeos6,
            Drawing objects are know to be performance intensive, so I suggest custom rendering those lines inside OnRender(). I'm willing to bet you will get much better performance this way.

            There is a sample indicator script in the NinjaScript Editor called "SampleCustomRender" that demonstrates quite a few things you can do with the OnRender method. I am also including the relevant help guide documentation for custom rendering below.

            OnRender()
            https://ninjatrader.com/support/help.../?onrender.htm

            Using SharpDX for Custom Chart Rendering
            https://ninjatrader.com/support/help..._rendering.htm

            Please take a look at the above links and the sample script in the editor as I think they are great resources. Of course let me know if you have any questions.
            Josh G.NinjaTrader Customer Service

            Comment


              #7
              Thanks for the reply JoshG.

              I do use OnRender() in my coding but at the time did not think that it would be that significantly more performant than OnBarUpdate(). I will certainly look into taking this approach. It will require some significant recoding on my part.

              However, this still leaves the issue of profiling the code for other performance issues.I am still very much interested in pursuing this.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geddyisodin, Today, 05:20 AM
              2 responses
              16 views
              0 likes
              Last Post geddyisodin  
              Started by hazylizard, Today, 08:38 AM
              0 responses
              6 views
              0 likes
              Last Post hazylizard  
              Started by Max238, Today, 01:28 AM
              5 responses
              42 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by giulyko00, Yesterday, 12:03 PM
              3 responses
              13 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by habeebft, Today, 07:27 AM
              1 response
              16 views
              0 likes
              Last Post NinjaTrader_ChristopherS  
              Working...
              X