Announcement

Collapse
No announcement yet.

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 CaptainJack, 05-29-2026, 05:09 AM
        0 responses
        173 views
        0 likes
        Last Post CaptainJack  
        Started by CaptainJack, 05-29-2026, 12:02 AM
        0 responses
        90 views
        0 likes
        Last Post CaptainJack  
        Started by charlesugo_1, 05-26-2026, 05:03 PM
        0 responses
        129 views
        0 likes
        Last Post charlesugo_1  
        Started by DannyP96, 05-18-2026, 02:38 PM
        1 response
        208 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 05-11-2026, 05:56 AM
        0 responses
        186 views
        0 likes
        Last Post CarlTrading  
        Working...
        X