Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Start Date and End Date

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

    Start Date and End Date

    Hi,
    Is it possible to get Start Date and End Date that I set for backtest/optimization within NT strategy?
    The date of the first bar isn't always equals my Start Date because some stocks might have IPO within that range.
    Thanks.

    #2
    Hello Leeroy_Jenkins,

    You could use the From and To properties to find the dates you set in the UI. You would otherwise need to use the Time object to see the actual dates from the data.

    Code:
    Print(From + " " + To);
    
    Print(Time[0]);
    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi,
      To my understanding, the date set in the user interface cannot be iterated through in an optimization.
      But perhaps this here is helpful?
      https://ninjatrader.com/support/foru...of-instruments
      You might be able to use this concept and can perhaps even eloborate it further. You could add FromToDate variables by instrument setting the allowed date window.
      Example: Instrument1 only between Instrument1From and Instrument1To.
      With that, you can even correctly backtest strategies for instruments in an index using the correct index composition at any point in time, eliminating the "survivorship bias".
      NT-Roland

      Comment


        #4
        Originally posted by NT-Roland View Post
        To my understanding, the date set in the user interface cannot be iterated through in an optimization.
        NT-Roland
        What you're trying to do is beyond my understanding. Testing window is always should be reasonable and more importantly fixed. I don't know about you but comparing results from one stock with XX testing years and another stock with YY years doesn't make sense to me. It doesn't give you "stability" of a system.

        Comment


          #5
          Hi Leeroy_Jenkins,
          I tried to offer a solution to your question.
          "Is it possible to get Start Date and End Date that I set for backtest/optimization within NT strategy?
          The date of the first bar isn't always equals my Start Date because some stocks might have IPO within that range."

          What I suggested should allow you to exclude whatever time frame you want for individual stocks even if the overall range is not narrowed down.

          And the "survivorship bias" is a serious issue for all traders which test strategies against all instruments of a certain index, but don't pay attention to the fact that they test its current members only. The difference between fake and real performance is significant. One recent example? Imagine, you wanted to trade all DAX30 stocks, if they met some other conditions. Would you have invested in Wirecard? Likely Yes. And that one went bankrupt and was eliminated from the DAX30. Thus, if you backtest the DAX 30 strat NOW for let's say 10 years applying the current index composition, which obviously doesn't include Wirecard anymore, you trick yourself big time. Thus, it does make perfect sense to backtest against ALL instruments that have ever been in the respective index, but limit the trading time for each of them to the time they really were part of the index. Only then, you get reliable results.
          Other platforms offer that out of the box. In Ninja, you have to get your hands dirty.
          NT-Roland

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by D Trader, Today, 04:02 PM
          0 responses
          2 views
          0 likes
          Last Post D Trader  
          Started by aligator, Today, 02:09 PM
          2 responses
          15 views
          0 likes
          Last Post Harry
          by Harry
           
          Started by NinjaTrader_Kate, Today, 02:40 PM
          0 responses
          5 views
          0 likes
          Last Post NinjaTrader_Kate  
          Started by patpat, Today, 11:34 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by crystalet, Today, 10:41 AM
          3 responses
          14 views
          0 likes
          Last Post crystalet  
          Working...
          X