NexusFi: Find Your Edge


Home Menu

 





Backtest not matching Optimization


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one d1g1talfr3ak with 3 posts (0 thanks)
    2. looks_two Big Mike with 2 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 citizen1024 with 1 posts (0 thanks)
    1. trending_up 2,320 views
    2. thumb_up 0 thanks given
    3. group 7 followers
    1. forum 9 posts
    2. attach_file 0 attachments




 
Search this Thread

Backtest not matching Optimization

  #1 (permalink)
 
d1g1talfr3ak's Avatar
 d1g1talfr3ak 
Huntsville AL/USA
 
Experience: Beginner
Platform: NinjaTrader
Trading: Stocks, Futures
Posts: 24 since Nov 2011
Thanks Given: 31
Thanks Received: 46

in the past when I develop a strategy I first run the optimizer on a range of historical data to find best settings for parameters. Then I enter the settings the optimizer found as best and run backtest on same time period with same settings and ensure that I do get the value returned by the optimizer (sort of a sanity check on making sure I have settings entered correctly) then I run backtests on out of sample time periods. Only after that do I move on to sim trading.

I have a strategy now though, that when I optimize and get some results and settings, and enter those settings to do backtest... it does not match the results the optimizer claimed to have gotten with the same settings. I have meticulously checked every setting and they are set the same on backtest as on best run from optimizer. The results aren't even close.

Any ideas?

Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
35 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Spoo-nalysis ES e-mini futures S&P 500
14 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,214
Thanks Received: 101,599


Are you using exotic bar types?

Are you using genetic optimizer or exhaustive? If genetic, using the NT one or third party?

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
d1g1talfr3ak's Avatar
 d1g1talfr3ak 
Huntsville AL/USA
 
Experience: Beginner
Platform: NinjaTrader
Trading: Stocks, Futures
Posts: 24 since Nov 2011
Thanks Given: 31
Thanks Received: 46

I am using the Ninjatrader built-in genetic optimizer. I would have thought that each step of the genetic algorithm it would internally run a backtest with selected values... then score value and run genetic routine to choose next generation of parameters. So I am stumped as to why running a backtest with the same settings the optimizer found doesn't match the results it showed. I have verified and re-verified that all settings are the same... including slippage & commisions, etc.

I can optimize other strats and then backtest on same time period with same values and get the same results. At first I thought that it was because this strat used an indicator that repainted past values. I tried telling the backtester and optimizer to not run multithreaded and a few other ideas... no go. I then wrote my own version of the indicator that did not repaint past values and still the same thing.

Thanks for any ideas and help

Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
 
d1g1talfr3ak's Avatar
 d1g1talfr3ak 
Huntsville AL/USA
 
Experience: Beginner
Platform: NinjaTrader
Trading: Stocks, Futures
Posts: 24 since Nov 2011
Thanks Given: 31
Thanks Received: 46

Also... I am using Better Renko. I am using it on several other strategies and not having the same issue.

Follow me on Twitter Started this thread Reply With Quote
  #6 (permalink)
 dynoweb 
McKinney, TX
 
Experience: Intermediate
Platform: ThinkOrSwim, NinjaTrader
Broker: TD Ameritrade (soon to be Schwab) & NinjaTrader
Trading: The indexes, ES, YM, NQ & RTY
Posts: 171 since Aug 2012
Thanks Given: 216
Thanks Received: 157

I had problems using Ranko bars. I had a tested strategy that was giving me very good results, then I ran that strategy against live data on the sim account and got a totally different return.

I don't know for sure, but what I think happens is that the Renko bar historical data is truncated so that the bar high/low values are used for the optimization. When running live, it appears that there are ticks outside of the Renko bars, those wide range ticks were hitting my stop loss and changing the results. What I would see is the execution of orders outside of the Renko bar.

Not sure if that is your problem, but when I tried the same strategy with Range bars, I couldn't duplicate the great results in the Analyzer but they matched the results better when I had a live data feed. Because of this, I won't use Renko bars on a strategy.

Follow me on Twitter Reply With Quote
  #7 (permalink)
 NetTecture 
Szczecin
 
Experience: Intermediate
Platform: Ninja, writing own now
Posts: 211 since Mar 2010

Yes. Ninja does not use any data outside the bars, so you need bars that show true high low or better anther bar in the strat (tick 1) and then issue trades against this one.

Reply With Quote
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,440 since Jun 2009
Thanks Given: 33,214
Thanks Received: 101,599

Renko bars and other exotic bar types have false opens, which makes backtesting them totally false.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
 citizen1024 
Miami FL, USA
 
Experience: Beginner
Platform: NinjaTrader
Trading: Forex
Posts: 1 since Apr 2012
Thanks Given: 5
Thanks Received: 0

I have also had similar experiences with the NinjaTrader built in Genetic Optimizer. In my case, I used a plain old 5 minute chart, ran the optimizer, then backtested the winner and received wildly different results.

Upon inspecting the actual trades in the NinjaTrader Strategy Analyzer, it looks as if the optimizer wasn't using all of the price data available. What I mean is that if the strategy had a rule to close a position on a MA crossover, the optimized strategy did not close the position whereas the backtested strategy (with identical settings) did close the position on the crossover.

Reply With Quote
  #10 (permalink)
 grimReaper 
Los Angeles, CA
 
Posts: 50 since Nov 2011



dynoweb View Post
I had problems using Ranko bars. I had a tested strategy that was giving me very good results, then I ran that strategy against live data on the sim account and got a totally different return.

Perhaps overfitting?

Reply With Quote




Last Updated on November 11, 2012


© 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