"Object reference not set to an instance of an object" in Strategy Monitor
Author: joannakim
Creation Date: 12/2/2010 4:21 PM
profile picture

joannakim

#1
The above message appeared next to the strategies in the Strategy Monitor. I closed out of Strategy Monitor, exited WLP, and reentered, and then tried to do the daily update by clicking the "run strategy now." But the same messages appeared next to the strategies in the Strategy Monitor. I need this fixed very soon otherwise my paper account will not trade tomorrow morning which will wreck the longer term performance numbers. Thanks.
profile picture

Eugene

#2
Try deleting the StrategyMonitorConfiguration.xml file (User Guide > Data > Where data are stored?)

As an alternative, try removing all the strategies from SM and re-enter them again one by one.
profile picture

joannakim

#3
OK, Eugene. I will give it a go. Thanks for the swift response any way.
profile picture

joannakim

#4
Eugene, I can't find "where data are stored" in User Guide>Data. What should I do?

also I tried removing and then re-entering all the strategies in SM, but I still get the same error message.
profile picture

Eugene

#5
QUOTE:
I can't find "where data are stored" in User Guide>Data. What should I do?

In this case, reading the "Data" page carefully to the end could help; it's at the bottom. Follow the instructions once found, enable hidden file/folder visibility, close Strategy Monitor and delete that XML file (no need to restart WLP). Now...

Is there a particular strategy that produced that message? Or two? Or all? Before adding your own strategies to SM, what if you just add only some built-in strategy on Dow 30 Daily?

Was there a specific DataSet involved? Or many? Or didn't matter? If some specific one, which data provider? Or maybe it happens with some individual symbols?

Where is the message, under "Actions"? Or is it an exception message box? In this case, click "Details" to copy/paste the complete error message.
profile picture

joannakim

#6
I found the section on data page. thanks.

I have one strategy populated 5 different times in SM with different equity per position settings for each paper account that it is assigned to, and they were all showing the same error messages at the end of the strategy description. All strategies were tied to the same data set: a data set of about 2700 US stocks on all exchanges with some volume filters. the data provider was Fidelity.
The "object reference not set to an instance of an object" message appears on Action column for all 5 ( in this case the same) strategies.
profile picture

Eugene

#7
First thing to check is the validity of your Benchmark Buy & Hold symbol:

Object reference not set to an instance of an object

If it's OK then it might look like a problem with some particular symbol's data and your specific strategy. Wiki article above should give some pointers for your manual troubleshooting of the strategy. I'd start by running it manually on the same DataSet of about 2700 stocks.
profile picture

joannakim

#8
I went into Data folder in my Windows 7, but don't know how to enable hidden file/folder visibility. There is no Tools option on the menu bar like the instructions on the User Guide. If you would like, I can create a support ticket, and send you a screen shot of all the files listed under the Data folder.
profile picture

joannakim

#9
I don't understand how to check the validity of my Benchmark Buy and Hold symbol.
profile picture

joannakim

#10
"If "Benchmark Buy & Hold" symbol is defined and enabled in the Wealth-Lab's Preferences dialog, Backtest Settings,"

The Benchmark buy & Hold is not checked off in the box to the left in the Preference dialog box in WLP. Should I check this? What should I enter in the box next to "Symbol" in this dialog box because I am using about 2700 stocks in my data set.
profile picture

Eugene

#11
QUOTE:
I went into Data folder in my Windows 7, but don't know how to enable hidden file/folder visibility.

Google is a great source of advice on this matter. Also you might find helpful checking your Windows 7 built-in Help or calling tech support.
QUOTE:
The Benchmark buy & Hold is not checked off in the box to the left in the Preference dialog box in WLP.

If Benchmark B&H is disabled then simply disregard this part and move on to my next idea.
profile picture

Eugene

#12
QUOTE:
I went into Data folder in my Windows 7,

Just FYI: No you didn't. One simply can't get there unless hidden file visibility was enabled first; otherwise you went to the 100% wrong Data folder. Furthermore I don't understand why would you want to get there at all as I can't remember suggesting that.

As said above, let's start by running the strategy manually on the same DataSet that produces error in the SM to see if there's any difference and/or error message in Debug log.
profile picture

joannakim

#13
I exited from WLP, deleted the .xml file that you wanted me to delete in the Data folder, got back into WLP, and tried to run the strategy, and I got the same error message. As to your asking me why I would want to get to Data folder, that was because I wanted to delete the .xml file that you wanted me to delete which was in Data folder which I did delete, and this didn't do anything.

And like I told you earlier, I also removed all the strategies in SM, and re-entered it one by one, and ran the strategies, and that produced the same error message once again too. I did not understand what you said about Debug log. Is that something that I should also try now?

And as to the hidden folders issue, my Windows 7 already had the enable hidden folders/files visibility box checked off, so I always had the hidden folders/files visible. As to manually running the strategies on the same data sets, I already did that several times: after I re-populated the SM with the same strategies and also after deleting the .xml file that you wanted me to delete, and I still get the same error message.
profile picture

Eugene

#14
QUOTE:
deleted the .xml file that you wanted me to delete in the Data folder,

This is a misconception, never did I instruct to delete any files and I have no idea where this is coming from.

Sorry if I wasn't clear enough but I wanted to see if running the strategy manually by opening it in a Strategy window on the same DataSet that produces error in the SM would make any difference and/or error message in the Debug log. There could be some specific symbol involved.

Also try copy/pasting just the affected strategy's code in a new strategy window, saving it w/o anything else (dropped indicators etc.), and running this one in the SM.
profile picture

joannakim

#15
Eugend, please revisit your instructions made on 12/2/2010 at 4:36 PM: your very first response to this issue.
profile picture

Eugene

#16
Right but we already disregarded that one and moved on because you manually removed the strategies from the SM.
profile picture

joannakim

#17
Eugene, running the strategy manually in the Strategy window is back testing. The problem in the strategy monitor did not occur while trying to back test. The problem occurred when the strategies were running to collect the alerts for the next day's possible trades.

I did, however, just ran a back test for 1 year with the same data set as that used in the SM, and the test seemed to have run fine, but once again, the problem did not arise when trying to back test.
profile picture

Eugene

#18
Is there a difference in the data loading range between SM / strategy window?
profile picture

joannakim

#19
I think so. Because when I just tried to back test, I changed the Data Range from 14 years ( the way it was) to 1 year because I did not want the back test to run for a long time.
profile picture

Eugene

#20
14 years of loaded data in Strategy Monitor before, did I misread?

Please enter a support ticket including the original strategy and DataSet XML files.
profile picture

joannakim

#21
I backtest on 14 years Data Range all the time without any problems. My strategy is on daily so it is not as many bars as you might think. And I have a relatively powerful computer which backtests on 14 years within a minute. it seemed like there was nothing to it for a very long time until a few days ago when this happened. Neither the Strategy window nor the SM window gave me any problems prior to this. I will open a support ticket.
profile picture

joannakim

#22
Correction: my Strategies in the SM had ranges of only 3 months ( under the Range column.) They did not have 14 years as ranges.

I was reading the Data Range on the upper left corner of the WLP before because that was what applied to back testing, and when I ran a back test yesterday on the Strategy window, I did change that to 1 year before running the test.
profile picture

Cone

#23
Someone else just posted a similar problem and said it was related to the data range selection. Instead of using "Most Recent 3 Months", calculate the approximate number of bars for the scale you're running and change the strategy activation settings to use that Number of Bars. If that helps, we'll have something to go on.
profile picture

joannakim

#24
I just changed the Strategy Activation Settings from 3 months to 90 bars, and it is producing the same errors.

I am truly sick and tired of so many problems that WLP is giving me on an on-going basis which has been mopping up massive amount of my time. I cannot and should not operate like this any longer. the customers are paying for WLP access, and we are paying for all the glitch fixings that WLP has to go through. This is truly unfair and unprofessional. Please give me the most researched-and-final solution to this problem so that I don't have to go through a slew of suggestions consuming time that I truly do not have. And then we can move on the the next problem that is already here. Thanks.
profile picture

