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 Max238, Today, 01:28 AM
            4 responses
            34 views
            0 likes
            Last Post Max238
            by Max238
             
            Started by r68cervera, Today, 05:29 AM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by geddyisodin, Today, 05:20 AM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by timko, Today, 06:45 AM
            2 responses
            13 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by habeebft, Today, 07:27 AM
            0 responses
            6 views
            0 likes
            Last Post habeebft  
            Working...
            X