Using two or more indexes in strategy?
Author: mikesblack
Creation Date: 2/21/2013 9:06 PM
profile picture

mikesblack

#1
CODE:
Please log in to see this code.


Would like to call on both indexes. How may I accomplish this.
profile picture

Eugene

#2
For example, like in the WealthScript Programming Guide > DataSeries > Accessing Secondary Symbols.

If you can be more specific on the purpose of calling, I'll expand.
profile picture

mikesblack

#3
I'll do my best. Thanks for the help.

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

Eugene

#4
Thanks for the clarification, but again it doesn't seem to explain to me what's your problem/task is. Are you looking to enter trades on a symbol different from the symbol being charted? Then you might want checking out SetContext/RestoreContext.
profile picture

mikesblack

#5
Sorry for not explaining the error. When I run a back test with the DataSeries bm2cl = (Benchmark2.Close ); I am getting" object reference not set to an instance of an object"for all symbols( multi symbol back test). I am using .spx in my trading system and would like to first, refer to the second index in the trades tab, priority name( second index close). Later I might like to use both indexes for trading rules. As it is now just having the above data series written into the editor produces this report, with no trades being created in the back test. This holds true over all time frames and data series.
Hope that makes it clear. Thanks.
profile picture

Eugene

#6
This error is nothing new. Take a look at the Errors section in our Knowledge Base:

Errors | Strategy > Object reference not set to an instance of an object
profile picture

mikesblack

#7
Right. I can not derive a solution based on this text Eugene. Please suggest if I am missing something below. Where prey tell am I going wrong. Is there anything glaringly obviously incorrect to you? What am I missing? Thank you kindly.
profile picture

Cone

#8
Either you don't have data for "VIX or it's not located in the DataSet named "CBOE Put/Call Ratio !!"

Just for something different, try ".VIX"
profile picture

mikesblack

#9
Thanks, but no joy. I am able to produce charts so I know I have the data. I called the " CBOE PUT/Call Ratio" that spelling, as it is in the data manager.
profile picture

Eugene

#10
What if you use this?
CODE:
Please log in to see this code.
profile picture

Cone

#11
In the starter thread, there's an error in the code - you were requesting the wrong symbol:

CODE:
Please log in to see this code.

However, that was corrected in your next post, but then you change the name of the DataSet, you said " CBOE PUT/Call Ratio". Is there really supposed to be a leading whitespace here?

I ran this code with my own simplified names of the DataSets. It executes without error and plots the primary and both secondary symbols perfectly.
CODE:
Please log in to see this code.
Side note: "VIX" is not really meant to be used as a benchmark!
profile picture

mikesblack

#12
Thank you very much. I will continue to work on it.
profile picture

mikesblack

#13
At this point I am unable still to use two indexes in my system; however I was able to use VIX only rather than .SPX. Not completely clear where in my code there is a particular problem.
profile picture

Eugene

#14
Like Cone in #15, I verified that your code from #3 will work in 6.4 w/o issues provided that the symbols and DataSets are typed in precisely and the data exist.
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).