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

Closes Issue

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

    Closes Issue

    Hi

    I have a problem when calling Closes[3][0] as it is not capturing the latest bar in the history but the second latest one in the history. May be this is due to time zone issue? But I am thinking to write some codes to specifiy Closes of a date according to the history data, is it possible? say I want to get 12/12/2009 daily close, how to do it?

    #2
    Hello NingNing,

    This most likely has to do with the sequence of OnBarUpdates()

    Daily bars are time stamped with the time the bar will end, and this will often be later than the primary series you are evaluating.

    When using version 6.5 it is advised that any secondary series must be smaller than the first.

    You can use GetBar() to return the bars ago value of a specific date / time. This reference sample can help with this:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      HI

      I still struggle with it. Let me explain my problem again. I am backtesting from 1/8 to 12/8, and now is 12/8 in asia time. I have 1/8 to 11/8 FTSE cash index from YAHOO in Ninja. But when I do Add("FTSE", PeriodType.Day, 1) and do Closes[3][0]. The value is actually the one on 10/8 instead of 11/8 that I am expecting. Again, I am running it in asian time on 12/8 and FTSE has not yet closed on 12/8 so there is no new close data from yahoo. 11/8 close data is the last one I have. thx again

      Comment


        #4
        Hello NingNing,

        This will depend on many factors.

        Can you let us know which version you're using?
        Are you evaluating on historical or real time bars?
        What is your primary series?

        If in real time, what is the time stamp of the daily bar?
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          Hi

          My primary series is a 5Min bars on an asian index, and I am evaluating it using historical and real time data. I am still using 6.5 in fact. May I know how to know the time stamp for the market data? Please advise and thx again

          Comment


            #6
            NingNing, for 6.5 please use the daily as primary, so you can add the (faster) 5 min one...then print the BarsInProgress and Time of the call to the output window to see how the call sequence works -

            Code:
             
            if (BarsInProgress == 0)
            Print(BarsInProgress + " " + Time[0]);
             
            if (BarsInProgress == 1)
            Print(BarsInProgress + " " + Time[0]);
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hi

              I switch to 7.0 and still meet the same problem. Can you advise? thx again

              Comment


                #8
                Hello NingNing,

                Can you please share a simple strategy that illustrates what you're seeing? Let us know as well the primary series the strategy is run against, as well as the data feed you're using.
                Ryan M.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by bmartz, 03-12-2024, 06:12 AM
                4 responses
                31 views
                0 likes
                Last Post bmartz
                by bmartz
                 
                Started by Aviram Y, Today, 05:29 AM
                4 responses
                12 views
                0 likes
                Last Post Aviram Y  
                Started by algospoke, 04-17-2024, 06:40 PM
                3 responses
                28 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by cls71, Today, 04:45 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Working...
                X