![]() |
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: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Hello, I was looking through the help guide but I could not find an answer to my questions and if you could provide some information that would be great.
1) During strategy optimization how does the data being fed into the strategy ? At the bar closure or tick by tick? 2) During strategy optimization is it possible to set execution for all posible combination in the data ranges provided? Thanks a lot, |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
1) When backtesting/optimization the events will be evaluated at the close of each bar. Please review our Help Guide article on Discrepancies: Real-Time vs Backtest http://www.ninjatrader.com/support/h...ime_vs_bac.htm 2) Can you elaborate on this? Do you mean to optimize on tick vs minute vs range, etc? Or do you just want to run on range of values? (e.g., 1 minute to 60 minute)
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the reply, I read that optimization does not go through all the values that you set in ranges to optimize strategy on, it picks patherns to achive the most for selected type of otpimization. So I was woundering if there is a setting to run optimization for all possible combinations in the ranges that you give to the strategy input fiels.
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,781
Thanks: 159
Thanked 565 times in 556 posts
|
Hello,
It will only pick patterns if you're using the genetic optimization. The standard optimization will be fully exhaustive and optimize on all possible combinations.
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Thank you for your reply, it really helped me to optimize my code for the "last tick in bar" order handling.
I was wondering how the strategy execution is different in the Strategy Analyzer vs running it manually in terms of internal functions being executed by that I mean: 1) when the Analyzer moves to the next value in data range what functions are being triggered in the strategy ? Same as if it would be added to the chart and enabled ? Initialize() >OnStartUp()>OnBarUpdate() ? Or the Strategy Analyzer skips some of it when looping through the values ? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,670
Thanks: 114
Thanked 188 times in 183 posts
|
Hello vitaliys,
Thank you for your response. The Initialize(), OnStartUp(), and OnBarUpdate() methods will work the same on both real-time data and the Strategy Analyzer. The only difference here is you must remember that Backtesting always runs as CalculateOnBarClose = True, which means OnBarUpdate() is called on the close of a bar. For information on the Initialize(), OnStartUp(), and OnBarUpdate() methods please visit the following links:
For information on CalculateOnBarClose pelase visit the following link: http://www.ninjatrader.com/support/h...onbarclose.htm Please let me know if I may be of further assistance.
Patrick H.
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks ! running smoothly,! could you take a look at the screenshot below, it looks like the application is not using a lot of CPU but using a lot of RAM. Is there any way to make it run faster? I already set the process priority to "High" I'm running optimization on 18 day period but with quite a lot of parameters. Not sure if its hanging or not, Control Centre's window is greyd out as you can see in the background.
Last edited by vitaliys; 08-19-2012 at 10:01 PM.
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,670
Thanks: 114
Thanked 188 times in 183 posts
|
Hello vitaliys,
Thank you for your post. You can find performance tips for the NinjaTrader 7 platform at the following link: http://www.ninjatrader.com/support/h...ance_tips2.htm So I may investigate this matter further please send me your log and trace files to support[at]ninjatrader[dot]com for today so that I may look into what occurred. In addition, please advise how many Workspaces you have open and the size of your database file which can be found by going to Documents-->NinjaTrader 7-->db folder and the database will be named "NinjaTrader.sdf". You can send your log and trace files by going to the Control Center-> Help-> Mail to Support. Please reference this thread in the body of your e-mail: http://www.ninjatrader.com/support/f...ad.php?t=51300 And include "ATTN: Patrick" in the subject line. I look forward to assisting you further.
Patrick H.
NinjaTrader Customer Service
Last edited by NinjaTrader_PatrickH; 08-20-2012 at 07:38 AM.
|
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Patrick for the support, I think I found two issues with my code, first I compiled it in Debug mode and second I need to put condition on the Print statements so I could turn it off for the optimization runs so it wouldn't consume CPU on logging messages. Let me do these changes and I will update on the results.
Is there a function to save "Optimization Template" with optimization values ? Update: I have excluded pint function from the code with condition and disabled the debugging mode, see the screenshot for the details. I see more CPU activity going through as well as activity in page file, its ranging from 700mb - 1.6GB. DB file size is about 6 mb but time stamp in "modified date" field is not changing during the test and "Control Center" window looks greyed out not sure if its normal.
Last edited by vitaliys; 08-20-2012 at 10:32 AM.
|
|
|
|
|
|
#10 |
|
Member
Join Date: Feb 2009
Posts: 77
Thanks: 27
Thanked 3 times in 3 posts
|
Don't know if this will help as you seem to have found a few things to help your high ram, but here is an awesome video that someone posted on another thread to eliminate that issue.
http://www.youtube.com/watch?v=DWCVhk5gTps Thanks to the person who posted this as I certainly didn't know anything about setting Vitual Memory. Good luck. |
|
|
|
|
|
#11 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks for the link, I already changed my page file settings, since my 16GB of ram wasn't enough and the windows would shut down NinjaTrader due to lack of RAM lol. Please see my previous post for the updates. I can't get to the Control Center menu to get the logs.
my system configuration 16GB DDR3 2133 CPU i7-3930k SSD system drive Win7 Sp1 64 bits, Running NinjaTrader 64 bits
Last edited by vitaliys; 08-20-2012 at 10:50 AM.
|
|
|
|
|
|
#12 |
|
NinjaTrader Customer Service
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,670
Thanks: 114
Thanked 188 times in 183 posts
|
Hello vitaliys,
Thank you for your response. Your database is about average in size. Please manually attach your log and trace files to your response and please advise how many Workspaces you have open. You will find the log file on your PC in the (My) Documents > NinjaTrader 7 > Log folder.
Please reference this thread in your e-mail: http://www.ninjatrader.com/support/f...ad.php?t=51300 Please also place "ATTN: Patrick" in the subject line. I look forward to assisting you further.
Patrick H.
NinjaTrader Customer Service |
|
|
|
|
|
#13 |
|
Member
Join Date: Jul 2011
Location: France
Posts: 34
Thanks: 3
Thanked 0 times in 0 posts
|
Concerning this statement :
" The Initialize(), OnStartUp(), and OnBarUpdate() methods will work the same on both real-time data and the Strategy Analyzer. The only difference here is you must remember that Backtesting always runs as CalculateOnBarClose = True, which means OnBarUpdate() is called on the close of a bar. " Does it mean that the Strategy Analyser can work with a strategy with CalculateOnBarClose =False , meaning that OnBarUpdate() is called on the close of the bar ( as if CalculateOnBarClose =True) ? Regards |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Ggeib,
That is correct. You can add intrabar granularity to backtests using the following : http://www.ninjatrader.com/support/f...ead.php?t=6652
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Jan 2012
Posts: 17
Thanks: 0
Thanked 0 times in 0 posts
|
My whole code was built with the idea of CalculateOnBarClose = True calculations, but it looks like Market Position does not go flat after ExitLong(); command , at least not right away it looks like it goes through all code , so to say finished all actions and only then renders market position flat state on the OnBarUpdate() event during historical calculations after I added condition to check that the market state is flat I got rid of all the error messages , but can't reverse now on the same bar.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strategy Analizer at least 4 years | dubaigoldholding | Strategy Analyzer | 11 | 07-25-2012 10:02 AM |
| How to use correct Bid and Ask rates in Strategy Analizer? | topor | Strategy Analyzer | 5 | 06-01-2012 02:23 AM |
| EnterLongLimit and Strategy Analizer | alibanez | Automated Trading | 1 | 04-28-2011 02:42 PM |
| Strategy analizer bugs | Baruch | Version 7 Beta General Questions & Bug Reports | 2 | 12-04-2009 02:08 AM |
| First Aid on Strategy Analizer | Janos | Strategy Analyzer | 3 | 11-08-2009 05:36 PM |