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

indicator takes a lot more time to calculate, loaded on the current day

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

    indicator takes a lot more time to calculate, loaded on the current day

    Hi,

    I have an indicator, that is calculated on price change.

    If I load it on a chart starting today and 5 days back it takes about 40 seconds to calculate historical values and draw objects.

    If I load it on data starting yesterday and 5 days back it takes 6 seconds to calculate.



    There seems to be something that throttles the calculation, when real time data is coming in at the same time?!

    #2
    Hello td_910,

    When enabling today, likely new data is being pulled from the historical data server.

    When enabling for yesterday, likely all data is cached data.

    If you disconnect from all connections and add the indicator are you able to reproduce the behavior?

    Is the indicator processing tick data?
    If so, are the amount of ticks processed exactly the same?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChelseaB View Post
      Hello td_910,

      When enabling today, likely new data is being pulled from the historical data server.

      When enabling for yesterday, likely all data is cached data.

      If you disconnect from all connections and add the indicator are you able to reproduce the behavior?

      Is the indicator processing tick data?
      If so, are the amount of ticks processed exactly the same?
      yes, you can see, that the data is being loaded ("(Loading...)" in the upper left corner), I counted the 40+ seconds after the data was loaded and it said "(Calculating...)"
      it's also reproducible hitting F5, when real time data is coming in

      no tick data, just price change

      closing connections it takes less than 5 sec to calc

      Comment


        #4
        Hello td_910,

        If you are unable to reproduce when disconnected, this helps to confirm that the difference in speed is the different between pulling pre-cached data / chart and pulling historical data from the historical data server and recreating the chart cache.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_ChelseaB View Post
          Hello td_910,

          If you are unable to reproduce when disconnected, this helps to confirm that the difference in speed is the different between pulling pre-cached data / chart and pulling historical data from the historical data server and recreating the chart cache.
          let me rephrase this "closing connections it takes less than 5 sec to calc "

          data connection enabled, hit F5, 40+ sec
          data connection disabled hit F5, 5 sec

          not re-loading any data

          I have a decent Internet connection, 16GB RAM, I7, SSD
          the funny thing is, the NT7 indicator with the same logic is much faster, regardless, if there is a real time data connection or not
          Last edited by td_910; 04-08-2019, 12:19 PM.

          Comment


            #6
            also a question: what is the text "Loading..." for and what "Calculating..."

            with real time data connection up, the text "Calculating..." is showing for 40+ sec
            without real time data connection up, the text "Calculating..." is showing for 5+ sec

            for some reason it's taking longer, if there is a real time connection

            check out the video, there is nothing pulled from the historical data server

            Last edited by td_910; 04-08-2019, 01:05 PM.

            Comment


              #7
              Hello td_910,

              I'd like to give the script a test.

              May I have you make a copy of the script and strip out all logic that is not absolutely necessary to reproducing the behavior?

              Make sure the behavior can still be reproduced, but remove all code that can be removed and the behavior still occur.

              If possible, with logic such as conditions, either remove these or simply these so they trigger consistently instead of being dependent on market actions.

              Then export the reduced script so that I may test on my end.

              To export a NinjaTrader 8 NinjaScript so this can be shared and imported by the recipient do the following:
              1. Click Tools -> Export -> NinjaScript...
              2. Click the 'add' link -> check the box(es) for the script(s) and reference(s) you want to include
              3. Click the 'Export' button
              4. Enter a unique name for the file in the value for 'File name:'
              5. Choose a save location -> click Save
              6. Click OK to clear the export location message
              By default your exported file will be in the following location:
              • (My) Documents/NinjaTrader 8/bin/Custom/ExportNinjaScript/<export_file_name.zip>
              Below is a link to the help guide on Exporting NinjaScripts.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_ChelseaB View Post
                Hello td_910,

                I'd like to give the script a test.

                May I have you make a copy of the script and strip out all logic that is not absolutely necessary to reproducing the behavior?

                Make sure the behavior can still be reproduced, but remove all code that can be removed and the behavior still occur.

                If possible, with logic such as conditions, either remove these or simply these so they trigger consistently instead of being dependent on market actions.

                Then export the reduced script so that I may test on my end.
                I'll try that, but the logic is pretty complicated and is more than 500 lines of source code

                in the meantime check out the video https://www.screencast.com/t/2lroCZL2
                here you can clearly see, that the number of ticks coming in while the indicator is calculating determines the time it takes to finish

                check out the different runs:

                1st 1 tick coming in
                2nd 1 tick coming in
                3rd 1 tick coming in
                4th 4 ticks coming in

                5th more than 30 ticks coming in

                on that run the indicator takes more than 25 sec to finish calculating and another 8 sec to render the chart

                the only difference to the NT7 version is, that I'm using dynamic cast, to access some objects on the chart

                Comment


                  #9
                  Hello td_910,

                  Thank you for the video.

                  However, until I am able to reproduce I'm not able to investigate and provide more information.

                  Are you able to reproduce with all workspaces closed on a new chart using any indicators that are included with NinjaTrader?
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    I'll try my best

                    these were all the windows open in that one workspace
                    no other programs open and NT as the only foreground program

                    I don't know, if I mentioned it already, I run three instances of the indicator on that chart
                    Last edited by td_910; 04-09-2019, 07:26 AM.

                    Comment


                      #11
                      Hello td_910,

                      Testing multiple scripts and instances at the same time may make it difficult to find the cause of a behavior. My recommendation to reduce the amount of variables being tested.
                      Chelsea B.NinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by ShawnaMorgan, Today, 06:09 AM
                      0 responses
                      1 view
                      0 likes
                      Last Post ShawnaMorgan  
                      Started by Bogdan097, 02-19-2024, 10:03 AM
                      10 responses
                      27 views
                      0 likes
                      Last Post Bogdan097  
                      Started by jjopd2001, Today, 05:26 AM
                      0 responses
                      2 views
                      0 likes
                      Last Post jjopd2001  
                      Started by JaniceContreras, Today, 05:16 AM
                      0 responses
                      3 views
                      0 likes
                      Last Post JaniceContreras  
                      Started by Margi2021, Yesterday, 01:04 PM
                      2 responses
                      25 views
                      0 likes
                      Last Post Margi2021  
                      Working...
                      X