Eugene

#25
Final solution implies at least being able to reproduce the issue that happens to (just) you. Sorry, did I miss your ticket with detailed bug report as per our support policy? The provided strategy code could've helped us understand, for starters, whether 3 months (90 days) of data are enough or not. Other facts mentioned in the ticket might have been helpful, such as have you already tried running the strategy in SM on a different DataSet rather than the "DataSet of about 2700 stocks", and your findings.
profile picture

Cone

#26
We don't see or understand what causes this particular "Object ref not set" error. The only way we'll be able to help is if you're able to provide the set up conditions that lead to the error. Another option that we should try is use logging for troubleshooting. If the programmers can determine which object isn't being set, the solution (or at least a work-around) could be evident. There's a short procedure to do to turn on logging, so please create a ticket if you want to pursue it.

We've been as responsive as possible to your problems, and believe me, I'm sorry that we cannot resolve them all immediately.
profile picture

joannakim

#27
Following Eugene's suggestion, I changed the data set that the strategy on the SM were using: from my custom data set of about 2700 stocks or so to Nasdaq 100. Then I exited the SM window, re-entered it, and clicked on "run strategy now," and I got the same error message.

In light of this latest event, do you have any new suggestions or should I go by what Eugene already suggested about a support ticket? Thanks.
profile picture

Eugene

#28
We need a support ticket.
profile picture

joannakim

#29
ok. Also 90 days of data is sufficient, I believe, for my particular strategy. When backtesting the strategy seems to need about a months' data to start producing profit/loss results.
profile picture

Cone

#30
I've reviewed the whole thread. The thing I'm keying on is this: "I have one strategy populated 5 different times in SM .. The "object reference not set to an instance of an object" message appears on Action column for all 5"

Let's do a quick test to make sure that you can get some strategy to run without error. Set up "Glitch Index" (in the Counter-Trend folder) to run on the Nasdaq 100 like in your prior test and "Run this Strategy now". Any errors?

If not, there's a good chance there's something in your script that's incompatible with the Strategy Monitor. The only thing that I can think of off hand that would fit that description would be attempting to reference a ChartStyle-derived class that is available only in the Strategy/Chart Window. Examples of these types of scripts include "Line Break Basic", "Kagi Basic", and "Renko Basic".
profile picture

joannakim

#31
"Please enter a support ticket including the original strategy and DataSet XML files"
Eugene, when you say "original strategy," do you mean the code copied from the Editor in Strategy Window? Thanks
profile picture

Cone

#32
It's best to zip and include the Strategy's actual XML file from the ..\Data\Strategies\.. subfolder. In fact, so that we can duplicate precisely your setup, zip all of the following together:

1. The Strategy's xml file (from the ..\Data\Strategies\.. subfolder)
2. StrategyMonitorConfiguration.xml (from the ..\Data\ folder)
3. The DataSet xml file for the 2700 stocks (from the ..\Data\DataSets\.. subfolder)
4. WealthLabConfig.txt (from the ..\Data\ folder)

Please run the test suggested in my previous post first though!
profile picture

joannakim

#33
I added Glitch Index into my SM with Nasdaq 100 as the data set, and assigned it to a paper account (no. 1), then activated the strategy, then enabled the Auto-Place. After that, I clicked on Run This Strategy Now. The error message did not appear in the Action column of SM like it did for my other strategies, but no alerts or trades are showing up for Glitch Index.
profile picture

Cone

#34
Interesting. The results will depend on the "SMA Period" setting, but if it's set to 20, I get 139 trades and 2 Alerts (WYNN and GOOG) for the Nasdaq 100 over 90 bars.

At least you don't get the Object error, but it still a problem if you don't show any Trades for it either. Let's continue with the ticket and information requested above.
profile picture

joannakim

#35
I don't know about the SMA period in Glitch Index, but I see " (30)" under the Parameters column in the SM for Glitch Index. Is that the SMA period? If so, can I change that to 20?

