pass in multiple symbols
Author: jaredm
Creation Date: 9/29/2010 11:50 PM
profile picture

jaredm

#1
I have a pairs trading script where one of the symbols is hard-coded, e.g.
CODE:
Please log in to see this code.

I have a list of pairs and I want to examine the strategy's equity curve for each pair, one by one. My first thought was to create a dataset with fake symbols, like "ABC-DEF" and "ABC-GHI" and inside the strategy parse the fake symbol into its two parts. That doesn't work of course b/c entering "ABC-DEF" as a symbol gives you "No Data Available" before the strategy even runs.

Any suggestions or ideas for easily viewing the equity curve for a list of pairs without having to change & recompile the code each time?

Thanks,
Jared
profile picture

Eugene

#2
Out of the many possibilities, one obvious one is to fill a Dictionary< string,string > with your pair symbols and look up the corresponding symbol's name as yourDictionary[Bars.Symbol].
profile picture

jaredm

#3
Thanks. I went down that route and the problem I ran into is for a given symbol, there are often more than one other symbols I want to pair with it. For example, I want to check out the equity curve for StockA,StockB. Then StockA,StockC.
profile picture

Eugene

#4
Off the top of my head: you could create a custom data structure that returns a List< string > for a given symbol, and then set up a StrategyParameter (integer) tied to the List.Count. Then it would be a matter of scrolling to select another symbol for the pair. And to not lose track of the pair, it could be drawn on the PricePane.
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).