- ago
My strategies don't run after updating to build 76. I get the following error message.

Initialize Exception (SPY) Line 306 - Object reference not set to an instance of an object.
at WealthScript2.StrategyGiorgos.Initialize(BarHistory bars) in :line 306
at WealthLab.Backtest.UserStrategyExecutor.ConcatIdentifier(List`1 symbols)

Line 306 is as follows;
CODE:
         BarHistory vix1 = GetHistory(bars, "$VIX.X", "Balanced");


0
325
Solved
21 Replies

Reply

Bookmark

Sort
- ago
#1
Is IQFeed the data provider for this symbol, and is it checked in Data Manager > Historical Providers?
0
- ago
#2
TD Ameritrade is my data provider
0
Glitch8
 ( 11.81% )
- ago
#3
Is this a compiled strategy?

The GetHistory call with that overload is not producing exceptions for me in a local C# strategy.
0
- ago
#4
What TDA extension's build is installed?
0
- ago
#5
It was updated to the latest update 20 at the same time as B76
0
Cone8
 ( 25.44% )
- ago
#6
TDA Build 20 doesn't have a problem with $VIX.X for me.

Make sure you have a DataSet named "Balanced" and that $VIX.X is in it.

Otherwise, try Data Manager > Historical Providers > right click TDA and select "Clear Internal Tracking Request.. " and then try again.

0
- ago
#7
"Clear Internal Tracking Request.." does not help. Balance name is correct and works fine with non $.X symbols.
Problem is with all symbols with “$.X” format when you use “GetHistory(bars, "$xxx.X");”
0
Cone8
 ( 25.44% )
- ago
#8
Okay thanks. We'll try to figure that out then.
0
Cone8
 ( 25.44% )
- ago
#9
I just did it with GetHistory, with and without the DataSet specified.
For me it works. :/

What scale?
What's the line of code right above that one?
0
- ago
#10
I tried several ways to recreate the problem, and it always worked. I varied scale, misnamed the dataset, altered the benchmark symbol, etc. Perhaps you should check your symbols? (Menu Tools -> Markets and Symbols -> Symbols tab.)
0
- ago
#11
I am using daily scale
CODE:
         BarHistory vix1 = GetHistory(bars, "$VIX.X", "Balanced");          vix = vix1.Close;

When it's followed by “vix=vix1.Close;” it gives the error
0
- ago
#12
I believe vix1 is null and hence the error. So, GetHistory is returning null for that symbol. With your given sequence, I could not recreate the problem. Check that your TDA token has not expired. Maybe the other symbols already have the data locally, just not $VIX.X.
0
- ago
#13
No matter what I try the problem is the same, it is all the symbols that have the format $xxx.X. Such as $TNX.X, $VIX.X $FVX.X $VIX3M.X

The data for each updates just find and the data on the chart looks good.
0
Cone8
 ( 25.44% )
- ago
#14
Try deleting the .QX data filles for those symbols from TD Ameritrade/Daily in the User Data folder.
0
- ago
#15
Deleting the data does not help.

I updated my second computer to B76 but not TD extension and the problem is repeated there. I than updated TD extension and problem is still there. Like I wrote something in the B76 updated does not like symbols in the format $xxx.X when used in GetHistory

Even the code suggested in the Quick reference does not work.
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.ChartWPF; using System.Drawing; using System.Collections.Generic; namespace WealthScript123 {    public class MyStrategy : UserStrategyBase    {       //plot a market benchmark in its own pane and don't trade unless the benchmark is above its 50-day SMA       public override void Initialize(BarHistory bars)       {          _spy = GetHistory(bars, "$VIX3M.X", "Balanced");          PlotBarHistory(_spy, "SPYPane", WLColor.Silver);          _smaSpy = SMA.Series(_spy.Close, 50);          PlotIndicator(_smaSpy, default, default, default, "SPYPane");       }       public override void Execute(BarHistory bars, int idx)       {          if (!HasOpenPosition(bars, PositionType.Long))          {             if (_spy.Close[idx] > _smaSpy[idx])             {                //code your buy conditions here             }          }          else          {             //code your sell conditions here          }       }       BarHistory _spy;       SMA _smaSpy;    } }


0
Cone8
 ( 25.44% )
- ago
#16
Try removing the "Balanced" DataSet parameter.

e.g.
_spy = GetHistory(bars, "$VIX3M.X");

But wait, if you just type the symbol into a chart, does it get the data?
0
Glitch8
 ( 11.81% )
- ago
#17
What if you try without the DataSet name "Balanced", just leave that parameter out. Does that change anything?
0
- ago
#18
When I type the symbol into a chart the data is loaded just fine. Using the dataset name or not makes no difference.
0
- ago
#19
I used your code from Post #15 and it always worked fine. I used data set names that didn't exist, one's that did exist, no data set name, etc.

From your original post it seemed like SPY was the problem. My suggestions is to make sure you deleted SPY.QX (see Cone's Post #14 ) and try again.
0
- ago
#20
Also, go to the Data Manager and then the Historical Providers tab. Check to be sure that TD Ameritrade is at the top and checked. And, make sure your "Balanced" data set is assigned to TD Ameritrade.
0
Best Answer
- ago
#21
Thanks Paul. Moving TD at the top of the list and checking it made it work.
0

Reply

Bookmark

Sort