Run time error with an intraday streaming strategy
Author: ss161
Creation Date: 12/4/2009 2:27 PM
profile picture

ss161

#1
I intermittently get the following error with an intraday streaming script:


I think this happens if / when my wireless internet briefly goes down and then immediately comes back up. Does that make sense? even so, any ideas why the internet going down would create that runtime error.

Thanks
profile picture

Eugene

#2
Here's what our Wiki knows about this error: (scroll down to) Object reference not set to an instance of an object. Something becomes null during this net hiccup...
profile picture

ss161

#3
Yes, i understand that part, and in general, can quickly debug those errors when they are caused by my code. In this case, the error seems to be generated somewhere in the code of SetBackgroundColor.

I use SetBackgroundColor in the script twice and in both instances call it with Bar (not Bar+1).
profile picture

Eugene

#4
Does it happen for this single strategy only? Could you also specify the symbol and time frame?
profile picture

ss161

#5
Hi, yes, for this strategy only. Symbol = FAZ, timeframe = 1 minute bars.

this is the only strategy that i am running with streaming mode on any intraday time frame. for most of my stratgies, I'm creating "ghost bars" outside of wealth-lab to run them in real-time. so while the answer above is yes for this strategy only. this is the only strategy that is running on a streaming basis.

Here is a code fragment:
CODE:
Please log in to see this code.

profile picture

Cone

#6
Try troubleshooting more by just removing the SetBackgroundColor statements for a day or two, or maybe better, just catch the error. If I remember to do it, I'll try running a simple script with SetBackgroundColor throughout the next trading day to see if that alone is the problem.
profile picture

ss161

#7
Sure, I can do that. Normally when I trap for an error, it is something I'm expecting so I just ignore it and continue executing my code (such as data not present for a symbol, so i skip the symbol). Is there generic code available that will dump the error once trapped via PrintDebug statements?
profile picture

Eugene

#8
Something like this:
CODE:
Please log in to see this code.
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).