Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Address the most righ in historical data

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

    Address the most righ in historical data

    Is it possible to write a condition that will execute a code only when reaching the last bar, when all data is historical?

    The goal is to avoid unnecessary evaluations when OBU starts iterating from the first bar and have it evaluating only when reaching the last bar.

    It's like the if (Historical) return; thing, but when working with historical I need a different attribute that distinguishes the last bar.

    #2
    savekad, yes you could work with CurrentBar and Count in combination with the Historical property to determine this. I would start with testing something like -

    if (Count -1 == CurrentBar && Historical)
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Nice.

      Is it possible that Count will return something other than CurrentBar + 1 ?

      Didn't fully understand the inflight ticks thing from the article.
      Last edited by savekad; 08-25-2012, 11:53 PM.

      Comment


        #4
        NinjaTrader is an event based and multithreaded architecture, so while the OnBarUpdate() CurrentBar is processed, inflight ticks coming into the system could be seen - for example on shortterm tick based charts and a high volume event occurring.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          But I assume that as OBU has started its execution, the Count value won't change in the middle of the process, right?

          In other words, as far as OBU cares, Count will always be CurrentBar + 1 when OBU starts evaluating the last bar, even if rapid data arrived before the evaluation completed. Correct?

          Comment


            #6
            You are correct in understand, provided CalculateOnBarClose is 'true'.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by varun12343, Today, 03:09 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Marco  
            Started by Lance El Camino, Yesterday, 04:14 PM
            2 responses
            26 views
            0 likes
            Last Post NT-Roland  
            Started by MatthewLesko, Yesterday, 11:13 PM
            1 response
            14 views
            0 likes
            Last Post NT-Roland  
            Started by kevinenergy, Today, 01:44 AM
            0 responses
            8 views
            0 likes
            Last Post kevinenergy  
            Started by jtrading82, Yesterday, 04:56 PM
            1 response
            14 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Working...
            X