Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

multi-instrument strategy & IPO dates

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

    multi-instrument strategy & IPO dates

    Dear NinjaTraders,

    I am working on a multi-instrument strategy, which will include a lot of stocks, e.g. the NASDAQ-100. I would like to backtest this strategy for many years - which will almost inevitably lead to a desired start date prior to the IPO of some of the stocks included in the strategy.

    What I find is that OnBarUpdate is not called for dates prior to _all_ stocks being traded, in my current case some date in 2013. What I would like to see instead, is that I can simulate earlier dates (e.g. the last 10 years) - and somehow skip those stocks, which didn't exist at those early bars.

    How can I do that?


    Thank you,
    best regards, Felix

    #2
    Hello Felix,

    Thank you for your post.

    So fake historical data then? You can take a look at the historical data formats needed and how to import data at the following link: http://www.ninjatrader.com/support/h.../importing.htm

    Please let me know if you have any questions.

    Comment


      #3
      Hi Patrick,

      no, I was not looking at faking historical data. I am working on a multi-instrument strategy. If some of the stocks are already traded in the 1970s, I'd like to simulate these... even though some of the other stocks might be introduced much later, e.g. in the 1990s.

      Right now, it seems I am not seeing any OnBarUpdate calls for those earlier days (the 1970s). I would hope I am seeing events for the stocks that exist... and then little by little the other stocks come on top. Is there a way to do that?


      Thank you,
      best regards, Felix

      Comment


        #4
        Hello fbertram,

        The issue is that the backtest will start when all instruments have data.

        This means the test will start when the instrument with the least amount of data has the data start.

        It is not possible to have a script start before there is data for all added instruments.

        You may be able to get the data out of sync but this is not supported by NinjaTrader. There is an example of this in the Pivots indicator if you would like to take a look at line 109.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Patrick,

          while faking the historical data makes me cringe, it might not be the worst option after all. Here is what I have in mind: for the years earlier than IPO of the instrument, I could insert day data, with OHLC set to the open price on the first real trading day. The volume could be set to zero for these fake data and my algorithm should be able to happily deal with this.

          Now here comes another question:
          assuming I inserted these fake data - how long would they stay there? Under which circumstances would these data be overwritten and I would need to redo this? What would happen, if I only inserted data for the first trading day each year prior to IPO? Will OnBarUpdate() be called for every bar, even if not all stocks have data for that bar? Is there a way I could insert these fake data dynamically during Initialize()?

          Thank you,
          best regards, Felix
          Last edited by fbertram; 09-29-2014, 07:27 PM.

          Comment


            #6
            Hi Chelsea,

            thanks a lot for your response. Staring at the code you pointed me to, I have to admit that I don't really get what's going on there. While I am mildly disappointed, I guess I have to deal with the fact that the NinjaTrader engine is not really made for this.

            Thank you,
            best regards, Felix

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            561 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            325 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            101 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            547 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            547 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X