performance of simulation
Author: wbzhang
Creation Date: 9/28/2010 12:52 PM
profile picture

wbzhang

#1
I have some performance issues during simulation. Hope you can advice.

1) My experiments use 500 stocks over 3 years. After several runs, Wealth-Lab popped up a box, which said "The system running low on memory. Please close the currently open Chart or Strategy window". However, I don't have too much open Chart or Strategy window. Any solution for this? I mean, in terms of Wealth-Lab level (for example, any tunable parameters, like program cache, heap ...). I know definitely another solution is to add more memory to the machine.



2) Another question I want to ask is: Is there any "global" variables/data mechanism in strategy code? For example, in strategy code "Symbol Rotation-->RSI Rotation", for each symbol and each bar, we need to compute RSI index, add to list, and sort the list. However, for each symbol, the lists are the same, lots of redundant computation are involved.

If we have 500 symbols, and simulate for 4 years(around 1000 bars). We need to run the "foreach" loop for 500*1000 times.

But actually, we only need to run the for loop 1000 times. The lists are the same for each symbol, we only need to run them for 1 symbol.

I have a similar strategy, I tried 500 symbols and it is extremely slow. So I am wondering, does global data exist? I just need to compute once, and don't need to compute for each symbol. If not, can you think of other solutions to this? This can save the backtesting time for 500 times!!
profile picture

Eugene

#2
1 - 500 stocks over 3 years, but which bar scale? If daily data, it's nothing but on an intraday basis that would be a very different story. Out of memory problems - is a good guide for estimating how much memory you need, and to use a rather big number (over 1.3Gb RAM) in full, WLD/P x64 running on a 64-bit OS is required.

2 - That's because you're running this strategy incorrectly i.e. overlooking what's mentioned in the Strategy Description box. Another hint: A Rotation strategy isn't working like it should.

Yes, there is global memory in Wealth-Lab but in this case of a rotational strategy it's not required. Turn off on demand data update, execute the strategy like the Wiki FAQ above instructs to, and it will become pretty fast.
profile picture

wbzhang

#3
Thank you for your response.

This is the reason. thanks!
Solution:
Read the Strategy description. Follow the usage notes precisely. Select only 1 symbol in the DataSet. This strategy should not be run in Multi-Symbol Backtest mode. Otherwise you'll be running the script once for each symbol, and it's not designed for that.

Two more problem:
1. I have 500 symbols now. After the simulation finished, in the "Equity Curve" curve, I can see my strategy vs. "Buy and hold". However, this "buy and hold" is only for the symbol I clicked. I want to show "buy and hold" for the equal-dollar portfolio of the 500 symbols. How to do that?

In addition, how to compare my strategy vs. some indices (NYSE, S&P 500?)

2. I click another symbol because I want to see that symbol's trades. But the simulation re-run.. That's not what I want. Can I disable this?
profile picture

Eugene

#4
1. No easy way for a strategy running in single symbol mode. As an alternative, what about specifying a custom benchmark B&H symbol in the Wealth-Lab's Preferences?

2. This is by design. Strategy has to run to create trades to populate the visualizers.
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).