NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Strategy Analyzer

Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer.

Reply
 
Thread Tools Display Modes
Old 07-20-2012, 08:57 AM   #1
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default TradeStation vs. NinjaTrader backtesting discrepancy

Hi,

I started testing trading strategies on NinjaTrader vs. TradeStation. For parallel comparison, I imported Historical Data from TradeStation.

So, what I've found is that there are cases where trade signal Triggered on TradeStation but not triggered on NT. One of the reason I have confirmed is that on TradeStation, the backtesting assumes you can double entry in the same bar, e.g: when signal reverses TS proceeds as first cover the previous Long/Short and then reverse Short/Long.

In NT, it doesnt allow signal reversing inside same bar. for the above case, when signal reverses, it would cover position in this bar, and enter a reverse buy/sell on next bar.

I am not sure which one is more realistic.

However, there is another big discrepancy in indicator value calculating and Bar constructing.

So, assume that I have perfectly copy my strategies from EasyLaguage to C#. I would say it is 100% correct, as I tested some of the strategies on both platform and generated say 95% similar results. Plus I re-assured the trade being executed are all match-up.

The problem is, okay all the trades are signal based, when the indicators are plotted correctly, the trades are correct trades. However, I happened to do some due diligence, and found out that there are 5% of chance that some indicators plotted on TS are different than that on NT, sometimes its slighlty different, sometimes its BIG.

I understand this feels like an inevitable issue as these are two different platforms, but I just want to know if this is what cannot be resolved. Also, NT has really fast optimization speed, and given that we are able to optimize a lot of parameters, which could be a double sword. (overfitting)...

Sorry it is a long thread, there should be an explanation from NT, or even TS. Its about reliability, and consistency. I love NT, more than TS, but when you see something performed great on NT but moderate on TS, you start to be skeptical.

Thanks,
Steve
ell2230 is offline  
Reply With Quote
Old 07-20-2012, 09:12 AM   #2
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Hello Steve,

Please review the information in the following link which explains why there can be discrepancies in back testing:

http://www.ninjatrader.com/support/h...ime_vs_bac.htm

If you're looking for Intrabar granularity in your backtesting, this can be done by adding a lower time frame to your script:

http://www.ninjatrader.com/support/f...ead.php?t=6652

Regarding the different indicator values, can you verify the start/end time for the bars you're using in NT vs TS? It could be that you are using a session template in NinjaTrader that is looking at a different start/end period than you seeing your TS charts.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-20-2012, 09:40 AM   #3
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

Thanks for the quick response and references.

Yea, the time sessions seem to be the problem. Even tho charts are almost the same but the time stamp is completely different, What do you mean the time session template? How do I synchornize them?

Should I used instrument default in the template setting?

im testing on FX futures btw
Last edited by ell2230; 07-20-2012 at 09:44 AM.
ell2230 is offline  
Reply With Quote
Old 07-20-2012, 10:16 AM   #4
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Hello,

The session template is set by right clicking on the chart--> select "Data Series"--> session template

You will also have this option when backtesting, or starting a strategy.

You can verify the session times under Tools--> Session Manager

More information using the Session Manager and Session Templates:

http://www.ninjatrader.com/support/h...on_manager.htm

Please also review our Help Guide article on 'How Bars are Built':

http://www.ninjatrader.com/support/h..._are_built.htm
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-24-2012, 07:13 AM   #5
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Matthew View Post
Hello,

The session template is set by right clicking on the chart--> select "Data Series"--> session template

You will also have this option when backtesting, or starting a strategy.

You can verify the session times under Tools--> Session Manager

More information using the Session Manager and Session Templates:

http://www.ninjatrader.com/support/h...on_manager.htm

Please also review our Help Guide article on 'How Bars are Built':

http://www.ninjatrader.com/support/h..._are_built.htm


I read all the references and could not solve the problem I have.

I did some investigation, finding that the time stamp on Ninjatrader lagged by 5 hours. So as of the time 7:35am on TradeStation which is the correct time, it shows 2:35 on NT.

I am testing on Canadian dollar, I tried both default template and CME FX Future ETH template. Neither work correctly.
ell2230 is offline  
Reply With Quote
Old 07-24-2012, 07:19 AM   #6
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

What time zone are you located in? What time zone is your local PC clock set to? What operating system are you using?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-24-2012, 07:32 AM   #7
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

Im in Chicago so, Central Time Zone,my local machine is set to Central Time GMT-6:00. OS: Windows XP
ell2230 is offline  
Reply With Quote
Old 07-24-2012, 07:37 AM   #8
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Hello,

I see - NinjaTrader will always time stamp your bars based on your local PC clock, however if this data was imported from TradeStation, there may be an issue with how the data was imported.

When you exported the data from TradeStation, did you have the Display: Time Zone setting set to Local time, or another?

When importing in NinjaTrader, did you have "Time Zone of Imported Data" set to UTC as per default, or did you set it to the same settings you used when exported from TradeStation?
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-24-2012, 07:43 AM   #9
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

I did not modify any time settings when both importing and exporting data between TS and NT, that means all by default.

I clearly remember what I did was:
1) load the 1min Chart on TS (correct time stamp) ;
2) insert NTDataDownload Strategy
3) Import the txt file on NT, with UTC left as default

Should I change any time settings? how?
ell2230 is offline  
Reply With Quote
Old 07-24-2012, 07:46 AM   #10
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Hello,

By default, TS will export as local time, however our default settings are UTC.

To correct this, you will need to delete your historical data in NinjaTrader and reimport making sure to set the Time Zone in the Historical Data Manager/Import tab to use the same time zone that TradeStation is using.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-24-2012, 07:58 AM   #11
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

Thanks. That seems to work. I am trying to redo everything.

Just a quick question regarding backtesting vs. TradeStation. In TS, we have this check box to make sure limit order gets triggered on when price is traded through. Also, intra bar double entries could happen on TS. I wonder if this is the case on NT? I am more care about "Trade Through" setting on NT, I heard that the default fill type is similar to "Trade Through"? right?
ell2230 is offline  
Reply With Quote
Old 07-24-2012, 08:01 AM   #12
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Correct - Default fill type will only fill if the price was penetrated.

Liberal would fill if the price was touched.
NinjaTrader_Matthew is offline  
Reply With Quote
Old 07-24-2012, 08:07 AM   #13
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

What if we have Profit Target and Stop loss would happen all the in the same bar. Would NT stop it out first or take profit first? suppose we have a very small target?
ell2230 is offline  
Reply With Quote
Old 07-24-2012, 08:22 AM   #14
NinjaTrader_Matthew
NinjaTrader Customer Service
 
NinjaTrader_Matthew's Avatar
 
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
Default

Only one event will be processed and this occurs the the close of the bar on a single data series strategy. There is no way to predict which event (profit or stop) will be executed.

If you would like intrabar granularity, you would need to at a higher resolution by adding a tick series for example. In this case, it would hit which ever price was penetrated first.
NinjaTrader_Matthew is offline  
Reply With Quote
The following user says thank you to NinjaTrader_Matthew for this post:
Old 07-24-2012, 08:42 AM   #15
ell2230
Junior Member
 
Join Date: Jul 2012
Posts: 13
Thanks: 2
Thanked 0 times in 0 posts
Default

Quote:
Originally Posted by NinjaTrader_Matthew View Post
Only one event will be processed and this occurs the the close of the bar on a single data series strategy. There is no way to predict which event (profit or stop) will be executed.

If you would like intrabar granularity, you would need to at a higher resolution by adding a tick series for example. In this case, it would hit which ever price was penetrated first.
I see. That makes sense. Thank you for your explanation.
ell2230 is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NinjaTrader with TradeStation bjm051593 Connecting 2 09-09-2011 02:17 PM
TradeStation to NinjaTrader pistolpete Automated Trading 1 03-01-2011 09:57 AM
real-time vs backtesting discrepancy lself Automated Trading 10 06-01-2009 08:01 AM
Tradestation vs NinjaTrader stepwise General Programming 15 05-25-2007 07:15 AM
Tradestation vs NinjaTrader stepwise ATM Strategies (Discretionary Trading) 1 12-31-1969 06:00 PM


All times are GMT -6. The time now is 07:49 AM.