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)

    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.

        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'.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            599 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            344 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            103 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            558 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            557 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X