NexusFi: Find Your Edge


Home Menu

 





How does the NT optimizer handle rollover dates?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one mgabriel01 with 2 posts (0 thanks)
    2. looks_two Fat Tails with 2 posts (7 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 aventeren with 1 posts (0 thanks)
    1. trending_up 2,045 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

How does the NT optimizer handle rollover dates?

  #1 (permalink)
 mgabriel01 
Raleigh, NC
 
Experience: Intermediate
Platform: NT
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 5 since Nov 2009
Thanks Given: 1
Thanks Received: 0

I'm puzzled by how NT 7 handles rollovers
Lets say I want to optimize my strategy using dates 3/1/2012 through 8/16/2012
This date range spans the ES0612 and ES0912 Contracts

So on June 6,7, 8, 9, 10, 11, 12, 13, and 14 -- Which contract does the strategy analyzer use to calculate results?
ES0612 or ES0912

Thanks in advance for your help

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Deepmoney LLM
Elite Quantitative GenAI/LLM
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Better Renko Gaps
The Elite Circle
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
 
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



mgabriel01 View Post
I'm puzzled by how NT 7 handles rollovers
Lets say I want to optimize my strategy using dates 3/1/2012 through 8/16/2012
This date range spans the ES0612 and ES0912 Contracts

So on June 6,7, 8, 9, 10, 11, 12, 13, and 14 -- Which contract does the strategy analyzer use to calculate results?
ES0612 or ES0912

Thanks in advance for your help

Rollover dates can falsify a backtest, if you enter a position prior to rollover and exit that trade after rollover. In real life you would have to exit the position which you had entered in the old front month and then reenter the position by entering a similar position in the new front month contract. NinjaTrader will not exit and reenter the position for you during a backtest. The accuracy of the backtest will depend on the data that you use.

Non-merge-backadjusted contracts: These are actually the underlying contracts that you trade. This is not artificially created data but it is all real data from the exchange. If the market is in contango (positive rollover offset), the backtest will show a windfall gain for a long position that you hold during rollover. You will not be able to realize this gain in real trading, as you have to roll your position and enter at a higher price than the price, at which you exited the position.

Merge-backadjusted contracts: The rollover gap is eliminated from the data and your backtest should show the correct result. The only thing the backtest will not take into account is the spread and the slippage that you paid, when rolling your position. Also the spread between the old and the new contract maybe slightly different than the offset (spread at the close prior to rollover day) used for backadjusting your data.

The merge-backadjusted contract is the only contract, which will not falsify backtests. The price that you pay for getting your trades listed correctly, is that the absolute prices shown for the prior contracts are false. For example, if you have an indicator, which uses round levels to identify support and resistance, it is obvious, that it would give you false resulsts on backadjusted data.

My recommendation is that merge-backadjusted data should be used, if you backtest over a period of 1 to 3 years, and if there is no specific reason not to use it. Over longer periods there may be better options.

If you do not like, you can also do your backtest on single month contract data and then manually correct the trades held during rollover. If you do not hold any trades over night, then you do not need any backadjustment either, as only the trades are affected that are active during the rollover of the position.

Reply With Quote
  #4 (permalink)
 mgabriel01 
Raleigh, NC
 
Experience: Intermediate
Platform: NT
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 5 since Nov 2009
Thanks Given: 1
Thanks Received: 0


Fat Tails View Post
Rollover dates can falsify a backtest, if you enter a position prior to rollover and exit that trade after rollover. In real life you would have to exit the position which you had entered in the old front month and then reenter the position by entering a similar position in the new front month contract. NinjaTrader will not exit and reenter the position for you during a backtest. The accuracy of the backtest will depend on the data that you use.

Non-merge-backadjusted contracts: These are actually the underlying contracts that you trade. This is not artificially created data but it is all real data from the exchange. If the market is in contango (positive rollover offset), the backtest will show a windfall gain for a long position that you hold during rollover. You will not be able to realize this gain in real trading, as you have to roll your position and enter at a higher price than the price, at which you exited the position.

Merge-backadjusted contracts: The rollover gap is eliminated from the data and your backtest should show the correct result. The only thing the backtest will not take into account is the spread and the slippage that you paid, when rolling your position. Also the spread between the old and the new contract maybe slightly different than the offset (spread at the close prior to rollover day) used for backadjusting your data.

The merge-backadjusted contract is the only contract, which will not falsify backtests. The price that you pay for getting your trades listed correctly, is that the absolute prices shown for the prior contracts are false. For example, if you have an indicator, which uses round levels to identify support and resistance, it is obvious, that it would give you false resulsts on backadjusted data.

My recommendation is that merge-backadjusted data should be used, if you backtest over a period of 1 to 3 years, and if there is no specific reason not to use it. Over longer periods there may be better options.

If you do not like, you can also do your backtest on single month contract data and then manually correct the trades held during rollover. If you do not hold any trades over night, then you do not need any backadjustment either, as only the trades are affected that are active during the rollover of the position.



Thank you sir. This is the clearest explanation I have see on this topic!

Started this thread Reply With Quote
  #5 (permalink)
 
aventeren's Avatar
 aventeren 
Bellingham, WA USA
 
Experience: Beginner
Platform: NT
Broker: Mirus (Broker), Continuum (Data), Dorman (Clearing)
Trading: Futures
Posts: 202 since Mar 2013
Thanks Given: 428
Thanks Received: 202


Fat Tails View Post
Rollover dates can falsify a backtest, if you enter a position prior to rollover and exit that trade after rollover. In real life you would have to exit the position which you had entered in the old front month and then reenter the position by entering a similar position in the new front month contract. NinjaTrader will not exit and reenter the position for you during a backtest. The accuracy of the backtest will depend on the data that you use.

Non-merge-backadjusted contracts: These are actually the underlying contracts that you trade. This is not artificially created data but it is all real data from the exchange. If the market is in contango (positive rollover offset), the backtest will show a windfall gain for a long position that you hold during rollover. You will not be able to realize this gain in real trading, as you have to roll your position and enter at a higher price than the price, at which you exited the position.

Merge-backadjusted contracts: The rollover gap is eliminated from the data and your backtest should show the correct result. The only thing the backtest will not take into account is the spread and the slippage that you paid, when rolling your position. Also the spread between the old and the new contract maybe slightly different than the offset (spread at the close prior to rollover day) used for backadjusting your data.

The merge-backadjusted contract is the only contract, which will not falsify backtests. The price that you pay for getting your trades listed correctly, is that the absolute prices shown for the prior contracts are false. For example, if you have an indicator, which uses round levels to identify support and resistance, it is obvious, that it would give you false resulsts on backadjusted data.

My recommendation is that merge-backadjusted data should be used, if you backtest over a period of 1 to 3 years, and if there is no specific reason not to use it. Over longer periods there may be better options.

If you do not like, you can also do your backtest on single month contract data and then manually correct the trades held during rollover. If you do not hold any trades over night, then you do not need any backadjustment either, as only the trades are affected that are active during the rollover of the position.

Fat Tails--

I have a question about how to backtest a continuous contract. I'm going to use the ES ##-## contract as an example.

Please assume that I have downloaded all of the available ES XX-XX specific contract data, and that I have imported the ES XX-XX contract into NT7 (i.e., ES 03-07), and I have also imported the ES XX-XX data into the ES ##-## contract by renaming the ES XX-XX contract file name to ES ##-##.txt and then importing into NT7 (i.e., changed ES 03-07.txt to ES ##-##.txt)--and after finishing the ES ##-## import changed the file name back to ES XX-XX (i.e., ES ##-##.txt to ES 03-07.txt). From my understanding, this is the recommended approach to creating a continuous contract (which I am open to critique!).

If one wanted to then run an optimized test period for purposes of then running a walk forward analysis after the initial test, do you know how does NT7's Strategy Analyzer's Optimizer treat this continuous contract data during rollover? How can we know that the optimized results are an accurate backtest?

Thanks for your help! I really appreciate it.

All best,

Aventeren

Reply With Quote
  #6 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102


aventeren View Post
Fat Tails--

I have a question about how to backtest a continuous contract. I'm going to use the ES ##-## contract as an example.

Please assume that I have downloaded all of the available ES XX-XX specific contract data, and that I have imported the ES XX-XX contract into NT7 (i.e., ES 03-07), and I have also imported the ES XX-XX data into the ES ##-## contract by renaming the ES XX-XX contract file name to ES ##-##.txt and then importing into NT7 (i.e., changed ES 03-07.txt to ES ##-##.txt)--and after finishing the ES ##-## import changed the file name back to ES XX-XX (i.e., ES ##-##.txt to ES 03-07.txt). From my understanding, this is the recommended approach to creating a continuous contract (which I am open to critique!).

If one wanted to then run an optimized test period for purposes of then running a walk forward analysis after the initial test, do you know how does NT7's Strategy Analyzer's Optimizer treat this continuous contract data during rollover? How can we know that the optimized results are an accurate backtest?

Thanks for your help! I really appreciate it.

All best,

Aventeren

ES ##-## is a continuous contract as supplied by your data provider. You have to contact your data provider to find out how it has been put together. I do not know whether it can be backtested.

I do not understand all that complicated stuff about renaming contracts from XX to ##. This does not make sense. There is nothing that should be renamed or tweaked.

If you want to do a backtest, please use single-month contracts and select the merge policy "MergeBackAdjusted". NinjaTrader will then build the data series from backadjusted contracts as needed for a backtest.

Reply With Quote
Thanked by:




Last Updated on February 17, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts