![]() |
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
|
|||||||
| Strategy Analyzer Support for automated system backtesting and optimization using the NinjaTrader Strategy Analyzer. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Aug 2007
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
I have a basic question. It appears that the only historical data that I can load must be in 1 minute bars. Is this correct? The manual appears to say this; and fiurthermore I've had no luck trying to load 2 minute bar data.
Rick
Last edited by jonesr227; 08-21-2007 at 03:28 AM.
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
>> It appears that the only historical data that I can load must be in 1 minute bars.
Incorrect, you can run your strategy on any minute series you'd like. Just (a) run it on a 2 minute chart or (b) start it on a 2 minute series in the strategies tab or (c) backtest it on a 2 minute series using the strategy analyzer.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Aug 2007
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
Can I give more descriptive names such as "ER2_1min" and "ER2_2min"? I haven't been able to find out how. |
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Let's not confuse things:
a) Instrument names have nothing to do with data series. As you have imported 1 minute bare series for ER2 09-07, any (!) minute series, including 2 minute series for ER2 09-07 is readily available and you can run tests on it a per my post below. b) If you want to run test on the ER2 03-07 you need to import data for that instrument as well, since it just a different instrument. c) Before testing any instrument I suggest you add it to your instrument list by: Tools->Instrument manager. This is a limitation of NT6 and will be come by fall time.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#5 | |
|
Junior Member
Join Date: Aug 2007
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
I understand that having imported 1 minute data that I can now run any (integral multiple) bar interval. Therefore I understand your point (a) above. Also (as I mentioned in my prior post) I did use the Instrument Manager to add the instrument name; so I also understand your point (c) above. Point (b) however appears to require qualification. When you say "If you want to run test on the ER2 03-07 you need to import data for that instrument as well", apparently implicit in this is that this new data must be in 1 minute bars. Which leads me to my very original question: "It appears that the only historical data that I can load must be in 1 minute bars. Is this correct?" So the answer is in fact yes. Sorry for belaboring this but I need to have a clear understanding of this. |
|
|
|
|
|
|
#6 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
ER2 09-07 and ER2 03-07 are two different instruments, like MSFT and DELL are two different instruments.
Not sure what you mean by "loading data": if you mean importing then yes, you only can import 1 minute series (and not 2 minute series), if you mean running a strategy then no, and my post below stands.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Aug 2007
Posts: 21
Thanks: 0
Thanked 0 times in 0 posts
|
Dierk,
Thank you very much for your help. As I learn about NT, I was baffled to find in regards to data that , (at present): 1) only 1 minute interval bars can be imported, 2) only specific names can be used with the data. By the way, (not withstanding the above issues) I think NT is a terrific product. I'm actually hoping that it will replace my current backtester. (There's no longer any reason to use a backtester that uses interpreted code). |
|
|
|
|
|
#8 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
1) You can import 1 minute, 1 tick and 1 day series. All other series are created by NT internally. No need to import anything else.
2) Not sure what you mean by "only specific names can be used with the data".
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 329
Thanks: 0
Thanked 11 times in 8 posts
|
I am testing a strategy and trying to see if it can be improved using a trailing stop. I'm using a 377 tic interval on the ER2 (the september 07 contract). I'm using mirus/zenfire for my historical data. I find that if I use a low value of for the trail interval (say 2 tics) I get fantastic results for the strategy but when I run those same values in real-time, I get terrible results. I understand that backtesting versus real-time will not be the same, but I'm struggling to understand how I can use backtesting to improve a strategy when the delta between back versus real is so huge. It must be the way a tick bar is built in the historic data. Can you provide more detail about how that tic is built. If I run a 377 tick interval in backtesting, are there 377 tics, all time-stamped inside that bar or is there a different methodology. If the strategy can't look "inside" a bar, why do I get trailing stop hits inside the bar the position is taken in? I have the strategy set to execute on the bar close, and all my positions start on the open of the next bar.
|
|
|
|
|
|
#10 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Hi Daven,
When you are backtesting there is only one bar timestamped and not 377 ticks inside that bar with each timestamped. This is why we can't "look" inside the bar for more clarity. You get a trailing stop because it just assumes you would have gotten filled at x level. It looks at the OHLC and determines if sometime within that bar you would have been stopped out and it will do so at your trailing stop price. The reason all your positions start at the beginning of the next bar is related to the "look" inside limitation. Because the only time you would know the OHLC of a bar is at the end of the bar, the only time you can act is right now and not in the past. Right now means the start of the new bar. Hope that helps clarify things.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Mar 2006
Location: Bellingham, WA , USA
Posts: 329
Thanks: 0
Thanked 11 times in 8 posts
|
Josh,
Thanks for that clarification. That explains what I've been seeing in testing versus reality. Is there a way to run a strategy so that the strategy entry is executed on the close of a bar, but any trailing or stop positions would be executed within a bar, (not wait for the bar to close)? Daven |
|
|
|
|
|
#12 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Unfortunately there is no steadily available method to do so. This is the reason why you cannot just backtest your strategy. You also need to forward test it. Personally, the way I forward test my strategy is from replay files.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Excuse my previous comment. I misunderstood your question. You can set CalculateOnBarClose == true to have your strategy entry only execute on the bar close. You can then use SetTrailStop() to manage your stops. Even when CalculateOnBarClose == true the SetTrailStop() will be updated tick by tick so it will exit for you within the bar.
http://www.ninjatrader-support.com/H...TrailStop.html
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#14 |
|
Member
Join Date: May 2007
Location: West Jordan, Utah
Posts: 61
Thanks: 0
Thanked 0 times in 0 posts
|
May I jump in here. I believe I have been trying to do what daven is talking about. Using single tick historical data I am attempting to backtest a strategy that is based on 30 minute indicators. I open a position correctly at the close of a 30 minute bar, but it appreas that even using SetTrailingStop() my position is not updated until the close of the next 30 minute bar. This happens if CalculateOnBarClose is true or false.
Do I misunderstand? Thanks |
|
|
|
|
|
#15 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
Hi kgillis23,
During backtesting you will enter the trade on the next bar after you place your order. This is the case for normal entries and exits via the EnterLong() ExitShort() methods. Technically speaking, the order is placed and filled at the open of the next bar because the close of the current bar is already past history and you can't affect history. In regards to the SetTrailStop() method. It sends orders that will be executed on the bar it is triggered even in backtesting. It will not wait for the bar to close to exit your already existing position. The logic behind this is because if the stop price is triggered anywhere during the bar it would have closed right there. Does that make sense? The SetTrailStop() is unaffected by which setting you have CalculateOnBarClose at while regular entry and exit methods are affected by it. Hope that clarifies things.
Josh
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Backtesting Algorithm | dgregor5 | Strategy Analyzer | 5 | 08-10-2007 02:11 AM |
| Display Update Interval (sec) question. | higler | Charting | 1 | 07-30-2007 06:32 AM |
| Dynamic base pointer or time reference for secondary time interval | ct | Strategy Development | 11 | 06-20-2007 02:27 PM |
| Backtesting | AO76 | Strategy Development | 2 | 05-23-2007 09:48 AM |
| intraday time interval | rally7 | Miscellaneous Support | 2 | 05-14-2007 12:09 PM |