Trading multiple symbols intraday
Author: swappro
Creation Date: 8/16/2017 10:50 AM
profile picture

swappro

#1
I have a DataSet with 2 symbols and 1 minute intervals. I'm trying to establish a position in each symbol at a particular time of day, and hold the positions for 1 day, then Exit the positions at market.
I have a loop that iterates over all the DataSetSymbols and creates the trades, but the trades end up being created for consecutive days and not for the same day.
I'm attaching the script and the Trade list.
Your help would be greatly appreciated.
Thanks

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

Eugene

#2
QUOTE:
but the trades end up being created for consecutive days and not for the same day.

Please have a look at this KB article, it might turn out helpful in your case:

WealthScript Techniques | Portfolio-wide conditions
profile picture

Cone

#3
Goodness gracious, it looks like you're trying to do it the hardest way possible! It doesn't appear to me that trading one of the symbols has a dependence on the other, so there's no need to use DataSetSymbols.

Instead, just write the script as if you were trading any symbol. If you must SetShareSize instead of using another PosSizer, then you can test which symbol is being executed by evaluating Bars.Symbol.

Also, using AddDays() probably isn't a good idea. Test how old the position is, for example. Here are some links to useful patters for intraday Strategies (some methods may required Community.Components) -

Intraday | Building blocks of Intraday trading strategies
Intraday Support Functions
profile picture

swappro

#4
Yes, separating entry and exit ordersinto their individual symbol iteration loops does resolve the issue. Thanks Eugene