Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BUG: Bars.TickCount

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

    BUG: Bars.TickCount

    In NT7, Bars.TickCount never correctly reported the number of ticks in an historical bar, but did correctly report the number of ticks in a real-time bar.

    In NT8, Bars.TickCount never reports the correct number of ticks in a bar, not historically, and not in real time.

    #2
    Hello strategesis,

    Thank you for writing in. I am currently testing this on my end and will update you when I have more information.

    Thank you for your patience in the meantime.
    Michael M.NinjaTrader Quality Assurance

    Comment


      #3
      Hello strategesis,

      Bars.TickCount is the tick count of the last bar. If TickCount == 100 on a 100 tick series, a new bar is started on the next tick.The series is built from all ticks from the beginning of the first session until 'now' -> most likely the last historical bar is not 'full' with 100 ticks.
      If you would print TickCount in realtime, you would see the values moving to 100, and then starting from 1 again.

      Please make sure you have Tick Replay enabled and that your script is set to calculate on each tick and let me know if the issue persists.

      Thank you in advance.
      Michael M.NinjaTrader Quality Assurance

      Comment


        #4
        Michael,

        In realtime and with Calculate set to OnEachTick, TickCount works as expected. But that does not solve either problem: I need TickCount to work in real time the way it did in NT7 when Calculate is set to OnBarClose. It does not.

        I also tried enabling tick replay (first in the options, and then for the Data Series,) but that did not solve either problem: With tick replay enabled, Bars.TickCount always reports a value of 1 (using 1-minute bars,) for both historical and real time bars, regardless of whether Calculate is set to OnBarClose or to OnEachTick.

        I can provide source code on request.

        Comment


          #5
          Hello strategesis,

          I have created test scripts in NT7 and NT8 to verify the output.

          NinjaTrader 7

          For a 1 minute ES 09-15 chart, the CalculateOnBarClose = false version returns 22 for every historical bar and then incrementing values from 1 to the number of ticks that make up the full bar when it closes.

          For a 1 minute ES 09-15 chart, the CalculateOnBarClose = true version returns 563 for every historical bar and then 1 for every real-time bar.

          NinjaTrader 8

          For a 1 minute ES 09-15 chart, the Calculate.OnEachTick (without TickReplay) version returns 870 for every historical bar and then incrementing values from 1 to the number of ticks that make up the full bar when it closes.

          For a 1 minute ES 09-15 chart, the Calculate.OnEachTick (with TickReplay) version returns incrementing values from 1 to the number of ticks that make up the full bar when it closes for both historical and realtime.

          For a 1 minute ES 09-15 chart, the Calculate.OnBarClose (without TickReplay) version returns 441 for about half and then 442 for the rest of the historical bars and then 1 for every realtime bar.

          For a 1 minute ES 09-15 chart, the Calculate.OnBarClose (with TickReplay) version returns 1 for every historical and realtime bar.

          The only logic I used to get these values in the OnBarUpdate() method in both NinjaTrader 7 and NinjaTrader 8 is:
          Code:
          Print(CurrentBar + ": " + Bars.TickCount);
          I have discussed this with our product management department and it was confirmed that this is the expected behavior. The reason this changed between NT7 and NT8 is because it did not work correctly in NT7. You need to use Calculate.OnEachTick with Tick replay to get correct historical and realtime values out of the TickCount variable.

          Please let me know if you have any questions or if I may be of further assistance.
          Last edited by NinjaTrader_MichaelM; 08-21-2015, 01:00 PM.
          Michael M.NinjaTrader Quality Assurance

          Comment


            #6
            Firstly, I was mistaken about the CalculateOnBarClose setting I was using in NT7. I thought my (real, not test) indicator was using CalculateOnBarClose = true, but it uses CalculateOnBarClose = false. Because of that misreading, when porting the indicator to NT8, I changed CalculateOnBarClose = false from the original NT7 code to Calculate = Calculate.OnBarClose in the NT8 version.

            I've always found the semantics of the CalculateOnBarClose property to be confusing, in that I tend to think that a value of 'false' means the opposite of what it actually means. The reason for that, I think, is because I conceptualize the issue as whether or not the indicator will/should recompute the plot value(s) after each tick, and not as whether or not it will/should recompute them as of the close of each bar (which it should always do, whether or not it also recomputes after each tick!)

            So I strongly favor the renaming of the that property, and making it into an enumeration type.

            In any case. using Calculate = Calculate.OnEachTick solves my immediate problem. But I still think that, in the case of historical bars, that Bars.TickCount should provide the count of ticks in the most recently closed bar, even without using the tick replay feature.

            For NT7, I created my own work-around for the problem of using Bars.TickCount with historical bars (and many other related issues): I record the tick data, the level 1 quote data and the level 2 quote data (with 20-to-one compression) and have my indicators which need such information read it back. I have many indicators which use that capability, and it appears to be faster than tick replay, so I will be porting it to NT8 and will continue to use it.
            Last edited by strategesis; 08-21-2015, 02:02 PM.

            Comment


              #7
              Addendum: I just discovered that in order to get an indicator to work correctly with tick replay after having enabled tick replay on the Data Series, one must shut down NT8 and then restart it. Just closing the connection and then reconnecting isn't sufficient.

              Comment


                #8
                Originally posted by strategesis View Post
                Addendum: I just discovered that in order to get an indicator to work correctly with tick replay after having enabled tick replay on the Data Series, one must shut down NT8 and then restart it. Just closing the connection and then reconnecting isn't sufficient.
                What do you mean? What happened before you restarted? Just checking that option on/off on the data series should do the trick in my experience-> anything else I'd consider a bug.
                MatthewNinjaTrader Product Management

                Comment


                  #9
                  What I did:

                  1) Used the Options dialog to enable the tick replay feature.

                  2) Closed the market data feed connection.

                  3) Reconnected to the market data feed (Kinetick.)

                  4) Selected the Tick Replay option (set it to true) in the Data Series dialog.

                  5) Observed that the historical tick counts were always the same value. The indicator was set to Calculate.OnEachTick.

                  Later, I shutdown then restarted NinjaTrader, and noticed that the historical tick counts being plotted by my test indicator were now correct.

                  Could it be that I also needed to select Reload NinjaScript from the chart's right-button menu, after resetting the Tick Replay option to true?

                  Comment


                    #10
                    Hello strategesis,

                    Using the steps you provided I am unable to recreate the issue. I have attached a screenshot of what my output window looks like right before and after I complete the last step you provided.

                    If you are able to recreate this issue on your end again, please let me know the exact steps you took as well as the code you are using to test so I may investigate further.

                    Thank you in advance.
                    Attached Files
                    Michael M.NinjaTrader Quality Assurance

                    Comment


                      #11
                      Tick Counter not in sync with multiple charts

                      I am using the NT8 tick counter on 3 ES charts. I use the tick counter in the count down mode. Each of the charts is using a multiple of the 'base tick count' which I use as 1500 ticks. The other charts are X2 base tick count, and X6 base tick count. I enter trades after the close of a bar. In NT7, all the tick counts were in sync (that is, if base chart was at 500, the other two charts were at 2500 and 8500 for example). Now in NT8, none of the 3 charts has a common tick count between them. That is, in NT8 version RC1, all the charts are running asynchronous to each other. Is there a way to make all charts using a whole multiple of the tick count between each other run in sync. This (tick count in sync across same instrument charts) feature worked this way in NT7, and I never had to set anything to get it to work that way.

                      Comment


                        #12
                        Hello rfjoeyb,

                        When testing the tick counter on three ES charts--1500T, 3000T, and 9000T--I'm seeing that the tick counter is working as I would expect. I have attached a short video demonstrating what I am seeing: http://screencast.com/t/SpWmnjDBr7G

                        Can you please ensure that you have the TickCounter's Calculate property on all instances of TickCounter set to "On each tick"? This can be modified by right-clicking on the chart and selecting Indicators.

                        If you are still seeing this behavior, can you provide a screenshot of what you're seeing on your charts?

                        To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.

                        Click here for instructions

                        Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

                        Click here for detailed instruction
                        Zachary G.NinjaTrader Customer Service

                        Comment


                          #13
                          Tick Counter not in sync with multiple charts

                          What I've figured out, since I've received and investigated the previous response, is that the chart which is running JigSaw indicators is the chart that has the tick indicator out of sync relative to those charts that do not have JigSaw indicators running. I opened new charts, without the JigSaw indicators, and the tick counters are all in sync. So, now that I know what appears to be causing this issue, I know how to work around it. I'm fine with the JigSaw indicators as well, since working around this is not an issue for me. I just minimize the charts that contain the JigSaw indicators, which has no effect on the actual use of the JigSaw indicator which remain visible and fully operational. I then just use separate charts without the JigSaw indicators for my visuals. All appears well. Thanks to Ninja Customer Tech Service.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by RookieTrader, Today, 09:37 AM
                          3 responses
                          13 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by kulwinder73, Today, 10:31 AM
                          0 responses
                          1 view
                          0 likes
                          Last Post kulwinder73  
                          Started by terofs, Yesterday, 04:18 PM
                          1 response
                          22 views
                          0 likes
                          Last Post terofs
                          by terofs
                           
                          Started by CommonWhale, Today, 09:55 AM
                          1 response
                          3 views
                          0 likes
                          Last Post NinjaTrader_Erick  
                          Started by Gerik, Today, 09:40 AM
                          2 responses
                          7 views
                          0 likes
                          Last Post Gerik
                          by Gerik
                           
                          Working...
                          X