I am using a variable of type double
double onedayreturn;
and getting an error when the following equation is executed:
onedayreturn = 100.0*(Close[bar]-Close[bar-1])/(Close[bar-1]);
If I do not multiply by 100.0 I do not get the error. The error is:
"Runtime error: Object reference not set to an instance of an object. at WealthLab.Strategies.MyStrategy.Execute()"
Any thoughts?
Rob
Size:
Color:
It's not the multiplication. There must be something else in the code causing it - something that isn't shown in your post. As
onedayreturn has not been initialized, i.e.
null, look for the line where you're referring to this variable without having assigned a value before.
P.S. btw,
CODE:
Please log in to see this code.
See
ROC in the Wiki.
Size:
Color: