The following code, which I use as a chart setting, causes an unhandled exception error "Object reference not set to an instance of an object." What is this, and how can I correct it? The message only occurs sometimes and not others. I use it to configure a chart with the moving averages and indicator I use most often.
Thanks-
Rick
CODE:
Please log in to see this code.
Size:
Color:
From the Wealth-Lab Wiki FAQ on
Object reference not set to an instance of an object:
QUOTE:
Note: this is a pretty multifaceted error message - it can happen outside of a Strategy. But should you experience the run-time error in your Strategy telling you that "Object reference not set to an instance of an object", you need to know that there's a variable that has not been initialized, in other words it's null. Either you haven't assigned a value to some variable, or a method/function that you called has set the variable to null.
So, you need to tell us the missing pieces of the puzzle: like symbol and time frame.
Size:
Color:
OK. When this seems to happen is when I am streaming data in a chart, then I try to activate the strategy. When this happened, I tried closing the chart, re-open it, the data was still streaming because I had pressed <alt> <stream>, and tried to apply the strategy, and it gave the error message again.
Finally, I tried opening the strategy in a new strategy window, then clicked on the code tab, then selected the symbol with streaming data. That time the new chart appeared, and the window re-opened the code tab. When I clicked on the chart tab, the chart opened with no more problems.
Edited to add: This has happened on two different computers at the same time with the same code.
Any ideas?
Thanks-
Rick
Size:
Color:
Hi Rick,
Next time it happens, could you take a look at the details of this unhandled exception message?
Size:
Color: