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[1][0] vs Closes[1][1] on historical / realtime data

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

    Closes[1][0] vs Closes[1][1] on historical / realtime data

    Hi,
    my strategy/indicator has COBC = false and additional daily series via Add(PeriodType.Day, 1).

    How can you handle problem that indicator returns yesterday's close via Closes[1][0] for back-testing on historical data. But for live running I must use Closes[1][1] for yesterday's close.

    It means with Closes[1][1] are all my back-tested results 1 day delayed. And vice versa with Closes[1][0] a get today's close instead of yesterday's on real-time data

    Thanks for advice
    Peter

    #2
    Hi Peter Cherry,

    Are you using the Historical bool to choose the proper bars ago value?

    http://www.ninjatrader.com/support/h...historical.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi,
      no I am not.

      It means, I must split all my code into 2 parts with Closes[1][0] for historical and Closes[1][1] for real-time usage?

      Peter

      Comment


        #4
        Hi Peter Cherry,

        Yes.

        Or you can use an int variable that holds the bars ago value and set it accordingly.
        Chelsea B.NinjaTrader 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