Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting futures across different contracts

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

    Backtesting futures across different contracts

    How can I backtest, for example, the ES across multiple contracts? For example, now I can only backtest the ES 09-09 from June until now. Then, if I want to test farther back, I have to test the ES 06-09 from March to June, then the ES 03-09 from Jan to March, etc, all separately. How can I span my backtesting across these different contract months?

    I'm using Mirus/ZenFire for data.

    #2
    Hello shodson,

    You can merge individual contracts to create a continuous contract, which you will subsequently backtest.

    Please see the link below for instructions to merge contracts.
    JasonNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Jason View Post
      Please see the link below for instructions to merge contracts.
      http://www.ninjatrader-support.com/H...eV6/Merge.html
      Oh wow, I am drooling for these NT7 features! It seems to solve most of my gripes with NT. Keep going guys. this release looks awesome!

      Comment


        #4
        Thank you for the info, this feature looks really nice and useful.

        I have a further question about merging future contracts:

        Is it generally preferrable to merge a contracts price data until the very date of expiration (For example, expiry of the dec 2009 ES contract was december 18) OR would you rather begin to use price data from the next contract earlier in the month, a few days before the previous contract expires? (i.e. starting to use data from the march 2010 ES contract from december 15-16 or even earlier)

        It may just be a question of liquidity, but I might as well ask for your opinion before I start merging. Of course I just want the best and most representative historical data possible.

        Comment


          #5
          Originally posted by Fierze View Post
          Thank you for the info, this feature looks really nice and useful.

          I have a further question about merging future contracts:

          Is it generally preferrable to merge a contracts price data until the very date of expiration (For example, expiry of the dec 2009 ES contract was december 18) OR would you rather begin to use price data from the next contract earlier in the month, a few days before the previous contract expires? (i.e. starting to use data from the march 2010 ES contract from december 15-16 or even earlier)

          It may just be a question of liquidity, but I might as well ask for your opinion before I start merging. Of course I just want the best and most representative historical data possible.
          On the ES I know that most volume starts moving over to the new contract starting on the Thursday the week before expiration. Definitely by the next Monday. So for example, Many people started moving over to the March 2010 contract on Thursday, December 10th, with volume about 50/50 across the Dec 2009 and the Mar 2010 contracts. By Monday the 14th most of it had moved over to the Mar 2010 contract. Some systems like Tradestation implement a "continuous contract" approach, but I'm not totally sure what dates they use to roll from one window of data to another.

          Comment


            #6
            I use Interactive Brokers for datafeed.

            I tried to merge the dec 09 ES contract (period 17 sep-17 dec) into the march 10 ES contract. It seemed to work without error messages, but I have not been able to locate the finished result. How do I open the merged contract, should I see the merged result when opening a new ES march 10-chart, or do I have to import some type of local file on my computer to see the merged data? At present, when I open a march 2010 ES chart I do not see any merged data from the dec 09 chart.

            I have a second question as well:
            How do I open charts of expired contracts in Ninja Trader? When using the Interactive Brokers software (TWS) I can see intraday charts from old contracts like ES june 09. How can I open these expired contracts in NT so I can merge their data with other ES contracts in order to make a big continuous contract? Just choosing ES 06-09 in NT does not seem to work, the contract is not recognized.

            Comment


              #7
              Originally posted by Fierze View Post
              I use Interactive Brokers for datafeed.

              I tried to merge the dec 09 ES contract (period 17 sep-17 dec) into the march 10 ES contract. It seemed to work without error messages, but I have not been able to locate the finished result. How do I open the merged contract, should I see the merged result when opening a new ES march 10-chart, or do I have to import some type of local file on my computer to see the merged data? At present, when I open a march 2010 ES chart I do not see any merged data from the dec 09 chart.

              I have a second question as well:
              How do I open charts of expired contracts in Ninja Trader? When using the Interactive Brokers software (TWS) I can see intraday charts from old contracts like ES june 09. How can I open these expired contracts in NT so I can merge their data with other ES contracts in order to make a big continuous contract? Just choosing ES 06-09 in NT does not seem to work, the contract is not recognized.
              I believe that IB has very limited support for historical data. You should get a second data provider like ZenFire for more historical data.

              Comment


                #8
                Originally posted by shodson View Post
                I believe that IB has very limited support for historical data. You should get a second data provider like ZenFire for more historical data.
                In separate NT charts, I can see ALL the historical data that I am trying to merge into one chart, so in this case the problem can not be IB's lack of historical data support.

                Would I normally see the merged data whenever I look at the march 10 contract after merging the dec 09 contract into it?

                And as I said, I can open old expired contracts in IB's own software without any problem, so why shouldn't I be able to open them in NT as well? IB's TWS software is unbelievably worthless for charts (and does not have a merge function) so I would rather use NT.

                Comment


                  #9
                  Hello Fierze,

                  Can you please perform the merge once more. Subsequently create a new chart for the instrument you merged and check if all data is present.

                  Could it be the previous attempts did load historical data from IB over the merged data? Please see the link below on how NinjaTrader loads historical data.


                  Note that this is improved in NinjaTrader 7.


                  New Continuous/Merged Futures Contracts
                  The concept of continuous contracts are implemented in a manner that allows you to continue to work with the front month for trading (ES 09-09 is the current front month as of this writing) and define a rollover date, June 11, 2009 is the contract boundary between June and September contracts. Rollover dates for the most popular futures contracts will be managed by NinjaTrader server and automatically uploaded to you. You can of course overwrite this. You then set up a "Merge policy" globally which can be overridden at the instrument level. As you request a historical chart, if the days to load crossed over the rollover boundary, NinjaTrader will transparently request the prior month(s) historical data and merge it into one Data Series based on the selected merge policy. This entire process is of course transparent to the user and ensure that a complete chart is received and that you know which contract you are actually executing trades against.

                  Do you receive an error message in the NinjaTrader Control Center-->Log-tab when you request such data?
                  JasonNinjaTrader Customer Service

                  Comment


                    #10
                    Originally posted by NinjaTrader_Jason View Post
                    Hello Fierze,

                    Can you please perform the merge once more. Subsequently create a new chart for the instrument you merged and check if all data is present.

                    Could it be the previous attempts did load historical data from IB over the merged data? Please see the link below on how NinjaTrader loads historical data.
                    I tried again to merge the ES dec 09 contract (period 090911-091211) into the ES march 10 contract, but it failed even though a message said that the minute data was successfully merged. I use 5 min charts.

                    When I opened a new march 10 ES chart after the merge, I still did not see any dec 09 contract data. Instead there was only the original low liquidity trading data during the period sep-dec.

                    It would be very interesting to know why this does not work. As I said, I can see all the data in separate charts but not merge it toghether.

                    Comment


                      #11
                      Hi Fierze,

                      Thank you for your reply.

                      Please reload historical data for both contracts, then disconnect from your data provider and try the merge again. After completing the merge, please see if data for the entire range is present in the 03-10 chart.
                      KyleNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Kyle View Post
                        Hi Fierze,

                        Thank you for your reply.

                        Please reload historical data for both contracts, then disconnect from your data provider and try the merge again. After completing the merge, please see if data for the entire range is present in the 03-10 chart.

                        No, unfortunately I still don't see the merged data in the new march 10 contract, even though I disconnected from IB before merging. It is very strange, since the NT popup says that the merge is successful.

                        Any clues are welcome. It is a simple process and it seems that it would be hard to do it wrong...

                        Comment


                          #13
                          Hello Fierze,

                          Can you please try the following steps. Export all historical minute data from the previous expiry that you like to merge.


                          Subsequently rename the .txt file to the instrument name of the instrument you like to merge the historical data to.

                          Import the historical data as per the instructions at the following link.


                          Create a new chart and check if the merged data is displayed. Make sure to use session begin and end dates that will reflect the merged data.
                          JasonNinjaTrader Customer Service

                          Comment


                            #14
                            I think I found the problem. I see the successfully merged ES-chart looking exactly like intended when I first open Ninja Trader. But when I connect NT to my datafeed at Interactive Brokers, the ES 03-10-chart is automatically reloaded and this IB-reloaded chart does not include the merged data from ES 12-09.

                            So, I guess that if I want to see the merged chart (and backtest strategies on this chart) then I can not be connected to IB at the same time since the IB chart will overwrite my local merged chart. Or is there any way around this problem?

                            Comment


                              #15
                              Hi Fierze,

                              Thank you for your reply.

                              In the current version, you will need to continue to use this work-around.
                              KyleNinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by GussJ, 03-04-2020, 03:11 PM
                              16 responses
                              3,281 views
                              0 likes
                              Last Post Leafcutter  
                              Started by WHICKED, Today, 12:45 PM
                              2 responses
                              19 views
                              0 likes
                              Last Post WHICKED
                              by WHICKED
                               
                              Started by Tim-c, Today, 02:10 PM
                              1 response
                              9 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Taddypole, Today, 02:47 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post Taddypole  
                              Started by chbruno, 04-24-2024, 04:10 PM
                              4 responses
                              53 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Working...
                              X