I am backtesting a strategy on a dataset of ETF's. I want to have one trade open on any day, and give preference to SPY first. So, if no SPY is open, then everything else is game, but still only one open symbol per day. How can this be done?
Thanks
Size:
Color:
1. "Max Entries Per Day" = 1 as PosSizer choice
2. Assign a Position.Priority in your Strategy in a way that SPY gets top priority. Check out the QuickRef entry for explanation and a code sample. The idea is to check the Bars.Symbol property and it it's SPY, assign the highest priority value.
Size:
Color:
Keeping in mind the
Open Issues, although Max Entries Per Day sizer backtests correctly, it Alerts with share size "0" always.
If you use % of Equity sizing, say, 95%, with 1:1 margin, you'll be sure to put on only 1 trade at a time. See the User Guide for what to expect when using 100% share sizing (first topic in the Index).
Here's a snippet for you. You only need to set the priority greater than 1 for SPY. If you don't set a priority, Wealth-Lab automatically sets a random priority value between 0 and 1.
CODE:
Please log in to see this code.
Size:
Color:
I got that to work. Thanks.
Size:
Color: