![]() |
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
|
|||||||
| Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Jan 2011
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
|
Hi there!
I use Win 7 64 with 12 GB RAM. When I do a Walk Forward Optimization of a strategy over 6 months, using 13 Range bars and Optimization period of 28 days vs. Test period of 7 days, NT 64 uses all the memory available (~11.5GB) and then the WFO stalls, it runs for hours and hours with no error message. Optimization period of 21 days vs. Test period of 7 days went through. Does anyone have either a fix / work around or rule of thumb do define the acceptable ranges? Philippe |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
philippe,
There are many reasons this may be occurring, as it depends on how many variables you are optimizing over. For example, if you have 6 variables being optimized on 20 steps each over a period of 31 days, you are effectively doing 6*6*20 runs of a strategy over 31 days. Since strategies can run on multiple threads when being optimized, you are probably maxing out your RAM due to having too many strategies running over a sufficiently long enough period of time. There unfortunately is no technical rule of thumb without delving into your strategies computational complexity, however you have basically done what I would have suggested, i.e. reduce time frame and/or reduce the range the variables are optimizing over and see if it improves performance. Please let me know if I can assist further.
Adam P.
NinjaTrader Customer Service
Last edited by NinjaTrader_AdamP; 10-22-2011 at 11:38 AM.
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jan 2011
Posts: 13
Thanks: 1
Thanked 0 times in 0 posts
|
Correct me if I am wrong, 6 variables with 20 steps gives:
20x20x20x20x20x20=64,000,000 runs with default optimizer. The strategy generates around 20 trades per months. I run an optimization on the Profit Target and Stop Loss, both 50 to 200 ticks in steps of 10. 15 x 15 = 225 combinations using the Genetic optimizer which should decrease the number of runs. Rounding up, there are 20x225=4500 trades per period tested (in my scenario 21days for optimization + 7 days walk forward), over 6 months or 26 weeks = 117,000 trades. Nothing that should use 11.5 GB of ram, shouldn't it? I reduced the "keep best # results" to 5 and the time frame as you suggested. Now the optimization goes through. However, at the end of the optimization the RAM is not freed up. So between 2 tests, I shut down NT and start it fresh. Isn't there a possibility the the memory is not freed up as expected? |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
Philippe,
There is more to consider. Let us fix 1 variable with a total of 6 variables being optimized and 20 steps for each. This 1 variable requires 6*20 steps to complete 1 step, but there are 6 of them total. In this instance, you have 6 variables fixed with 6*6*20 steps total.
Adam P.
NinjaTrader Customer Service
Last edited by NinjaTrader_AdamP; 10-22-2011 at 04:42 PM.
|
|
|
|
|
|
#5 |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
I have ninja 64 up-to-date. When I optimize a strategy, once it is done ninja never releases the RAM that it was using. So after optimizing a strategy so many times, ninja will become really slow and the Windows Task Manager will show that all RAM is maxed out.
I can only recover my RAM if I quit Ninja. Then RAM returns to normal usage levels and the process repeats itself the next time I run optimization. I am running Windows 8 64bit with 6 GB of RAM. I only use this computer for Ninja. Any suggestions? |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
chris,
I am not seeing similar behavior here. I have been optimizing some strategies watching the RAM usage and see that it free's it up almost immediately after the optimization is finished. Are you printing to the log or output window in your strategy you are backtesting?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#7 | |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
Quote:
|
|
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
chris,
You can check the Control Center > Log tab. Also, how many strategy analyzers are you running at once?
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
I am only doing one strategy. I can see single line entries on the log tab. I don't see if I am writing all my optimizing data results there.
|
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
That would be awesome if it would free up. What other settings should I check?
|
|
|
|
|
|
#11 |
|
NinjaTrader Customer Service
Join Date: Aug 2011
Location: Denver, CO, USA
Posts: 2,895
Thanks: 241
Thanked 375 times in 365 posts
|
chris,
Are there like over 100 things in your log? Generally more would be required but I am mainly asking if there is a lot. This would be after you ran many optimizations, so it would require you to do what you did before to max out the RAM, then check the log. After this, our next recourse is for you to send me your strategy along with a description of how to replicate your issue. If I still cannot, I would suggest a reinstall of Ninjatrader, i.e. uninstall it first then reinstall.
Adam P.
NinjaTrader Customer Service |
|
|
|
|
|
#12 |
|
Senior Member
|
Which instrument are you testing on?
Tick compression might help ... Search for "compress tick data for quicker backtests" in google ... |
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
I am testing CL. I have about 40 different settings in the strategy. The log file looks normal not too much stuff in it.
When you built a strategy are you suppose to release the RAM at the end of the code? Once I am done with the strategy - I can quit the strategy analyzer and the RAM still stays maxed out. It is only when i quit ninja does it finally free the RAM. I'll look into compressed tick data. |
|
|
|
|
|
#14 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hi Chris,
Normally you do not need to do anything special but if your strategy uses custom resources, you need to dispose of them in OnTermination(). Examples of this could be seen in our samples that work with timer objects or streamwriter/reader. http://www.ninjatrader.com/support/f...ead.php?t=3476 http://www.ninjatrader.com/support/f...ead.php?t=5965
Ryan M
NinjaTrader Customer Service |
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Dec 2010
Posts: 6
Thanks: 0
Thanked 0 times in 0 posts
|
I have included the OnTermination() command in the Ninja Strategy and now I am able to quit during optimization where before I was not. However, the RAM is still full and stays that way unless I quit Ninja completely. I noticed there was a Dispose() command. Would this help my issue?
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Walk Forward Optimization | eleven | Strategy Analyzer | 11 | 12-16-2010 09:52 PM |
| Walk Forward Optimization. Can't replicate | lookOutBelow | Version 7 Beta General Questions & Bug Reports | 0 | 09-11-2010 11:41 PM |
| Walk forward optimization - is it rolling? | stefy | Strategy Development | 5 | 06-09-2009 05:46 AM |
| Walk Forward Optimization | JonesWooHoo | Suggestions And Feedback | 8 | 10-12-2007 04:16 AM |
| Walk Forward Out of Memory Message | daven | Strategy Analyzer | 1 | 06-01-2007 11:03 AM |