Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Strategy Testing period that spans expiration has me confused

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

    Strategy Testing period that spans expiration has me confused

    Hello.

    I thought that I understood "Merge Back Adjusted" but the data doesn't work like I'd expect and I didn't realize it or it isn't now.

    #1. I have the Global Merge Policy set to Merge Back Adjusted as per https://ninjatrader.com/support/help...marketdata.htm

    #2. All instruments in question are set to "Use Global Settings" in the Merge Policy.

    #3. I'm back-testing or optimizing a strategy where the instrument, CL (future), spans 2 expirations.

    #4. I can look at create 2 charts to view CL 08-21 and CL 09-21;
    NOTE: CL 08-21 ends on 07/20/2021, both for minute and tick data.
    NOTE: CL 09-21 has a price jump on 07/19/2021 at the end of the day

    #5. I can view the historical data and it is the same as the chart, both for minute and tick data.

    ------

    Question #1. Which instrument should I test my strategy with, CL 08-21 or CL 09-21 when I'm trying to check the range between 07/14/2021 and 08/04/2021?

    NOTE: the expiration of CL 08-21 is at EOD on 7/19.

    Question #2. I'm seeing different results for the same period with different instruments.
    • No trades for CL 08-21 from 7/20 on.
    • Different trades from 7/14 to 7/20 using CL 09-21. [Different trades in the overlapping period.]
    So, this leads me to believe that they are using different data?

    Isn't "Merge Back Adjusted" supposed to fix this?

    Question #3. Could I have screwed up my data?

    I have gone to the file system and manually removed these 2 data sets then manually reloaded them (and verified with chart + historical data) but the results still appear.

    NOTE: nothing to merge in Tools / Database Management.

    If I did screw it up? How to fix other than what I did?



    #2
    Hi ntdev, thanks for writing in.

    #1: You can use the Merge back adjusted merge policy setting, and use the most current instrument contract. The merge policy will handle which contracts go where in the historical data and merge contracts together. This prevents us from having to worry about "if I test this time frame, which contract do I need to use?" because all of the needed contracts will be joined.

    #2: Same script + Same Settings + Same Data will = Same results. If you are testing the same strategy with same parameters and getting different results, the data being processed is calculating either fewer or more signals. You can confirm this by looking at the Trades view of the Strategy Analyzer and noting which backtest has more/less trades. Also try different merge policies for the backtest and compare and contrast the results from each different merge policy.

    #3: If the data was removed, then requested again, it is not corrupted in any way. If you want to make absolutely sure you have data that is fresh, rename the db folder within Documents\NinjaTrader 8 to "dbOLD" to generate a new database file.

    Kind regards,
    -ChrisL

    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chris for the quick answer.

      #1. Yes, I'm using Merge Back Adjusted.

      #2. Yes, "Same script + Same Settings + Same Data will = Same results" but If I run the same script w/ a different period of the indicator then I'd expect for M.B.A. to handle it but it does not.

      Click image for larger version

Name:	2021-08-05_22-45-14.jpg
Views:	24
Size:	347.6 KB
ID:	1166653

      Q: Why isn't CL 09-21 not using merge back adjusted to make this the same data?

      One thing to note is that I am not logged in here -- this is my dev machine and my production machine is trading so I can't log it out and have a live connection but my recollection is that this does not change the situation.

      3. I did get a fresh copy of all the data.

      NOTE: I did log in to download all the data.


      What else can you point me to look at?

      Comment


        #4
        As you can see, totally different trades for the same period.

        Click image for larger version

Name:	2021-08-05_22-59-00.jpg
Views:	20
Size:	128.4 KB
ID:	1166656

        Comment


          #5
          Hi, thanks for your reply.

          If you look at the Chart view of CL 08-21 you can see after the date of rollover the volume is much lower. When you test on the CL 09-21 it's using merge back adjusted to combine CL 08 and CL 09. Ultimately the data set being tested is very different if you trade the contract past expiry vs using merge back adjusted.

          Kind regards,
          -ChrisL
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            Thanks Chris. Sorry, long day and I'm a little slow.

            I thought that I am using "MergeBackAdjusted" because it's set globally and not overridden for the instrument.

            Question: Is there a 3rd place that I need to specify that I want the MergeBackAdjusted fields?

            I have exactly the data that I expect... CL 08-21 stops on July 20 and CL 09-21 starts on July 20 but then how can I have the different results from above when it should be using the same data?

            Click image for larger version

Name:	2021-08-06_00-51-32.jpg
Views:	27
Size:	15.0 KB
ID:	1166667Click image for larger version

Name:	2021-08-06_00-50-07.jpg
Views:	22
Size:	14.8 KB
ID:	1166668

            Could it be because I'm not connected to CQG?

            Do I need to restart NT after loading this data?

            Effectively what I'm seeing in the first test case above is that using CL 09-21 does actually use data from CL 08-21 because the CL 09-21 data doesn't cover these dates.

            Maybe the trades are different because MergeBackAdjusted alters the prices and that affected my algo? [THIS actually could affect my algorithm for future trades because I'm analyzing price ranges from the past for future trades -- but if everything is adjusted the same and the period is the same then I don't have an answer for what I'm seeing.]

            The one consistent thing is that keeping with CL 09-21 and extending the test date "to" date until Aug. 4 does in fact have the same trades from the 14th to the 19th.

            Comment


              #7
              Hi ntdev,

              It's not using the same data. Please look at the Chart view of the strategy analyzer to confirm the low volume on CL 08. Its not enough to only look at the summary results. If you run the strategy on CL 09 on the same time frame, it will use merge back adjusted to combine CL 08 and CL 09 to make the data continuous. The only place to set the merge policy is through the Options menu.

              Kind regards.
              Chris L.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by agraham, Today, 01:05 PM
              0 responses
              23 views
              0 likes
              Last Post agraham
              by agraham
               
              Started by jagswe, Today, 01:34 PM
              0 responses
              13 views
              0 likes
              Last Post jagswe
              by jagswe
               
              Started by PaulMohn, Yesterday, 05:25 AM
              9 responses
              34 views
              0 likes
              Last Post NinjaTrader_PaulH  
              Started by srbdoc, Today, 12:20 PM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_ChristopherJ  
              Started by blar58, Today, 12:19 PM
              1 response
              19 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Working...
              X