NexusFi: Find Your Edge


Home Menu

 





backtesting in NT


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one gparkis with 2 posts (0 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 MrYou with 1 posts (0 thanks)
    4. looks_4 rkm2011 with 1 posts (0 thanks)
    1. trending_up 5,199 views
    2. thumb_up 1 thanks given
    3. group 5 followers
    1. forum 8 posts
    2. attach_file 1 attachments




 
Search this Thread

backtesting in NT

  #1 (permalink)
 gparkis 
New York City, NY/USA
 
Experience: Intermediate
Platform: NT
Trading: 6E, ZN, CL
Posts: 121 since Dec 2010
Thanks Given: 3
Thanks Received: 74

I have purchased historical tick data to run in NT for some risk strategy building. I know that in MT4 one can back test on on tick data to get 99% for intra bar accuracy; can the same be said of NT when utilizing back testing on tick data?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
What broker to use for trading palladium futures
Commodities
 
  #2 (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,470 since Jun 2009
Thanks Given: 33,249
Thanks Received: 101,673

Yes, the capability is there to backtest on tick data.

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

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
  #3 (permalink)
 gparkis 
New York City, NY/USA
 
Experience: Intermediate
Platform: NT
Trading: 6E, ZN, CL
Posts: 121 since Dec 2010
Thanks Given: 3
Thanks Received: 74


will this need special script or is it just in how i load the tick data?

Started this thread Reply With Quote
  #4 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,714 since May 2010
Thanks Given: 203
Thanks Received: 2,686


gparkis View Post
I have purchased historical tick data to run in NT for some risk strategy building. I know that in MT4 one can back test on on tick data to get 99% for intra bar accuracy; can the same be said of NT when utilizing back testing on tick data?

I am not sure 100% what you are after but this reference sample might put you in the right direction Strategy: [AUTOLINK]Backtesting[/AUTOLINK] NinjaScript Strategies with an intrabar granularity - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum.

Follow me on Twitter Reply With Quote
  #5 (permalink)
 
MrYou's Avatar
 MrYou 
NC, USA
 
Experience: None
Platform: None Yet
Trading: Guitar
Posts: 403 since Jun 2011
Thanks Given: 618
Thanks Received: 196

As of today (NT v7) strategies can not be backtested intra-bar. Backtesting historical data can only be performed on the close of the bar. Backtesting historical data defaults to a "fixed" CalculateOnBarClose = true. OnMarketData or OnMarketDepth can not be used on historical data.

You can only use Market Replay to "backtest" against intra-bar, OnMarketData, or OnMarketDepth.

Also there are "intra-bar granularity" issues when backtesting multi-timeframe strategies.

Reply With Quote
  #6 (permalink)
 
GridKing's Avatar
 GridKing 
San Diego, CA USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 3,630 since May 2011
Thanks Given: 584
Thanks Received: 881

Would there be reasons why a strategy needs to be separated into two so that buy side and sell side have to be back tested separately?

What are some best practices so that there is no conflicts I guess ... Thanks

"Successful trading is one long journey, not a destination" Peter Borish Former Head of Research for Paul Tudor Jones speaking on conversations with John F. Carter
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #7 (permalink)
Antisyzygy
Denver, Colorado, USA
 
Posts: 36 since Aug 2011
Thanks Given: 6
Thanks Received: 17


MrYou View Post
As of today (NT v7) strategies can not be backtested intra-bar. Backtesting historical data can only be performed on the close of the bar. Backtesting historical data defaults to a "fixed" CalculateOnBarClose = true. OnMarketData or OnMarketDepth can not be used on historical data.

You can only use Market Replay to "backtest" against intra-bar, OnMarketData, or OnMarketDepth.

Also there are "intra-bar granularity" issues when backtesting multi-timeframe strategies.

The reference sample NinjaTrader provided above would work here. It's an example on adding a second series to the strategy that has tick resolution.

What issues have you run into?

Reply With Quote
  #8 (permalink)
 rkm2011 
San Francisco, CA
 
Experience: Advanced
Platform: NinjaTrader, Tradestation
Trading: ES
Posts: 2 since Sep 2012
Thanks Given: 8
Thanks Received: 0

Hi Antisyzygy,
I've been trying to get the following issue addressed in NT forum but no luck.
I have looked at their reference code and all the docs.

I appreciate if you could shed some light.

Unexpected behavior of OnOrderUpdate() calls with Intrabar data

Although I am using Intrabar data (1Min), the OnOrderUpdate() was always called on the main time frame (60Min)

Here are the specifics:
Instrument: ES ##-##
Main Time Frame = 60 Min
Secondary Time Frame = 1 Min
Bar in question was on 11/16/2012 at 11:30 AM
The Buy order was filled at 1350.75 at time 11:30AM
The Profit target was filled at 1354.75 at time 11:30AM
Looking at the 1Min Chart, I see that the 1354.75 level was not touched until 12:16PM

So, it looks like the OnOrderUpdate() is called only on the 60Min time frame. I expect
OnOrderUpdate() to be called around time 12:16PM based on the 1Min data.

I printed 'Time[0]' at the beginning of OnOrderUpdate(). Here are the fills of the Buy and the Profit Target:
OnOrderUpdate Time: 11/16/2012 11:30:00 AM
IOrder Order='NT-00081/Sim101' Name='Buy' State=Filled Instrument='ES ##-##' Action=Buy Limit price=0 Stop price=0 Quantity=1 Strategy='RKMTest' Type=Market Tif=Gtc Oco='' Filled=1 Fill price\
=1350.75 Token='27ebb46b1e1f48589cfab756b19f1d66' Gtd='12/1/2099 12:00:00 AM'

OnOrderUpdate Time: 11/16/2012 11:30:00 AM
IOrder Order='NT-00083/Sim101' Name='Profit target' State=Filled Instrument='ES ##-##' Action=Sell Limit price=1354.75 Stop price=0 Quantity=1 Strategy='RKMTest' Type=Limit Tif=Gtc Oco='NT-00\
050-4323' Filled=1 Fill price=1354.75 Token='8ce78dd643fc489093af083bda429056' Gtd='12/1/2099 12:00:00 AM'

The Code for the strategy is attached.

Attached Files
Elite Membership required to download: RKMTest.cs
Reply With Quote
  #9 (permalink)
 little leo 
Sydney
 
Experience: Advanced
Platform: NinjaTrader
Trading: Forex
Posts: 63 since Nov 2015
Thanks Given: 31
Thanks Received: 40


rkm2011 View Post
Hi Antisyzygy,
I've been trying to get the following issue addressed in NT forum but no luck.
I have looked at their reference code and all the docs.

I appreciate if you could shed some light.

Unexpected behavior of OnOrderUpdate() calls with Intrabar data

Although I am using Intrabar data (1Min), the OnOrderUpdate() was always called on the main time frame (60Min)

Here are the specifics:
Instrument: ES ##-##
Main Time Frame = 60 Min
Secondary Time Frame = 1 Min
Bar in question was on 11/16/2012 at 11:30 AM
The Buy order was filled at 1350.75 at time 11:30AM
The Profit target was filled at 1354.75 at time 11:30AM
Looking at the 1Min Chart, I see that the 1354.75 level was not touched until 12:16PM

So, it looks like the OnOrderUpdate() is called only on the 60Min time frame. I expect
OnOrderUpdate() to be called around time 12:16PM based on the 1Min data.

I printed 'Time[0]' at the beginning of OnOrderUpdate(). Here are the fills of the Buy and the Profit Target:
OnOrderUpdate Time: 11/16/2012 11:30:00 AM
IOrder Order='NT-00081/Sim101' Name='Buy' State=Filled Instrument='ES ##-##' Action=Buy Limit price=0 Stop price=0 Quantity=1 Strategy='RKMTest' Type=Market Tif=Gtc Oco='' Filled=1 Fill price\
=1350.75 Token='27ebb46b1e1f48589cfab756b19f1d66' Gtd='12/1/2099 12:00:00 AM'

OnOrderUpdate Time: 11/16/2012 11:30:00 AM
IOrder Order='NT-00083/Sim101' Name='Profit target' State=Filled Instrument='ES ##-##' Action=Sell Limit price=1354.75 Stop price=0 Quantity=1 Strategy='RKMTest' Type=Limit Tif=Gtc Oco='NT-00\
050-4323' Filled=1 Fill price=1354.75 Token='8ce78dd643fc489093af083bda429056' Gtd='12/1/2099 12:00:00 AM'

The Code for the strategy is attached.

Did you end up finding a solution for this? I have exactly the same problem

Impossible fill happening on the same bar for EnterLongLimit - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

Reply With Quote




Last Updated on March 20, 2016


© 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