Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Calendar Spread Backtesting

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

    Calendar Spread Backtesting

    Hi there,

    I am trying to build a calendar spread backtester for grains. When I print the close of each bar, I get the same price for each future. For example, the current front contract for CBOT Wheat is "ZW 09-20" and the next future is "ZW 12-20". When I print the close of historical bars in the Output window during a backtester, the output of the two symbols is the same. (I set up Sep as the main Strategy Analyzer instrument and Dec as the added instrument in the file.)

    Can someone recommend a way to build a backtester that allows me to look at the both the front wheat contract and the one-back wheat contract throughout a historical window for backtesting purposes?

    Thank you,
    Tim



    #2
    Hello ozziyhtomit,

    Thanks for your post.

    This sounds like your data series are getting merged. Do you see the same behavior when you set Merge Policy to Do Not Merge?

    (Control Center > Tools > Options > Market Data > Merge Policy)



    I look forward to your reply.

    Comment


      #3
      Hey Jim

      Yes they now match the actual current market prices. Thanks!

      Just to confirm: If I use 'Do Not Merge', the backtester will allow me to differentiate bw front and one-back futures in a strategy file. However, will NT roll both contracts in the backtester? In the Jan of 2020 part of the backtesting, will the front be the Mar 2020 and the one-back be the May 2020?

      My goal is to backtest an idea over the past few years studying the relationship bw the front and one-back future for each time interval in the backtester. This is not the same as wanting to backtest what the "ZW 09-20" and "ZW 12-20" contracts did over the past 24 months.

      Thanks!


      Comment


        #4
        Hello ozziyhtomit,

        Do Not Merge will prevent previous contract periods from being merged with the next contract period. In January 2020, each data series will be of the trades for that individual instrument/expiry at that time.

        To accomplish your goal you may want to consider the following:

        1. Use Do Not Merge so each data series only contains the trades from their contract period
        2. Add additional data series to your script for each contract period you want to study over that interval
        3. Throughout your strategy logic, use time checks to switch between which front contract period and previous contract period you want to analyze.

        More information on adding multiple data series and working with Multi Time Frame strategies can be found below.



        We look forward to assisting.

        Comment


          #5
          Thanks Jim

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          50 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X