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

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 DJ888, 04-16-2024, 06:09 PM
            6 responses
            18 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by Jon17, Today, 04:33 PM
            0 responses
            1 view
            0 likes
            Last Post Jon17
            by Jon17
             
            Started by Javierw.ok, Today, 04:12 PM
            0 responses
            6 views
            0 likes
            Last Post Javierw.ok  
            Started by timmbbo, Today, 08:59 AM
            2 responses
            10 views
            0 likes
            Last Post bltdavid  
            Started by alifarahani, Today, 09:40 AM
            6 responses
            41 views
            0 likes
            Last Post alifarahani  
            Working...
            X