NexusFi: Find Your Edge


Home Menu

 





Trouble with LIVE v. BACKTEST


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one patbateman with 9 posts (0 thanks)
    2. looks_two Fat Tails with 3 posts (4 thanks)
    3. looks_3 TimeTrade with 3 posts (2 thanks)
    4. looks_4 ThatManFromTexas with 2 posts (1 thanks)
      Best Posters
    1. looks_one Big Mike with 2 thanks per post
    2. looks_two Fat Tails with 1.3 thanks per post
    3. looks_3 TimeTrade with 0.7 thanks per post
    4. looks_4 ThatManFromTexas with 0.5 thanks per post
    1. trending_up 8,729 views
    2. thumb_up 10 thanks given
    3. group 5 followers
    1. forum 18 posts
    2. attach_file 9 attachments




 
Search this Thread

Trouble with LIVE v. BACKTEST

  #1 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

Hello all,

I put a new system of mine (60 minute chart, non intraday) through market replay after testing it via strategy analyzer, and had differing results.

I undertand this is not uncommon with Ninjatrader crapware, however generally backtesting minute bars with 1 tick of slippage is accurate enough.

What is really confusing is that the results of replay (live) versus backtesting are the same, minus the number of trades. The profit and consistency rates are the same, however the live trading is generating fewer trades. In fact, the live trading's overall results are better; generally it's the other way around

I'll go back to the charts and analyze each individual trades, but I was wondering if anyone has any thoughts. Here are some points on what I'm doing:
  • Using non-blackboxed Jurik tools (i.e. 100% ninjascript indicators) from jurikres.com - I've used them before in backtest versus live with no trouble
  • 60 minute bars, exit on close = false
  • Trading the ES
  • Uses a leading indicator (made this week)
  • Completely independent from other platforms, i.e. matlab is not connected

As a final bit, I only optimized three coefficients/inputs. All but three of the combinations had positive results... very confident that the system works. I'm going to investigate if there is a discrepancy between my Ninjascript in backtest versus live. If NT developers ask for the system... the answer is no, and you'd probably blame me anyways if I did.


Does anyone know of alternative software platforms that will run C# (NOT easylanguage) with similar functionality as NT? I've heard Xtrader and T4 are pretty popular... I got into NT because of recommendations and liked the up sides of it very much, at least at the time.

"A Jedi's strength flows from the force."
-Yoda
Attached Thumbnails
Click image for larger version

Name:	MARKET REPLAY.jpg
Views:	319
Size:	258.0 KB
ID:	71748   Click image for larger version

Name:	BACKTEST.jpg
Views:	296
Size:	319.1 KB
ID:	71749  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Cheap historycal L1 data for stocks
Stocks and ETFs
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
 
  #2 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

Here's what I'm going to do in the next hour to try and solve this...
  1. Retest the market replay and see if I get differing results
  2. Analyze the market replay's indicator output versus static versus backtest output
  3. Compare if the trades in market replay are at the same times as backtest
  4. Try another system, even more basic, even though I'm certain my algos are NOT the problem
  5. Compare my minute data (paid for) to market replay (from NT7) - Market replay has worked well for me in the past with live versus replay.
  6. Any other ideas?






"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #3 (permalink)
 TimeTrade 
Erfurt Germany
 
Experience: Master
Platform: rtMagic, NinjaTrader
Broker: AMP/CQG, IAB
Trading: ES, 6E, FDAX, FGBL
Posts: 338 since Aug 2011
Thanks Given: 54
Thanks Received: 461



patbateman View Post
Hello all,

I put a new system of mine (60 minute chart, non intraday) through market replay after testing it via strategy analyzer, and had differing results.

I undertand this is not uncommon with Ninjatrader crapware, however generally backtesting minute bars with 1 tick of slippage is accurate enough.

What is really confusing is that the results of replay (live) versus backtesting are the same, minus the number of trades. The profit and consistency rates are the same, however the live trading is generating fewer trades. In fact, the live trading's overall results are better; generally it's the other way around

I'll go back to the charts and analyze each individual trades, but I was wondering if anyone has any thoughts. Here are some points on what I'm doing:
  • Using non-blackboxed Jurik tools (i.e. 100% ninjascript indicators) from jurikres.com - I've used them before in backtest versus live with no trouble
  • 60 minute bars, exit on close = false
  • Trading the ES
  • Uses a leading indicator (made this week)
  • Completely independent from other platforms, i.e. matlab is not connected

As a final bit, I only optimized three coefficients/inputs. All but three of the combinations had positive results... very confident that the system works. I'm going to investigate if there is a discrepancy between my Ninjascript in backtest versus live. If NT developers ask for the system... the answer is no, and you'd probably blame me anyways if I did.


Does anyone know of alternative software platforms that will run C# (NOT easylanguage) with similar functionality as NT? I've heard Xtrader, T4 and TT are pretty popular... I got into NT because of recommendations and liked the up sides of it very much, at least at the time.

please say your used ordertypes... Without self coding, NT7 don't can backtest stop&limit orders with correct intrabar fills.

Your without more own coding, please use only marketorders and CalcBarOnClose=TRUE
-> market entry orders now filled "OnOpen"
-> please write little own code for your exit conditions and use "CloseMarket" (also filled on next Open)

With this simple OrderLogic, Backtest and Replay run nearly equal. The last difference: Replay use only TickData files from NinjaServer, BackTest use the from real DataProvider requested data's. If time bars greater than 1min used, then NT7 dont used tick data for backtest.

For the next month i hope to publish my (tickbased) history solution for the LOM project. This well realize a accurat Fill incl. IntraBar Exit/ReEntry for the BackTest mode. The concept is simple current you deglare myStrategy:Strategy, then you change only this to myStrategy:LOMtickStrategy.

