Do not execute strategy on particular symbol
Author: leeto
Creation Date: 6/5/2015 7:06 AM
profile picture

leeto

#1
How can I except particular symbol from my strategy execution.

For example, let take default strategy :

CODE:
Please log in to see this code.


I what to run the strategy on DOW 30 but without MCD . What should I add to my code ?

Many thanks in advance !
profile picture

Eugene

#2
This is a basic C# question i.e. a matter of adding an "if" to check for the symbol name for equality with a string. This FAQ may come helpful: How do I start with C# ? As Cone already suggested, the QuickRef tool is handy when you study the basics. In particular, the Bars object category where you shall find the desired Bars.Symbol property.

And an example from the opposite side i.e. when you want your script to trade some "green listed" stocks only:

Multi companies backtesting, see reply #7

However, it can be used for your task if you remove the exclamation sign:

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