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

BarsType

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

    BarsType

    I looked at the various built in BarTypes and would appreciate some clarification:


    1. The UpdateBar updates the bar that matches the 'time' parameter, not necessarily the last, right?

    2. How are the other parameters used, e.g. is 'volume' added to the existing volume in the bar, is the maximum taken between the supplied 'high' and existing 'high'?

    3. Historical bars are added in the background and not passed through OnDataPoint, right?

    Thanks, Adi

    #2
    Hello adyle0,

    Thank you for your post.

    1. UpdateBar() updates the bar that is currently being built. There is no means to update a prior bar by time. The time of the UpdateBar() function is the time you set for the current bar.

    2. Volume is the bar's volume as of the data point and would be the cumulative volume until you call AddBar() again.

    3. All bars are created through OnDataPoint() including the historical bars.

    Please refer to the BarsTypes in the NinjaScript Editor for examples of these uses. I recommend experimenting with your own BarsTypes to see how each item updates.

    You can also refer to the Help Guide for more information: http://ninjatrader.com/support/helpG.../bars_type.htm

    Please let me know if I may be of further assistance.

    Comment


      #3
      Thank you for your reply Patrick.

      I did experiment and set a breakpoint at OnDataPoint with @SecondBarType. The first time it was hit bars.Count was already non zero. Another attempt with TickBarsType and first time the breakpoint hit bars.Count = 0 but the second time it was quite a large number.

      What am I missing?

      Thanks,
      Adi

      Comment


        #4
        Hello adyle0,

        Thank you for your response.

        Can you provide an example of the code used and the Output you received?

        Comment


          #5
          Could caching be taking place? I noticed the bars.Count starts with a value other than 0 when I decrease the Number Of Days to load

          Comment


            #6
            Hello adyle0,

            Thank you for your response.

            What number is it starting with?

            Can you provide an example of the code used and the Output you received?

            I look forward to your response.

            Comment


              #7
              Hello Patrick,

              Can we discuss it further via email? How do I email you?

              Thanks,
              Adi

              Comment


                #8
                Hello Adi,

                Thank you for your response.

                Please send a note to platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and a reference to this thread in the body of the email.

                Comment


                  #9
                  Hello adyle0,

                  Thank you for your patience.

                  After reviewing and testing your code I found what you were referring to on the bars.Count. The reason it is a larger number at times is because the BarsType has already ran when we run the debugger, so the value is far larger than 0 in most cases.

                  I will follow up with you on email as well.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by quantismo, Yesterday, 05:13 PM
                  1 response
                  12 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Started by The_Sec, 04-16-2024, 02:29 PM
                  3 responses
                  16 views
                  0 likes
                  Last Post NinjaTrader_ChristopherS  
                  Started by hurleydood, 09-12-2019, 10:45 AM
                  15 responses
                  1,098 views
                  0 likes
                  Last Post Leeroy_Jenkins  
                  Started by danieldunn2024, Today, 03:06 AM
                  1 response
                  5 views
                  0 likes
                  Last Post NinjaTrader_Erick  
                  Started by cre8able, Yesterday, 04:16 PM
                  1 response
                  16 views
                  0 likes
                  Last Post NinjaTrader_Gaby  
                  Working...
                  X