Am I Pushing Wealth-Lab Too Hard?
Author: Panache
Creation Date: 3/11/2015 5:13 PM
profile picture

Panache

#1
I had the data go bad on a hard drive this morning, and I just want to confirm that it wasn't because I was trying to do too much with Wealth-Lab Pro at the same time.

As I understand it, when I open a Strategy window in Wealth-Lab Pro, an instance of the Strategy, together with the specified data, is loaded into memory. Therefore, I can have multiple Strategy windows open simultaneously even if they are using the same data. Moreover, it doesn't matter whether I'm editing the code, running or optimizing the various Strategies.

Obviously, there is a CPU and RAM limitation on how many Strategy windows I can have running simultaneously, which I monitor with Resource Monitor.

The only time Wealth-Lab Pro writes data back to the hard disk from a Strategy window is when I close the Strategy (to the extent information is saved with the Strategy under Preferences>Advanced Options). Although I haven't tried it, I assume that updating data with Data Manager while running Strategies also shouldn't be a problem, as long as I don't need the Strategy to see the new data.

Am I wrong in my understanding of how Wealth-Lab Pro functions?
profile picture

Eugene

#2
Just a quick check. Assuming you've installed the SSD, maybe the system is misconfigured, or there's a drive issue, or firmware upgrade available etc? Also, were you able to resolve the general "parameter is incorrect" problem?
profile picture

Panache

#3
Yes, I had an SSD which was up to date and installed properly. Before I got the parameter is incorrect errors, the only thing I had been running the previous day was Wealth-Lab (other than antivirus and other "background" programs).

I'm trying to isolate the problem which could be a lot of things. My memory tests fine, and there are no viruses or malware on my computer. I don't know how to actually test the integrity of a SSD, so instead of reinstalling Windows on the SSD, I'm using a traditional hard drive for now.

The reason for my questions about how Wealth-Lab works is that when running half a dozen Strategy windows or so, I have experienced optimizations "hanging", ie. the Elapsed and Remaining time doesn't change for an hour or more. This is often accompanied by near 100% CPU usage on at least one of my logical processors. This has happened both with the SSD and the traditional hard drive. I have always had at least 6 GB of free memory when this has happened, so I don't think it is a memory issue.

Some of the strategies I am currently working on are rotation strategies, which is what makes me wonder if Wealth-Lab might not be loading all the data into memory and is running into conflicts trying to load the same data for two different strategies, ie. if one strategy is looking at all the symbols in the S&P 500 and another is working on all the symbols in the S&P 100, the second strategy is going to be reading the same data as the first, even though they are using different data sets.
profile picture

Eugene

#4
QUOTE:
I have experienced optimizations "hanging", ie. the Elapsed and Remaining time doesn't change for an hour or more.

Like you reasonably pointed out, this is not a drive issue. Could be a Strategy code inefficiency, a WealthScript issue etc.

QUOTE:
if Wealth-Lab might not be loading all the data into memory and is running into conflicts trying to load the same data for two different strategies

I am not a proponent of this memory corruption theory but what if you try not to run parallel optimizations and see where it ends up?
profile picture

Panache

#5
By parallel optimization, do you mean running the same strategy on the same data in two different Strategy windows?
profile picture

Eugene

#6
I meant this:

QUOTE:
The reason for my questions about how Wealth-Lab works is that when running half a dozen Strategy windows or so, I have experienced optimizations "hanging", ie. the Elapsed and Remaining time doesn't change for an hour or more.


It's hard to suggest as I have no idea a) how complex and/or bug-free are your strategies and b) whether your system is configured properly or misconfigured (resident programs, antivirus conflict, whatever), hence the guesswork.
profile picture

Cone

#7
QUOTE:
The only time Wealth-Lab Pro writes data back to the hard disk from a Strategy window is when I close the Strategy (to the extent information is saved with the Strategy under Preferences>Advanced Options).
Closing the Strategy doesn't save this information. Saving it does. And, the secret is that whenever you Save, these data (referred to in the preference) are always saved even if the option(s) are not enabled. The option(s) dictate if they are used when the Strategy is opened. Anyway, unless you're saving the same strategy more than once simultaneously, there's not really a chance of conflict.

QUOTE:
data go bad on a hard drive
Which data? In what way is it bad?

QUOTE:
I have always had at least 6 GB of free memory when this has happened
32 or 64-bit O.S.?

QUOTE:
if Wealth-Lab might not be loading all the data into memory and is running into conflicts trying to load the same data for two different strategies
It would be a "first" in my book. It's easy to check in your script what data are loaded.
profile picture

Panache

#8
QUOTE:
Which data? In what way is it bad?

This started with a Support Ticket https://www.wealth-lab.com/Support/Ticket/25266 I haven't taken the time yet to see what files were corrupted, but it appears to have been something Windows relies on to run most programs. (Excel was the only program I was able to open afterward.) I'm not yet convinced the problem isn't a bad SSD, but since I don't know how to confirm that the SSD is bad, I'm trying to rule out other causes.

QUOTE:
32 or 64-bit O.S.?

The hard disk I am currently running is essentially a clean install of 64 bit Windows 8.1.

QUOTE:
It's easy to check in your script what data are loaded.

How? Is the data for all the symbols in the data set loaded by
CODE:
Please log in to see this code.


I'm currently seeing if I can reproduce the hanging problem running multiple instances of the RSI Rotation strategy, so I can rule out issues with my coding. I'll let you know if I am able to reproduce it.
profile picture

Cone