Your current problem can base on NinjaServer ReplayTicks <-> MinData of your DataProvider or your strategy use OrderTypes with needed correct Intrabar handling of Hi/Lo sequence and/or IntrabarExit/ReEntry or you use partial scale In/Out.

Reply With Quote
  #4 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200


TimeTrade View Post
please say your used ordertypes... Without self coding, NT7 don't can backtest stop&limit orders with correct intrabar fills.

Your without more own coding, please use only marketorders and CalcBarOnClose=TRUE
-> market entry orders now filled "OnOpen"
-> please write little own code for your exit conditions and use "CloseMarket" (also filled on next Open)

With this simple OrderLogic, Backtest and Replay run nearly equal. The last difference: Replay use only TickData files from NinjaServer, BackTest use the from real DataProvider requested data's. If time bars greater than 1min used, then NT7 dont used tick data for backtest.

For the next month i hope to publish my (tickbased) history solution for the LOM project. This well realize a accurat Fill incl. IntraBar Exit/ReEntry for the BackTest mode. The concept is simple current you deglare myStrategy:Strategy, then you change only this to myStrategy:LOMtickStrategy.

Your current problem can base on NinjaServer ReplayTicks <-> MinData of your DataProvider or your strategy use OrderTypes with needed correct Intrabar handling of Hi/Lo sequence and/or IntrabarExit/ReEntry or you use partial scale In/Out.

Okay. A little confused by what you said frankly, however in backtesting I ran market orders only, and in live I ran limit AND market orders. Both generated similar results (live).

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #5 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

Update... my algo is showing different values. Attached is a screen shot of backtest versus replay output for the same time period. Combined with the information that both scenarios are producing similar performance results, I'm going to look at how far the system examines past data. I already tried this once by setting the look back period for my replay data at 6 days, which should be plenty for the maximum period in my system.

Anyone run into a similar problem? Any ideas? Is JMA in fact not backtestable, despite possible similarities in the past?

"A Jedi's strength flows from the force."
-Yoda
Attached Thumbnails
Click image for larger version

Name:	replaychart.jpg
Views:	260
Size:	200.2 KB
ID:	71751   Click image for larger version

Name:	backtestchart.jpg
Views:	270
Size:	164.7 KB
ID:	71752  
Started this thread Reply With Quote
  #6 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

When I adjust the "min bars required" field in strat analyzer, the results vary hugely. They all have similar performance data, however the trades are very different. I suppose I should of picked up on this for a leading indicator. There appears to be no correlation between the look back period and number of trades. It also appears that the lookback period in back testing does NOT produce similar results when the same lookback period is set in market replay.

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #7 (permalink)
 
Lornz's Avatar
 Lornz 
Oslo, Norway
 
Experience: Advanced
Platform: CQG, Excel
Trading: CL
Posts: 1,193 since Apr 2010


patbateman View Post

Does anyone know of alternative software platforms that will run C# (NOT easylanguage) with similar functionality as NT? I've heard Xtrader and T4 are pretty popular... I got into NT because of recommendations and liked the up sides of it very much, at least at the time.

Automated Trading Strategies Development Platform

Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
patbateman's Avatar
 patbateman 
NY, NY
 
Experience: None
Platform: T4, NinjaTrader
Trading: All!
Posts: 235 since Mar 2012
Thanks Given: 113
Thanks Received: 200

To make things even more amazingly confusing, here is what happened...

I ran the system on a different contract, this time the Dow (YM). The backtest and the replay are 99.999% identical.

I don't know what to make of this, other than there is something in fact going on with the ES contract in replay or backtest. I'll have to investigate tomorrow, it's bedtime now. The NT team probably thinks I'm making this all up to sabotage them... I'm not!

Thank you lornz!

"A Jedi's strength flows from the force."
-Yoda
Started this thread Reply With Quote
  #9 (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,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661

Anytime you are using non-tick bars (like 60 minute bars), you need to be aware of how NinjaTrader processes orders. It knows only the OHLC of the bar, and it does not know the order of those. Did the L happen before the H, or vice versa? It does not know when you use non-tick data.

From memory, it assumes the best. Unfortunately. This means if you have a 1 tick stop and a 20 tick target, if the H of the bar has exceeded your target, it will count as a winner, even if the L of the bar has exceeded your stop.

The easiest way to see how this effects you is to look at the individual list of trades from the backtest report. Sort by number of bars in trade. All trades that show '1 bar' should be swapped from winners to losers. You can do this by exporting to Excel pretty easily.

The other option is to add a secondary dataseries to your strategy, of 1-range. Then send all orders to the secondary series, so it has a 1-range (1-tick) accuracy.

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
Thanked by:
  #10 (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,103



patbateman View Post
Update... my algo is showing different values. Attached is a screen shot of backtest versus replay output for the same time period. Combined with the information that both scenarios are producing similar performance results, I'm going to look at how far the system examines past data. I already tried this once by setting the look back period for my replay data at 6 days, which should be plenty for the maximum period in my system.

Anyone run into a similar problem? Any ideas? Is JMA in fact not backtestable, despite possible similarities in the past?

If I see the different results between the replay and backtest, there are two possible explanations

-> either you used two different strategies
-> or your strategy as coded is flawed

If your strategy is coded correctly, you will never see differences as between the two charts above.


The only differences you will see are

-> data related, replay data is built from many ticks, historical data is single tick data
-> fill related, the backtest will usually enter at the open of the next bar

If you want to do proper backtesting with intra-bar fills, you need to add a one-tick series to the strategy for you backtest.

Reply With Quote
Thanked by:




Last Updated on April 30, 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