One trade per day and give preference to SPY
Author: cmtn
Creation Date: 6/6/2019 7:17 PM
profile picture


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?

profile picture


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.
profile picture


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.

Please log in to see this code.
profile picture


I got that to work. Thanks.
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).