getting error when multiplying
Author: cravens
Creation Date: 3/14/2012 8:52 PM
profile picture

cravens

#1
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
profile picture

Eugene

#2
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.
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).