also I don't know if this would make a difference, but the strategies that were there in the SM had worked fine without producing the error message for a while, so I don't understand how the problem could be coming form the code, do you?
profile picture

Cone

#36
QUOTE:
If so, can I change that to 20?
Sure, just "Change Settings" and change the Strategy Parameter that says "SMA Period" next to it. Anyway, with 30, there are still trades, but not Alerts as of yesterday's close.

QUOTE:
I don't understand how the problem could be coming form the code, do you?
No, if we understood where all of the trouble was coming from that you are having, it would already be solved.
profile picture

joannakim

#37
I think I might have resolved the issue. There seemed to be some extraneous stuff in the code that did not seem to belong there. I removed it, and re-entered the strategy into SM, and clicked Run Strategy Now, and it seemed to have generated alerts for tomorrow's possible trades. I will continue to monitor this, and see if the paper account really trades as it is supposed to tomorrow and beyond.

Now, if I could only get the paper accounts to consistently exit all positions at market open, the quality of my life would greatly improve. Like I said earlier, some times, the paper accounts will exit all positions at the market open like they are supposed to but at other times they will exit from some positions and not from the other(s) or not exit from any positions at all at the market open. Do you have suggestions? Thanks.
profile picture

Eugene

#38
For the record, can you tell us what exact extraneous stuff was producing a warning message in the Strategy Monitor while executing properly in a strategy window?

P.S. Please discuss paper accounts in other thread.
profile picture

joannakim

#39
There were some meaningless alphabets typed next to the word Wealthscript in the line describing a class. I don't know how they got there, but my guess is that I might have had the Editor open, and some accidental typing occurred while the cursor was at that location. I will discuss the paper account issue separately a little later. Thanks a million.
profile picture

jalalfeghhi1

#40
Eugene,
Good morning. I am running into the following problem with Strategy Monitor:
1- When I add my strategy to the Chart window via the link "Open Strategy", everything is fine
2- When I open up Strategy Monitor, add my strategy, and activate it, everything is fine.
3- However, if I do step 1 first, and then click on the link "Monitor Strategy", then Strategy Monitor complains about "runtime error: object reference not set." I traced the error in my debugger and noticed that the Bars object in this case is NULL.

Do you know what is going on? I do not see any issues with my code as it works in steps "1" and "2".

-thanks, J
profile picture

Cone

#41
No idea. What are:
1. all of the Data Tree control settings (Scale, Data Range, Position Size)
2. which symbol or DataSet is selected
3. what is the Scale of the DataSet? (It might be different than what is selected in the Data Control)
profile picture

Eugene

#42
4a. Does the problematic Strategy make use of global memory, DataSetSymbols, class level variables, anything else worth mentioning?
4b. What about other (bundled) Strategies e.g. "Moving Average Crossover"?
profile picture

jalalfeghhi1

#43
Eugene,

4a-No global memory. I have many class-level variables. I haven't used DataSetSymbols but will be in a later version.
4b-It seems to be working fine with Moving Average Crossover.

-thanks, j
profile picture

Eugene

#44
Jalal,

Let's take the guesswork out: can you show us some brief skeleton code to reproduce the effect?
profile picture

jalalfeghhi1

#45
Cone,
1-When I click on Monitor Strategy, it just adds the strategy to the Monitor Window, I don't change any of these settings. They are 1-min, 3 months, and $5000
2-I have selected a symbol, not DataSet
3-Both are 1-min

-thanks, J
profile picture

jalalfeghhi1

#46
Eugene,
We have over 5000 lines of code, let me see how I can put something meaningful together :-)

-j
profile picture

Eugene

#47
Please note that we don't need the whole Strategy (troubleshooting it is not covered by our support policy), just the troublesome part to reproduce the effect in case it's a WL bug. Since you have that much lines of code, I'm pretty sure it's a bug in your code.
profile picture

jalalfeghhi1

#48
Eugene,
Let me look into this again, thanks.

-j
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).