Object reference not set error
Author: sedelstein
Creation Date: 9/5/2013 8:51 PM
profile picture

sedelstein

#1
I've downloaded 1-minute TIC.O (Nasdaq TICK data) and want to highlight bars on a stock when TIC is below a value. Not sure when I run it on a symbol I get the object not set message.

specifically the error occurs
at WealthScript.SetContext (string symbol, Boolean synchronize)
at WealthLab Bars.ctor(Bars b)

code seems straightforward. What am I missing.



CODE:
Please log in to see this code.
profile picture

Eugene

#2
Errors | Strategy > Object reference not set to an instance of an object

In adition, you might want to turn off on demand data update if enabled.

Amazing but now, every other poster of this forum has started her or his own thread called "Object reference not set error". (Takes a second to search to prove it.) And there's food for thought in these topics, too.
profile picture

sedelstein

#3
I've looked in Preferences and Data Tool for "Demand Data Update" and don't see it. Can you shed some light.
Not to be too thick about this, after reading the posts, I still don't see what's going on.
The data exists for both symbols
Benchmark buy and hold is turned off
profile picture

Eugene

#4
QUOTE:
I've looked in Preferences and Data Tool for "Demand Data Update" and don't see it.

How about looking in the User Guide? It's in the Data Manager.

QUOTE:
The data exists for both symbols

Probably not in the requested bar scale?

Also, you might want to try the other GetExternalSymbol overload accepting DataSetName as a parameter. Sometimes this switcheroo helps.
profile picture

sedelstein

#5
I've tried the other Get External Symbol

Here is my code now
CODE:
Please log in to see this code.


It works for QQQ at the one minute scale and it works for TIC.O at the one minute scale. Both are in a dataset called "TICK Data"

This code
CODE:
Please log in to see this code.


generates an index out of range when I run it on the symbol QQQ.

It's very unclear to me what is going on. Is it obvious to anyone else?
profile picture

Eugene

#6
1. Have you tried Synchronize'ing the tic Bars?
2. Tried pasting the code in a blank window (w/o leftover drag n' dropped indicators)?
profile picture

LenMoz

#7
Perhaps see what a display of the counts shows you
CODE:
Please log in to see this code.

profile picture

sedelstein

#8
Thanks LenMoz

Tried it and it won't even get that far as producing the debug window before it errs out.

Weird. I know the data is there

profile picture

sedelstein

#9
ah OK

tic.count = 0 which explains the error but I'm sure the data is there. I can graph it etc...

profile picture

Eugene

#10
QUOTE:
Tried it and it won't even get that far as producing the debug window before it errs out.


Data on demand is enabled. Wealth-Lab tries to download the symbol's data from Fidelity on demand, hence the delay. The data was not there.

Uncheck update data on demand, update the DataSet manually, and retry.
profile picture

sedelstein

#11
Went into the Update Data tab in the Data Manager. Unchecked On Demand Data Updates, lower right corner of the screen
Updated Data manually


Exited WL, Re-opened and ensured the selection above remained unchecked

Re-ran the code above and still got tic.count = 0

Might you have another suggestion?

Thanks for the help once again

I'm a little unsure how to "synchronize" the data to see if that helps.
Might you have a code snippet to add to the above demonstrate. I've done a search and I am a little unclear

There are no indicators attached to the strategy or chart
profile picture

Eugene

#12
What data loading range is this? Tried changing it?

QUOTE:
I'm a little unsure how to "synchronize" the data to see if that helps.
Might you have a code snippet to add to the above demonstrate. I've done a search and I am a little unclear

Have you done a search in the QuickRef and WealthScript Programming Guide? ;)

CODE:
Please log in to see this code.


profile picture

sedelstein

#13
Got it

Thank you for your help
profile picture

LenMoz

#14
What was it, so we can learn from this?
profile picture

sedelstein

#15
Embarrassed to say it but it in the interests of being honest and fair to the helpful folks here, it was a typo on my part.
The symbol TIC.O actually has a decimal in front of it that I missed, it's .TIC.O and I just didn't see it and of course when I clicked on it I did get graphs etc...

I guess the takeaway is if you get Object Reference Not found or the bar count is zero, ensure you are not working with a funky ticker and that it actually exists.

I hope that that this means that no one else makes this error and that the time spent wasn't a complete waste.

Thank you again Eugene and LenMoz.

:-<(
profile picture

LenMoz

#16
Ouch, that was a palm to forehead moment. Thanks for closing the loop.
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).