Runtime error in SetContext-based Strategy
Author: asurapan
Creation Date: 7/4/2012 11:32 PM
profile picture

asurapan

#1
I am trying to code a strategy that analyzes the NYSE Advancers Index and then trades a stock. Essentially, analyze symbol2 and trade symbol1.

The following code compiles but I run into a runtime error. Any idea what can be improved upon?

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

Eugene

#2
The logic of the trading part of the script makes it unconditionally buy on every bar whereas your original intention was different. Nonetheless, this is not required here as the script merely trades the primary Bars. One SetContext block for building the SMA of symbol2 would be enough:
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).