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.
Size:
Color:
Size:
Color:
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 strategiesIntraday Support Functions
Size:
Color:
Yes, separating entry and exit ordersinto their individual symbol iteration loops does resolve the issue. Thanks Eugene
Size:
Color: