Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Doing backtest with daily values, I am missing last 2 days, why?

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

    Doing backtest with daily values, I am missing last 2 days, why?

    Although the charts show today (5/21)'s closing values, using debug I was able to see that the backtest ended on (5/19). How I can fix this? I would like it to use up to the latest closing value.
    Thanks,
    CP

    #2
    Hello,

    Can you chart the days you speak of? What data feed and instrument is it? Does it happen on more than one instrument (on the chart)?
    DenNinjaTrader Customer Service

    Comment


      #3
      Yes I the values show up on the charts(I cannot attach image), it shows up like this for any stock I have tried. I am using the Yahoo historical connection. For example the following code: Run to 5/22, which shows up on chart. Only prints out closing price of 5/20. The backtest does show that exit on close on the 5/21. And the SMA's are graphed until 5/21. But why isn't OnBarUpdate called on 5/21 and 5/22 data?

      Code:
      Print("Test: " + Instrument.ToString() + ":" + Time[0].ToString() + " Close: " + Closes[0].ToString());
                  if (CrossAbove(SMA(10), SMA(20), 1))
                      EnterLong();
                  else if (CrossBelow(SMA(10), SMA(20), 1))
                      EnterShort();
      ...
      Test: INTC Default:5/18/2010 12:00:00 AM Close: 21.43
      Test: INTC Default:5/19/2010 12:00:00 AM Close: 21.6
      Test: INTC Default:5/20/2010 12:00:00 AM Close: 20.79

      Comment


        #4
        Hello,

        This is most likely because Yahoo doesn't send the end of the day "event" until Monday. So the close for Fri. never shows up until Monday morning. Sorry, there is nothing we can do about it.

        As a workaround, you can use a different data feed:
        http://www.ninjatrader-support.com/H...ricalData.html

        Or you could simulate a Friday close for your strategy by checking to see if it is Friday and checking the time, then use the last price given.
        DenNinjaTrader Customer Service

        Comment


          #5
          Ok,
          Is there a way I can get access to the data on the last day that there is data. i.e. the day that "exit on close" transaction takes place? It doesn't seem to go to OnBarUpdate()
          Thanks,
          CP

          Comment


            #6
            Hello,

            Sorry, you are using Yahoo which only has daily data. So you would get this data if you were running the system live and you had CalculateOnBarClose = true. However in a backtest you won't get that data unless you use a multiple time frame set up, which would take intra-day data, which you don't have.

            Sorry, with Yahoo you are limited to daily data only:
            http://www.ninjatrader-support.com/H...ricalData.html
            DenNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by fredrikn, 05-08-2019, 04:01 AM
            57 responses
            4,390 views
            2 likes
            Last Post Momentum  
            Started by Blairski, Yesterday, 09:19 AM
            2 responses
            11 views
            0 likes
            Last Post Blairski  
            Started by tonynt, Today, 09:33 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by minotti1, Today, 08:31 AM
            1 response
            13 views
            0 likes
            Last Post NinjaTrader_Jim  
            Started by SmartArtsStudio, 05-15-2021, 10:46 AM
            1 response
            15 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X