Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars Array

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

    Bars Array

    In NT7 with CalculateonBarClose==True ex. High[0] accessed the already Closed Bar and when CalculateonBarClose=False High[0] accesses the Currently Building Bar. Is there any Method within NT8 to to access the Currently Building Bar information with CalculateOnBarClose ==True ? or Does my code have to Remember it.

    Thanks
    Jerry

    #2
    Hello Jerry,

    The concept is the same in NinjaTrader 8. However, instead of CalculateOnBarClose being true or false, NT8 uses Calculate and this can have a value of OnBarClose, OnPriceChange, or OnEachTick.

    Below is a link to the help guide on Calculate.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes , I misSpoke a bit. The reason I was suspecting that something was different is that I use 3 Time frames and BarsInProgress to with case statements to sort things out. When trying to use Bars.GetTime(CurrentBars[0]) while processing BarsInProgress==2 It generates an error telling me that an Object Reference is not set to an instance of an Object while if I use Bars.GetTime(currentBar[2]) while processing BarsInProgress==2 it has no problem. Previously in NT7 I handled all my drawObjects relative to CurrentBars[0] Regardless of BarsInProgress to get the finest chart placement for the objects. I did this using BarsAgo not time because using Bars in Real time gave better results.

      Why am I experiencing an issue with this ? i.e. What is it I am missing or don't understand ?
      Thanks
      Jerry

      Comment


        #4
        Hello Jerry,

        I am unable to reproduce this behavior.

        I have created a simple script to demonstrate. Are you able to reproduce the behavior using this simple test script?
        Attached Files
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          You have the idea, but I was able to get the time using GetTime and print it but unable to use it a DrawLine. I will add the change and repeat the test. Possibly its my enviroment.
          Last edited by JerryWar; 11-28-2016, 10:28 AM.

          Comment


            #6
            Hello Jerry,

            I have added a Draw.Line() call using the BarsArray[0].GetHigh(CurrentBars[0]) value.

            I am still unable to reproduce an error.

            Are you able to reproduce the error using the updated version of this script that draws a line?
            Attached Files
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              So before I go do a whole bunch of Tesing.

              While BarsInProgress was = 2, I was using:

              StartTime = Bars.GetTime(CurrentBars[2]); which got the correct time worked. But when using
              StartTIme = Bars.GetTime(CurrentBars[0]); which got the correct time it choked in the Drawline.

              So is the Bars.GetTime only valid for the BarsInprogress being process but the BarsArray[0] valid
              regardless of BarsInProgress ?

              Jerry

              Comment


                #8
                Chelsea
                Here is Code I used that generated Error. If you change currentBars[2] to currentBars[0] it will generate the error so I assume what I indicated before was correct that Using Bars.GetTime only works when it agrees with the BarsInProgress.

                Jerry
                Attached Files

                Comment


                  #9
                  Hello Jerry,

                  When using Bars, this will refer to which ever bar is currently processing, indicated by the BarsInProgress value. This is the same for any other bar specific information like the Close series will refer to the currently processing series and will only return the Close for that currently processing series.

                  Are you attempting to get a value of a secondary series by calling Bars.GetTime from the currently processing series?
                  This is not going to work. A bars series will only contain values for that bar series. If you want a value from a different bars, you would need to use .GetTime from that bar series.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by GussJ, 03-04-2020, 03:11 PM
                  11 responses
                  3,221 views
                  0 likes
                  Last Post xiinteractive  
                  Started by andrewtrades, Today, 04:57 PM
                  1 response
                  10 views
                  0 likes
                  Last Post NinjaTrader_Manfred  
                  Started by chbruno, Today, 04:10 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post chbruno
                  by chbruno
                   
                  Started by josh18955, 03-25-2023, 11:16 AM
                  6 responses
                  436 views
                  0 likes
                  Last Post Delerium  
                  Started by FAQtrader, Today, 03:35 PM
                  0 responses
                  9 views
                  0 likes
                  Last Post FAQtrader  
                  Working...
                  X