• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Skipping CurrentBar during processing

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

    Skipping CurrentBar during processing

    Alright....so I am trying to get an indicator coded...everything is going great thus far... and then...

    For some reason ninja is not accessing every bar on the chart. I am using ninja 7. The code I was working on when ninja started this problem is identical to the code in the "@Stochastics.cs" file in the custom indicators folder.

    I noticed it when my indicator was returning null for some values in the K plot. I had the indicator dump the values to the output window and it showed some values of CurrentBar are being skipped. As long as the bars on the chart do not change, the exact same values are skipped when I re-apply the indicator. If I connect to my broker and update the chart, it skips completely different bars.

    It doesn't seem to matter what the bars are doing (moving up vs moving down), or what size they are. In addition, all bars report correct values in the Data Box, and on the skipped bars, the indicator reports "N/A" for the K value. I have tried it on different charts and it still skips seemingly random bars.

    I am attaching a pic of a chart this is happening on, and a pic of the relevant data dump from the output window.
    Attached Files

    #2
    Originally posted by Antny View Post
    For some reason ninja is not accessing every bar on the chart.
    Inconceivable!

    (Lol, how could I pass up a plug for The Princess Bride?]

    Originally posted by Antny View Post
    I am attaching a pic of a chart this is happening on, and a pic of the relevant data dump from the output window.
    Actually, skipping bars would be bad and wrong, and there is probably another simpler explanation.

    Is this occurring over a session boundary on your chart?
    [It looks to me, from your attached image, the answer is yes]

    What is your Session Template setting for the chart?

    Have you tried right clicking in the chart window and "Reload All Historical Data"?

    What is your Merge Policy for your data?

    Also, during debugging, I would recommend printing Time[0] when you print CurrentBar, the second screenshot you attached would have been much more helpful with this timestamp information.

    Comment


      #3
      Hello Antny,


      So that I may have a more complete picture of what is happening on your end, would it be possible to use the freely and publicly available screen capture software Jing, https://www.techsmith.com/jing.html , or a similar program which can record video of what is happening on your screen, so that you can show me what is occurring on your end? These quick instructions can get you started with Jing.

      1. When you start Jing, a yellow half circle will appear near the top of your screen. Please hover over it with your mouse
      2. A small + sign will extend out of this half circle. Please click on it
      3. When your cursor becomes two intersecting lines, please click and drag your mouse over an area of your screen you would like to record
      4. Please press the film strip button that appears to begin recording
      5. When you are finished recording, please press the square stop button that appears
      6. Please press the share button that appears. It consists of three vertical upward pointing arrows.

      You will then have the option to view your video on screencast.com . This is the link which can help me diagnose what is happening on your end. It is possible you will need to set up a free account in order to share videos.




      Thank you very much in advance for providing us with this information. If this procedure is not an option for you, or if there are any other questions we can answer, please let us know.
      Jessica P.NinjaTrader Customer Service

      Comment


        #4
        Thanks for the responses. I have no problems posting more info...but I am having to wait for the problem to happen again. So far it has not happened today. Will post more info when I can catch it happening again.

        Comment


          #5
          Hahahahaha! Why is it always the little bugs that cause the big problems? Okay...so I figured out the problem.

          I primarily use tick and range bar charts. The indicator recalcs on every tick. I wanted to reduce the frequency of data dumps to the output window, so I dropped in a simple piece of code to force it to process once per bar.

          As it turns out, tick charts and range charts do not play well with this. I shifted the code to a later point, and suddenly...no more skipped CurrentBars.

          The code I used was this...
          Code:
          if(bartesttime==Time[0]) {return;} else {bartesttime=Time[0];}
          Still not sure why it skips processing some of the bars, unless it has to do with fast printing bars having the same time code. Regardless, that was the source of the issue (hopefully).

          Comment


            #6
            Fast tick bars or 1 range bars may have same time stamps. 1 tick bars are the worst. Every bar will have a bar number though so you would need to not filter by time stamps to process all the prints.
            eDanny
            NinjaTrader Ecosystem Vendor - Integrity Traders

            Comment


              #7
              Originally posted by Antny View Post
              Still not sure why it skips processing some of the bars, unless it has to do with fast printing bars having the same time code.
              NinjaTrader 7 only has 1 second granularity for the timestamp stored in Time[0].

              Naturally, on time-based charts, every bar has a different timestamp.

              But for other charts, such as Tick, Range, Renko, etc, absolutely you will find many bars with the exact same timestamps, exactly at those moments where price was moving very fast.

              For example, an "instantaneous" price drop of 10+ ticks will create at least 2 bars on a 4-Range chart ... and each bar will have exact same timestamp.

              Comment


                #8
                Thanks for the verification. After remembering, and commenting out that code (and subsequent vanishing of the problem), I suspected there was a minimum granularity for the timestamps, and that was causing the problems.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by fx.practic, Today, 01:41 AM
                0 responses
                3 views
                0 likes
                Last Post fx.practic  
                Started by fx.practic, Today, 01:36 AM
                0 responses
                3 views
                0 likes
                Last Post fx.practic  
                Started by wolfcuring, Today, 01:29 AM
                0 responses
                1 view
                0 likes
                Last Post wolfcuring  
                Started by BrandonT1292, 06-17-2019, 03:03 PM
                2 responses
                22 views
                0 likes
                Last Post thinarthrill  
                Started by cbentrikin, Yesterday, 07:46 PM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_Marco  
                Working...
                X