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

why is onrender invoked about 3 times per second

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

    why is onrender invoked about 3 times per second

    I have been creating indicators that override onrender. I also have tick replay set for the dataseries.

    During a testing phase, I placed a print statement at the end of onrender. I was amazed to see it gets invoked about 3 times per second, even when not connected.

    Where can I get more details about what is invoking calls to onrender?

    #2
    Thank you for your question tulaunch. The help guide has this to say about OnRender

    Originally posted by http://ninjatrader.com/support/helpGuides/nt8/en-us/onrender.htm
    The OnRender() method frequently runs once the State has reached State.Realtime in response to market data updates or a user interacting with the chart (e.g., clicking, resizing, rescaling, etc.)

    For performance optimizations, the timing of the calls to OnRender() are buffered to at least 250ms, and re-renders once internal logic determines that values may be out-of-date. See also ForceRefresh() for more details
    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      I did see that doc.

      What I am seeing is this occuring when I am not connected and there is no activity - no data flowing, no chart changes, no user interactions, nothing. It continues to hit onrender about 3 times per second, second after second after second even when the system is doing absolutely nothing.

      Comment


        #4
        Thank you tulanch. Since OnRender is throttled to 250 ms, occurring 3 times per second is well within standard documented operating range for OnRender.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          I do understand that

          Are you indicating that onrender is called every 250 independent of the need to render?

          Again, these calls I am observing are occurring without a data connection, without a change in the display, without a mouse click, without a mouse movement - there is no event occurring which I would expect to trigger a render call.

          It appears NT8 is calling onrender 3-4 times per second at a minimum not matter if there is a need to re-render or not.

          is that the way it is supposed to work?

          Comment


            #6
            Please bear in mind that we are limited by the documentation when discussing the behavior of OnRender or any other part of NinjaTrader. Were I to give advice outside the documentation that was accurate to the way NinjaTrader currently performs, and NinjaTrader was changed afterward, the change would be correct, and my advice here would become incorrect even if it accurately described how Ninja operates currently.

            This said, it sounds like Ninja is not operating in accord with user expectations. We are always happy to accept feedback, and many improvements to NinjaTrader were suggested by users such as yourself.

            Would it be possible to provide us with a script and some steps we could use to see this on our end? Can you also let us know how often OnRender would ideally update? I will pass any information you send us on to the responsible teams.
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              I added this as the very first line in onrender

              Print(" ##########"+DateTime.Now.ToString());

              I did this in 2 of my indis and both outputted lines 3 per second continually

              Comment


                #8
                Thank you for your continued assistance improving NinjaTrader.

                I have prepared a test script with a string similar to the one you suggested in its OnRender. Can you run this script on your end and let us know if the results you see are other than those in this video? When you test on your end, please restrict your test to a workspace with only a single chart window, a single chart in its window, and only the attached indicator in its chart. Whether they differ or not, can you also let us know how OnRender is operating in any way other than the way you as a user would intuitively expect it to operate?

                Attached Files
                Last edited by NinjaTrader_JessicaP; 04-03-2017, 10:07 AM.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  I used your example code, it behaved just like it did in your video, it did not continue to loop through. It stopped like I would have expected.

                  I do have other windows button related code in my indi - the button allows me to change things on the fly. That must be affecting it some how. I will add it to the test code and see what happens. I'll report back.

                  But... after sleeping on this it may actually be better to have it working the way it is. I trade futures. When running my indi in live code it will behave just like it does when running not connected. The market is too fast and thus the built in throttle will kick into gear anyawy to slow the calls the onrender

                  I still will report back on what I find, but you can consider this closed, thanks for you replies

                  Comment


                    #10
                    attached is your previous code with the button code incorporated

                    the issue I reported seems to be related to the addition of this button code

                    I don't see where any timer/event check loop is created causing a refresh request within the button code, but definitely must be somewhere in .net land

                    again, after thinking about this issue, it is not a problem in fast moving markets as updates from tick changes are faster anyway. In a fast market the throttle you have in place is evident, especially in this code, and allows the indi to work by design.

                    This could be an issue in a slow market, but since I don't trade slow ones it's not an issue for me, and because it works on my machine during fast markets, even if it does spin on slow ones, still not an for me.

                    Just seems weird that a request to render is being made when it need not be, which could lead to or be the cause of some strange issue as the system is doing unexpected processing. Memory leaks come to mind.
                    Attached Files

                    Comment


                      #11
                      Thank you for providing this code sample tulaunch. I will use this code sample to investigate our platform. Should I uncover any behaviors in NT8 such as those you described, I will return to this thread with a report.
                      Jessica P.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Kensonprib, 04-28-2021, 10:11 AM
                      5 responses
                      191 views
                      0 likes
                      Last Post Hasadafa  
                      Started by GussJ, 03-04-2020, 03:11 PM
                      11 responses
                      3,229 views
                      0 likes
                      Last Post xiinteractive  
                      Started by andrewtrades, Today, 04:57 PM
                      1 response
                      14 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
                      441 views
                      0 likes
                      Last Post Delerium  
                      Working...
                      X