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

OnBarClose not triggering on every Bar Close

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

    OnBarClose not triggering on every Bar Close

    I'm using UniRenko bars type for my strategy and I see that in the case where multiple bars print at the same time, OnBarClose is only getting called on the last bar. In the case of Ninza Renko I see it getting triggered on every bar close, which is what I want. Is this a known issue?

    I could use something like NinzaRenko here, but the later part of my strategy involves creating a custom Renko bar type and since UniRenko code is available, I was planning on using it as a base.

    Is there a solution to get around this?

    #2
    OnBarClose?

    You mean OnBarUpdate, right?

    Comment


      #3
      Right yeah, OnBarUpdate when calculate is set to On Bar Close
      Last edited by admiralpanda; 02-29-2024, 01:50 PM.

      Comment


        #4
        Hello admiralpanda,

        Can you reproduce the behavior without using custom bar types?
        Can you reproduce using Renko bars?

        I've tested and I am not able to reproduce.

        Below is a link to a video.


        Attached is the simple test script.
        MutliSeriesPrintTest_NT8.zip

        Both BarsInProgress 0 and BarsInProgress 1 are both printing to the output window when their respective bar closes.

        Using this test script and following the same steps shown in the video, is the behavior different than what is shown in the video?
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I'll try them out with NT's Renko bars and post the results here.

          Btw, the problem I see is not when there are multiple series. It is with single series and when multiple bricks are printed at the same time. For ex, if at 12:00:12pm the price spiked and 3 bricks are printed at the same time. The OnBarUpdate function is called only on the third bar.

          Comment


            #6
            Hello admiralpanda,

            Apologies I misunderstood.

            If the price spikes in a direction this could mean the renko bar type will fill any gap with empty bars which will have no volume. In the Renko bar type script this is done on lines 115 to 120.

            Are these the bars you are referring to?
            Are you seeing the bars that appear skipped by OnBarUpdate() have no volume on the chart?
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Yes, those are the bars that being skipped. I was under the impression that those bars should also trigger onBarUpdate(), is that not the case?
              And is there a possible solution?

              Comment


                #8
                Originally posted by admiralpanda View Post
                Yes, those are the bars that being skipped. I was under the impression that those bars should also trigger onBarUpdate(), is that not the case?
                And is there a possible solution?
                Hello admiralpanda,

                I suggest you could change the approach by using calculate OnEachTick and, along with it, using the IsFirstTickOfBar variable. This way, you would be able to count each candle and perform your tasks on each one using Close[1] after IsFirstTickOfBar becomes true.​

                Comment


                  #9
                  Hello admiralpanda,

                  I've tested and I'm seeing OnBarUpdate() is getting called for the bars with no volume.

                  Attached is the test script and the output as well as a screenshot of the chart highlighting the real-time bar with no volume.
                  [ATTACH]n1293890[/ATTACH]
                  [ATTACH]n1293891[/ATTACH]

                  May I have you test this test script (without making any modifications) on the Renko bar type and reproduce the behavior, then provide the output saved to a text file along with a screenshot of the chart with the data box open and the mouse placed over the bar that is missing from the print output?

                  If you have other scripts printing, please temporarily remove these or comment out the prints so they are not included in the print output.
                  Attached Files
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by DJ888, Yesterday, 10:57 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post DJ888
                  by DJ888
                   
                  Started by MacDad, 02-25-2024, 11:48 PM
                  7 responses
                  158 views
                  0 likes
                  Last Post loganjarosz123  
                  Started by Belfortbucks, Yesterday, 09:29 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post Belfortbucks  
                  Started by zstheorist, Yesterday, 07:52 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post zstheorist  
                  Started by pmachiraju, 11-01-2023, 04:46 AM
                  8 responses
                  151 views
                  0 likes
                  Last Post rehmans
                  by rehmans
                   
                  Working...
                  X