How to skip an empty symbol when using GetExternalSymbol inside a loop
Author: adrian50697
Creation Date: 10/29/2015 6:22 AM
profile picture

adrian50697

#1
I'm attempting to test a strategy which creates a list and ranks the move of each symbol in a dataset, however if one of the symbols has no data the backtest breaks down and no trades are generated. Is there a way to skip the blank symbols ?

Here's the loop using GetExternalSymbol from my code..


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

Eugene

#2
Sure there is:
CODE:
Please log in to see this code.
profile picture

adrian50697

#3
Thanks Eugene, I tried your suggestion and it still doesn't seem to be working for me. I get the error "Error processing symbol AAK:SS Attempting to Deserialize an empty stream"
profile picture

Eugene

#4
profile picture

Cone

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

adrian50697

#6
Thanks!
profile picture

Panache

#7
I'm getting a strange result. I have a symbol in my Yahoo! DataSet (COV) for which there is no data. If I run Cone's code, on another symbol in the DataSet for which there is Yahoo! data, ie. AA, I don't get any error. However, if the DataSet only contains COV, and I run it on that symbol, the Chart shows "No Data Available".

I coded this another way to try to figure out what is going on and got an even more bizarre result.

CODE:
Please log in to see this code.


When I run this against a Yahoo! DataSet containing only AA (which exists) and COV (for which there is no data), not only does the symbol COV print twice, but it also prints a unique High[0] and Bars.Count! I get the same result whether I run the Strategy against AA or COV.

Is it possible that WealthLab is finding the data for COV from another data provider?

profile picture

Panache

#8
Yes, the problem is that WealthLab is looking somewhere else and finding data for COV. I tried replacing COV in my DataSet with some letters that I was sure were not a symbol, and both Cone's and my code worked as expected.

How do I prevent WealthLab from looking somewhere other than in my YahooStaticProvider/Daily directory to try to find data for a symbol? I tried modifying Cone's code as follows:

CODE:
Please log in to see this code.


and get:

Bars(AA,Daily,0,13556)
Bars(NOTASYMBOL,Daily,0,0)
profile picture

Eugene

#9
The GetExternalSymbol overload with DataSet name is the way to go. Then see my post #2.
profile picture

Panache

#10
Thanks. Here's my attempt to put this all together:

CODE:
Please log in to see this code.


Is there a more artful way to go through each symbol in the DataSet and only use the symbols for which data exists?

If I want to run this against more than one DataSet (which means I don't know the name of the DataSet), is there something I can replace "Yahoo" with that will cause it to only look at symbols in the current DataSet? I know the QuickReference says that doing this effectively is just specifying a data provider, but I'm concerned that this will result in a lot of computational overhead. If there are a lot of other Yahoo DataSets, does WealthLab have to search through each DataSet for the symbol, or is this just a directive to the YahooStaticProvider folder?
profile picture

Eugene

#11
QUOTE:
If I want to run this against more than one DataSet (which means I don't know the name of the DataSet), is there something I can replace "Yahoo" with that will cause it to only look at symbols in the current DataSet?

You could use DataSetName for that e.g.
CODE:
Please log in to see this code.
profile picture

Panache

#12
I tried that, and I get "error CS0103@(17,31): The name 'DataSetName' does not exist in the current context"

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

Eugene

#13
Sorry, I meant GetDataSetName. Assuming you've got Community Components installed, refer to it as simply this.GetDataSetName().
profile picture

Panache

#14
Thanks.

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