#9
QUOTE:
foreach(string symbol in DataSetSymbols)
This statement loads no data. Apart from automatic loading of the primary symbol (occurs before the Execute method is called), GetExternalSymbol or SetContext loads secondary symbol data.

CODE:
Please log in to see this code.
Before you test it in an optimization, it's probably a good idea to make sure that you don't get any exceptions in the DataSiet first (click one symbol only). As written for this to work without throwing an exception, all symbols must overlap with the same start and stop dates. (If you use Bars.Symbol.GetAllDataForSymbol(), the test would need to be modified. You can also check for a minimum number of bars or anything else that you suspect to be a problem.)
profile picture

Panache

#10
Thank you. Now, I need to know what the result means.

Let's take the Russell 2000. The first symbol is AAC, which started trading on 10/2/2014. When I run your code, it correctly throws, "Runtime error: AAC started on 10/2/2014".

Does that mean I can't run a rotation strategy on the Russell 2000 (or any other index where all of the components don't have data for the entire period I am back testing)?

QUOTE:
The first symbol is AAC, which started trading on 10/2/2014.


That raises on off-topic question. Since the Russell indicies are reconstituted on May 31 of each year http://www.russell.com/indexes/americas/indexes/us-construction-methodology.page, why is AAC listed in the Russell 2000?
profile picture

Cone

#11
QUOTE:
When I run your code
The code is an example. Did you change the dates in the code to correspond to your test period dates?

QUOTE:
Does that mean I can't run a rotation strategy on the Russell 2000
You wanted to check the dates that Wealth-Lab was loading. The code is an example of how to do it for a simple case (a synchronized DataSet).... it clearly won't work for the Russell 2000. If you had a list of the expected starting dates by symbol, it would be trivial to check on a by-symbol basis.

QUOTE:
why is AAC listed in the Russell 2000?
Why shouldn't it be. My source (Premium Data list) says that it's still in the R 2000. Do you subscribe to Russell data products? If not, good luck on finding an [accurate] free source of the Russell lists.
profile picture

Panache

#12
QUOTE:
You wanted to check the dates that Wealth-Lab was loading.

I thought you were saying it was easy to see whether the data for all the symbols in the data set was being loaded into memory.

QUOTE:
why is AAC listed in the Russell 2000? Why shouldn't it be.

AAC Holdings, Inc. (AAC) didn't start trading until October, 2014. Since the current Russell 2000 was last reconstituted on May 31, 2014, AAC Holdings, Inc. didn't exist as a publicly traded company at that time, so it couldn't have been part of the Russell 2000. I suspect Premium Data is using an older version of the Russell 2000 which included another company (whose name I don't have in my data) the symbol of which was also AAC. I only have data for that company through 2012, but I don't know for sure when it stopped trading.

QUOTE:
If not, good luck on finding an [accurate] free source of the Russell lists.

I know -- I've tried also!
profile picture

Cone

#13
QUOTE:
so it couldn't have been part of the Russell 2000
Spin-offs and Initial Public Offerings are the only additions between reconstitution dates.

QUOTE:
I thought you were saying it was easy
It is easy, but to test the dates for every non-sync'd symbol you have to generate the truth data to check against. You'll probably just waste your time doing it though (but you never know!)
profile picture

Panache

#14
Having done a bit of research and testing, the answer to my original question is that I was trying to do too much with Wealth-Lab. Here's a short summary of what I've found (as with all summaries, it leaves out a lot of important details):

This discussion will assume we're talking about a typical desktop or laptop computer with a single CPU running Windows. A CPU, such as an Intel i7 contains 4 physical cores. Hyper-threading results in 8 logical cores, but that does not mean the CPU can do 8 things at the same time; each physical core can only do one thing at a time.

Optimizations in Wealth-Lab are very CPU intensive. Therefore, opening 4 Strategy windows in Wealth-Lab and running optimizations in all 4 Strategy windows will come very close to using 100% of the CPU. However, Windows Task Manager and Resource Monitor report CPU usage based on logical cores, rather than physical cores, so if the 4 Strategy windows are using 100% of your CPU, it will only be reported as 50% in Task Manager and Resource Monitor.

Windows runs a number of "background" programs, even if the only program you have opened is Wealth-Lab. These are in addition to any other programs, such as anti-virus, that your computer may run automatically. When these start, they need CPU resources, too.

Inactive Strategy windows require almost no CPU resources. Therefore, if they are not executing or optimizing a Strategy, it makes little difference how many of them are open. To maintain the stability of Wealth-Lab, I suggest you not have more than 3 Strategy windows optimizing or executing Strategies at a time on a quad core processor -- that leaves one physical core free for background programs.

The second limitation is memory. Eugene is correct that Wealth-Lab loads all the data into memory more or less when the Strategy is executed or optimized, so that multiple Strategy windows can be running the same Strategy on the same data. In my testing, 8 GB of memory is plenty to execute or optimize 3 daily Strategies simultaneously.

Understanding this provides an opportunity to make optimizations run faster. Let's say your exhaustive optimization requires 3000 runs. Instead of running 3000 runs, you can open 3 Strategy windows with the same Strategy and data and do 1000 runs in each of them.

The only word of caution is to make sure the way you divide up the optimization contains all 3000 cases. Let's say parameter A varies from 1 to 3 and parameter B varies from 1 to 1000. Running the first window with A = 1 and B = 1 to 1000, the second window with A = 2 and B = 1 to 1000 and the third window with A = 3 and B = 1 to 1000 gets you all 3000 cases.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).