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 sdauteuil, Today, 12:00 PM
        0 responses
        5 views
        0 likes
        Last Post sdauteuil  
        Started by georges61, Today, 11:35 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by outcodenick, Today, 11:48 AM
        0 responses
        1 view
        0 likes
        Last Post outcodenick  
        Started by EquityTrader, Today, 11:37 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by Atomic, Today, 11:27 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X