I have a strategy that uses the GetExternalSymbol method. It works in backtesting, however doesnt generate any alerts when run from strategy monitor. Debugging the code when run from the strategy monitor shows the Bars object is not set by the GetExternalSymbols method (null), thus throwing an "Object reference not set to an instance of an object" exception .
I see there are similar posts regarding Strategy Monitor not generating alerts, and in some of the cases the GetExternalSymbols method is also being used in the code. Is there a fix/ work around?
Size:
Color:
What is your data provider? Are we talking about accessing the data from a different provider, or the Bars object loaded by GetExternalSymbol belongs to the same provider? Also, what is the time frame and would you mind posting a relevant code snippet?
Size:
Color:
Data provider: Y!. I am trying to accessing data from the same provider, however it is in a different dataset ("Indices"). Timeframe is daily.
CODE:
Please log in to see this code.
SP500 object set to null after method is called (when run from strategy monitor). SP500 object set to ^GSPC bars (when run from back test).
Size:
Color:
There is a live bug (WL5.6) in GetExternalSymbol when you're using the DataSet overload for the external symbol (like in your synthax). So it's a good idea to not use it when possible.
Since you're using the same data provider, you might want to simplify this; does this help?
CODE:
Please log in to see this code.
Size:
Color:
Yes it works when the Dataset overload is removed. However loading the external symbol for every symbol in a dataset increases the strategy monitor scan time considerably. Looks like I'll have to load the external symbol into global memory on the first symbol of the dataset and access it from there. Thanks for the help.
Size:
Color:
Size:
Color:
This code will execute once on a dataset and will still execute when run against any symbol in a dataset. (ie. it is not dependent on being triggered by the first symbol in a dataset).
CODE:
Please log in to see this code.
Size:
Color: