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 Pattontje, Yesterday, 02:10 PM
            2 responses
            15 views
            0 likes
            Last Post Pattontje  
            Started by flybuzz, 04-21-2024, 04:07 PM
            17 responses
            229 views
            0 likes
            Last Post TradingLoss  
            Started by agclub, 04-21-2024, 08:57 PM
            3 responses
            17 views
            0 likes
            Last Post TradingLoss  
            Started by TradingLoss, 04-21-2024, 04:32 PM
            4 responses
            45 views
            2 likes
            Last Post TradingLoss  
            Started by cre8able, 04-17-2024, 04:16 PM
            6 responses
            57 views
            0 likes
            Last Post cre8able  
            Working...
            X