Hello,
When I run a simulation against a dataseries, it completes in a matter of seconds (let's say 3 seconds).
When optimize it to include a few variables (let's say 2), the length of time it takes to calculate the results is far disproportionately longer than it should be. Here's a specific example:
CODE:
Please log in to see this code.
So Variable1 is always .05, and Variable2 is 1.00, 1.01, 1.02, 1.03 - code should re-run a total of 4 times. However, that optimization takes 1-2 minutes. If I change 1.03 to 1.10, it will take over 10 minutes.
I can manually run each simulation using static variables 10 different times in a fraction of the time - and so I assume I must be doing something wrong.
Size:
Color:
Hi,
Let's see your complete Strategy code and data loading settings to start with. Am I correct to assume it must be an exhaustive optimization?
Size:
Color:
Yes it is exhaustive. Am I mistaken in assuming that, even though it's exhaustive, the code should only run 4 times, once for each parameter combination? Or does it operate in a different manner?
Also, I hate the idea of wasting your time with questions that are probably obvious to you - do you have a FAQ or other starting point for newbies like myself? I have looked over some strategy code and read through parts of the user guide, but I still have lots of gaps in my knowledge.
Thanks
Size:
Color:
Ted, Wealth-Lab does not work as you describe under normal circumstances. At this point your case is too general for me to offer any suggestion. And I hope we find some clue in your unedited Strategy code and data loading settings (date range, single- or multi-symbol mode - SSB vs. MSB, bar scale etc.)
The most prominent thing to consider is SSB/MSB confusion - like a quick run of your Strategy manually on a single symbol vs. long-running optimization on a portfolio of many stocks e.g. S&P 500.
QUOTE:
Am I mistaken in assuming that, even though it's exhaustive, the code should only run 4 times, once for each parameter combination?
You'll find the number of "Runs Required" at the bottom of the Optimization tab.
QUOTE:
do you have a FAQ or other starting point for newbies like myself?
Sure, it's the
"Wealth-Lab Wiki" link that you see on top of the page (Support tab). It's our knowledge base where you can, for example, find
Open Issues like "
Calculating StochD gets slower in geometric progression depending on smoothing". I don't imply that this would affect an optimization to that extent, though.
QUOTE:
I can manually run each simulation using static variables 10 different times in a fraction of the time - and so I assume I must be doing something wrong.
Be careful when using static variables in WealthScript! This is proven to be a source of many bugs in users' code.
Size:
Color:
What's confusing me is, when I manually run the simulation once using MSB (by highlighting the dataset on the left pane - let's say 500 symbols in the dataset) and click "Backtest on all symbols in current test)", the backtest takes about 5 seconds. But when I open the optimization control and attempt to backtest from there, the calculation takes SIGNIFICANTLY longer than [5 seconds * number of permutations] as I would expect. So if there are 10 permutations of parameters, I would expect the optimization backtest to take 50 seconds. But it does not. It takes orders of magnitude longer than it should, with an exponential increase in time required as I increase the number of permutations.
So one manual run takes 5 seconds.
Optimized with 10 permutations might take 15 seconds PER RUN.
Optimized with 100 permutations might take 30 seconds PER RUN.
Shouldn't each permutation take just 5 seconds, as it does if I manually click "backtest on all symbols in [strategy]" ?
I should also note, and perhaps this will help to troubleshoot the issue, the "Estimate" of time it should take is way off - it generally takes 5 - 20 times longer than the estimate says (10 min estimate can take several hours).
Note, my settings are NOT set to automatically update data on-demand, so that isn't the issue.
Could the issue be that when you run the strategy just once on the dataset, it runs in MSB mode (5 seconds on a 500-symbol dataset) but when you run an optimization it runs in a different mode? Just grasping at straws here.
Thanks in advance
Size:
Color:
Ted, at the risk of sounding like a broken record I positively cannot know what happens at your still unknown environment - after 2 failed attempts to find out the details required for troubleshooting which are:
0. Does it happen for this code only? Or all Strategies are affected? Or just some - what is the pattern?
1. Your
unmodified Strategy code that demonstrates the anomaly
2. Optimization settings
3. DataSet with its symbols, Data provider
4. Data loading (scale, range) and Position sizing settings
When you get to know me through the forum you'll see I'm far from being a fan of guesswork like inexistent "different optimization modes". :) As this insightful read suggests, you have to "Show me":
How To Ask Questions The Smart WayThe more details the better the chances to track the problem down. Looking forward to help you!
Size:
Color: