Is the following correct?
If variables are marked as static, they "survive" the backtest. If you run the backtest a second time (perhaps with slightly different parameters or simply by clicking), the data from the first run is still in memory. WealthLab then mixes the old results with the new ones. This results in the topList looking different in each run.
If so, how can I prevent this?
Thanks!
If variables are marked as static, they "survive" the backtest. If you run the backtest a second time (perhaps with slightly different parameters or simply by clicking), the data from the first run is still in memory. WealthLab then mixes the old results with the new ones. This results in the topList looking different in each run.
If so, how can I prevent this?
Thanks!
Rename
QUOTE:And exactly what do you mean by "the data"?
If you run the backtest a second time (perhaps with slightly different parameters or simply by clicking), the data from the first run is still in memory.
The historical data (BarHistory and Fundamentals) are still in disk cache because that shouldn't change. Any performance data from the previous run is purged. And ScoreCard performance data is stored as dynamic C# variables, not static variables.
The reason performance results differs between runs is because WL randomizes which stocks it buys from the dataset each time it runs. If you don't want that, then you need to set the Weight property on the Transaction instance that PlaceTrade returns. WL will always pick stocks with the highest Weight setting, so if you base that setting on an indicator (with reproducible values, such as RSI), then repeated runs should all look the same.
Read the discussion about https://www.wealth-lab.com/Support/ApiReference/Transaction#Weight and study its example.
---
You ask good questions, and the Help docs do cover the answers. The problem is the Help docs don't give you "operational knowledge" like a tutorial would. You need to ask the WL developers to write a WL tutorial. (Or search the forum for any operational knowledge the reference material lacks.)
https://www.wealth-lab.com/blog/anatomy-of-a-wl7-strategy
static variables do not "survive" backtests.
Only SetGlobal() will store variables in memory throughout a WL session.
static variables do not "survive" backtests.
Only SetGlobal() will store variables in memory throughout a WL session.
Thanks
Your Response
Post
Edit Post
Login is required