- ago
When I look at the DataManger for Wealth-Data->Dow30 I see this:



If I try to acces this data from a Strategy, there are many incomplete series.

To demonstrate I created this strategy:

CODE:
using System; using System.Collections.Generic; using WealthLab.Core; using WealthLab.Backtest; namespace WealthScript1 { public class CheckDataStrategy : UserStrategyBase {       static SortedDictionary<string, string> symbolMessages = new SortedDictionary<string, string>(); public override void Initialize(BarHistory bars) {          DateTime firstValidDay = DateTime.MaxValue;          DateTime lastValidDay = DateTime.MinValue;          // find first and last day with valid data (Close != NaN)          for (int i = 0; i < bars.Count; i++)          {             if(!double.IsNaN(bars.Close[i]))             {                if(firstValidDay == DateTime.MaxValue) firstValidDay = bars.DateTimes[i];                lastValidDay = bars.DateTimes[i];             }          }                   symbolMessages.Add(bars.Symbol,    $"{bars.Symbol:-6} First: {firstValidDay.Date:yyyy-MM-dd}, Last: {lastValidDay.Date:yyyy-MM-dd}");          }       public override void BacktestComplete()       {          foreach(string msg in symbolMessages.Values)             WLHost.Instance.AddLogItem("CheckData", msg, WLColor.Black);       }              // not used public override void Execute(BarHistory bars, int idx) {} } }


When run as Portfolio Backtest with DataSet Dow 30;WealthData
it produces a LogViewer output like this:


Please note the different "First Date" and "Last Date" for symbols AIC, BAC, C and so on.

It is possible to see the same effect by just clicking the "bad" symbols in DataSets->WealthData->DOW 30

I have Data Range: All Data.

It makes no difference if Strategy Settings->BacktestData->Obtain data from selected... is checked or not.

Happens with Build 89 and Build 90. I did not check older builds.
Happens on two (very different) PCs.

This problem is hard to see unless you know what you are looking for. On the other hand it will disturb backtest results heavily because much less data is used during the backtest than expected.
0
103
Solved
7 Replies

Reply

Bookmark

Sort
- ago
#1
I ran your code and got the same results. I then checked the dataset's data integrity and it pointed out a few issues. But, it did not find that symbol C was missing data. However, in the data manager symbol C showed a last date of 2024-02-23 and not the expected date 2024-04-22 (yyyy/mm/dd). So, using the data manager, I tried to update the dataset, and it was stuck doing nothing. I then hit the cancel button and got the white haze of death with a busy cursor.
0
- ago
#2
QUOTE:
I ran your code and got the same results


Good to know its not just me... ;)

I deleted the raw data and updated everything in DataManger. Didn't help.
0
- ago
#3
I had to kill WL8 (see Post #1). I restarted WL8, opened the data manager and updated the data set. Symbol C updated from 2024-02-23 to 2024-04-22 (yyyy/mm/dd). I ran your code, but got the same results.
0
Cone8
 ( 23.78% )
- ago
#4
When you run on a Wealth-Data DataSet, only the dynamic ranges of when the symbol was in the DataSet are loaded.

Copy the DataSet symbols, and create your own DataSet - even linked to Wealth-Data. You'll get the result that you're now expecting.

(I might have misunderstood the discussion - happens all the time).
0
Best Answer
- ago
#5
QUOTE:
When you run on a Wealth-Data DataSet, only the dynamic ranges of when the symbol was in the DataSet are loaded


What does this mean?

I see the symbol AIG.
Data Manger says it has data from 1987 to today.

When I run a strategy on this symbol the BarHistory (bars) inside the strategy should contain valid data from 1987 until today - or not?
0
- ago
#6
QUOTE:
When I run a strategy on this symbol the BarHistory (bars) inside the strategy should contain valid data from 1987 until today - or not?

No. Only the date ranges while the symbol was in (but not out of) the index. It takes creating a non-dynamic version of the DataSet like Cone suggested in Post #4.
0
- ago
#7
QUOTE:
while the symbol was in (but not out of) the index


Ok, got it.

I forgot for a moment the meaning of a dynamic DataSet.

Sorry for the trouble.
0

Reply

Bookmark

Sort