Stocks & ETFs: setting up an RSL strategy
1. Overview
OptionsApp sets up RSL strategies in the "RSL" tab under "Configuration", group "Stocks & ETFs". An RSL strategy ranks the members of an index by their RSL value, holds the strongest titles and rotates at a fixed time. The orders go to Interactive Brokers as market orders. What the RSL strategy is and how it works is explained in the glossary article RSL strategy. This article describes the settings in OptionsApp.
Requirements:
- Real-time market data for US stocks at Interactive Brokers. OptionsApp does not use delayed prices.
- OptionsApp and TWS are running and connected at the rebalance time.
- Every newly bought title counts as an opening in the monthly allowance for stocks and ETFs. Sales, reductions and top-ups do not count.
All times are New York time, even if the computer or TWS is set to another time zone. The trading calendar is the NYSE calendar, including holidays and shortened trading days.
Where the RSL strategy comes from and how relative strength according to Levy is calculated is explained in the glossary: RSL strategy.
2. Creating and managing a strategy
At the top of the tab, "Selected Strategy" shows the chosen strategy. The buttons next to it create, rename, duplicate or delete a strategy. The import and export button transfers RSL strategies as a file. A strategy name may be used only once across the "Seasonals & Signals" and "RSL" tabs.
A new strategy starts with empty fields. OptionsApp does not preset any values. The "Settings" button on the right folds the settings in and out.
The row below holds three settings:
- "Activate" switches the strategy on. An active strategy trades at the rebalance time without further confirmation. A strategy that is switched off is only ranked in the tab, no orders are sent.
- The account selection sets the Interactive Brokers account the strategy trades in.
- "Capital" is the amount in US dollars the strategy trades with. It spreads it over its positions. The target of each position is a share of this capital, not of the account value. What happens with gains and losses is set by the capital basis (section 4.3). Only whole shares are bought, always rounded down. If another display currency is set, the equivalent in that currency appears behind the field.
A strategy can only be switched on once all required fields are set. If an active strategy later lacks a setting, "Not complete" appears next to the switch, the missing fields are framed in red, and the strategy does not trade. With a capital of 0 the strategy places no orders.
3. Basic settings
The basic settings are arranged in three rows: "Universe", "Ranking" and "Rebalance".
| Field | Values | Effect |
|---|---|---|
| Index | S&P 500 (US) or NASDAQ 100 (US) | The members of this index are ranked. |
| Sectors | single sectors or "All sectors" | Only titles of the selected sectors are ranked and bought. "All sectors" takes the whole index. |
| RSL period | 4 to 104 weeks | Period of the average. A title's RSL is its last weekly close divided by the average of its weekly closes over this number of weeks. Rank 1 has the highest RSL. |
| Hold top | 1 to 50 | The number of titles the strategy holds. The capital is spread over this number of positions. |
| Sell below rank | 1 to 500 | A held title is sold as soon as its rank drops below this value. Until then it stays. A value above "Hold top" keeps positions through small shifts in the ranking, so fewer orders are placed. |
| Frequency | Weekly, Every 2 weeks, Monthly | How often the strategy ranks and trades: every week, once in every 2-week block or once a month, each time on the selected weekday. |
| Day | Monday to Friday | Weekday of the rebalance. |
| Time (NY) | 09:35, 09:45, 10:00, 15:30, 15:45, 15:50, 15:55 | Time of the decision, New York time. The late times are shortly before the close at 16:00. |
OptionsApp ships the member lists of both indexes. For the indexes of active strategies it compares the list once a day outside trading hours with the publicly maintained member list. It takes over a change only when two days agree. New members are then ranked as soon as their prices are loaded. Titles that left are no longer ranked, and a held title that left the index is sold at the next rebalance.
The weeks of the ranking end on the selected weekday. With a rebalance on Wednesday, Wednesday's close counts as the weekly close, not the Friday before.
The info icon behind "Sell below rank" shows the formula and a summary of the rules that are set.
4. Advanced Settings
The "Advanced Settings" button at the end of the "Rebalance" row opens the further settings in three areas: "Positions", "Capital" and "Regime". The number on the button counts what is switched on or changed.
4.1 Weighting
"Equal" gives every position the same amount. "Inverse volatility" gives a higher weight to titles that fluctuated less over the last 20 weeks and a lower weight to titles that fluctuated more.
4.2 Volatility target
"Off" or a value from 20 to 40 %. At the rebalance, OptionsApp measures how much the new positions fluctuated together over the last 63 trading days, annualised. If the fluctuation is above the set value, it scales all positions down by the ratio of target to measured fluctuation. The rest stays as cash. If the fluctuation is below, nothing changes. More than the capital is never invested. With "Let them run" (section 4.3) the target acts on new purchases only.
4.3 Capital and capital rules
In the "Positions" row, "Capital" sets how the amount in the "Capital" field is meant:
- "Whole strategy": one amount for all positions together.
- "Per position": the amount of one position. The strategy's capital is then this amount times "Hold top", and the calculation appears behind the field, for example "per position × 10 = 10,000 $". This choice exists only with "Equal" weighting.
The "Capital" row holds three rules:
| Field | Values | Effect |
|---|---|---|
| Basis | Fixed, Fixed, no refill, Compounding | What the position targets are sized on. "Fixed": the capital entered; the next rebalance fills a loss up again from the account, a gain stays out. "Fixed, no refill": the capital entered, but never more than the strategy capital, so a loss is not filled up from the account. "Compounding": the strategy capital, that is the capital entered plus the result of the strategy's trades from the moment this is chosen; the positions grow and shrink with the strategy. With the last two the strategy buys from its own cash only. |
| Held titles | Back to target, Let them run | What a rebalance does with a title that stays in the portfolio. "Back to target": it is cut or topped up to its target every time. "Let them run": its shares stay as they are until it is sold; only new titles are bought. Switching back brings every title to its target at the next rebalance. |
| New purchase | Target share, All free cash | The size of a new title, only with "Compounding" and "Let them run". "Target share": its share of the strategy capital, at most the free cash. "All free cash": the new titles of a rebalance share all the free cash of the strategy; a single new title can get a multiple of its share. |
With "Compounding", the strategy capital line appears behind the "Capital" field, for example "Strategy capital 12,340 $ · result +2,340 $ · invested 11,900 $ · free 440 $". Once the strategy has traded, the field is locked. Capital is then paid in or taken out with "Change…". The dialog shows what the strategy is worth today and what the next rebalance would do with the amount. The change acts once, at the next weekly run, and is not a target OptionsApp keeps. At most the money paid in can be taken out, never the whole strategy capital.
4.4 Regime filter
The regime filter is a condition of your own that has to be met for the strategy to be invested. It has two parts:
- "on": the underlying the condition is checked on, selected with "Pick underlying", for example SPY.
- "when": a condition of type Filter.
The "Filter Conditions" button next to it opens the strategy's list of filters. Filters are created, edited, copied and deleted there. They are the same entry conditions as in the "Seasonals & Signals" tab, here only of type Filter. How conditions are built is described in Stocks & ETFs: conditions and indicators.
If the regime filter is not met at the rebalance, the strategy sells all positions and buys nothing. The capital stays cash until the condition is met again at a later rebalance or daily check. A condition that cannot be read trades nothing. If the filter is switched on without an underlying or a condition, the tab shows "Regime filter not set up".
4.5 Daily check and re-entry
Without "Daily check", the strategy checks the regime filter only at the rebalance. With "Daily check", it also checks it on the other weekdays at the time set under "at" (New York time). Section 8 describes what happens then.
"Re-entry" sets which titles come back once the regime filter is met again:
- "The top titles anew": a rebalance in the meantime picks the top titles of its day.
- "The continued book": the rebalances keep the last portfolio up to date under the holding rule, as if it had been held, and exactly that portfolio comes back. It can hold titles outside the top, down to "Sell below rank".
5. Loading price data
For the ranking, OptionsApp needs the daily closes of all index members. It loads them through TWS from Interactive Brokers. Everything about the price data is in the row under the ranking:
- On the left, the state of the data, for example "Daily bars up to 20.11. · 100 % fresh". During a load the progress and the time left appear there.
- "Load daily bars at" sets when the daily prices are loaded (16:30 to 23:00). This applies to all RSL strategies together. Prices are loaded after the close on the trading day before an active strategy's rebalance. On the other days, the ranking uses the closes TWS delivers once a day.
- "Refresh data" matches the index members at Interactive Brokers and loads their daily prices right away. While it loads, the button reads "Stop". The "Data" column shows the state of each title's prices. The first load for the S&P 500 takes considerably longer than for the NASDAQ 100 because of Interactive Brokers' request limits.
If OptionsApp missed a load, it catches up at night or at the weekend, never during trading hours. The load shares Interactive Brokers' request limits with the entry conditions of running strategies.
A rebalance only runs if at least 95 % of the index members have current prices. Titles without current prices are not ranked that week.
6. The ranking
Below the settings is the ranking of the index. It shows how the strategy would trade on the stored prices. At the rebalance, OptionsApp decides on the live prices of that moment, so the list can still change until then.
Above the table, tiles show the state of the strategy, each only while there is something to say:
- "Regime": whether the regime filter is met (IN) or not (OUT), or that it is not set up or cannot be read.
- "Re-entry when IN": the titles that come back at re-entry.
- "Last run": kind and time of the last run, how many titles were bought and sold, or why nothing happened.
- "Capital change": an amount paid in or taken out that waits for the next rebalance.
Right on top of the table, a line shows the figures of the ranking, for example "38/93 above RSL 1 · Holdings 0 · Target 9 positions · 8,102 $ · 9 orders": how many titles have an RSL above 1, how many the strategy holds, how many positions it aims for, with which amount and how many orders the next rebalance would need. Its tooltip names the next rebalance and what it would do. The info icon behind it states that the ranking is a calculation from your own settings, not a recommendation. To its right, the button with the column icon shows further columns, the number on it counts the hidden ones. The funnel icon filters the list.
| Column | Content |
|---|---|
| Rank | rank by RSL, 1 is the highest value |
| Held | dot: the strategy holds the title |
| Ticker, Name, Sector | symbol, name and sector of the title |
| Data | state of the price data, during a load the progress |
| Close | last close |
| Average | average of the weekly closes over the RSL period |
| RSL | Close divided by Average |
| Shares, Value, P&L | shares held, their value and profit or loss |
| Weight | weight of the title and the amount it is due |
| Target | target number of shares after the next rebalance |
| Diff | difference between target and shares held |
| Plan | what the next rebalance does with the title |
The "Held", "Sector" and "Average" columns are hidden at first.
The values of the "Plan" column:
- "Buy": new title, will be bought.
- "Hold": stays unchanged.
- "Top-up": held title, will be topped up.
- "Reduce": held title, will be partly sold.
- "Sell": will be sold completely, because its rank dropped below "Sell below rank" or the regime filter is not met.
After a rebalance, the table shows the positions as the run left them until the next daily close.
7. What happens on the rebalance day
At the set time, an active strategy runs like this:
- A few minutes before the time, OptionsApp reads the live prices of the index members.
- At the time, it calculates each title's RSL from the stored daily prices and the live price, builds the ranking and checks the regime filter.
- It places market orders in this order: sales, reductions, new titles, top-ups. New titles follow their rank.
A top-up buys into the title's existing trade, a reduction sells part of it. If the monthly allowance does not cover all new titles, the remaining purchases are dropped. Sales and adjustments still run.
A strategy trades once per rebalance period. A restart in the same period does not trade again. If OptionsApp or TWS are not running at the time and up to 5 minutes after it, the rebalance of this period is skipped.
The run with its 5 minutes has to lie fully inside the trading hours of the day. On a shortened trading day closing at 13:00, 12:55 is the latest possible time; on a holiday there is no run. If a date falls outside like this, OptionsApp starts nothing and announces it once a day from up to 7 days ahead with "Relative Strength run outside the trading hours", the reason and the hint to change the time or the day. The period stays open: if the time is moved into trading hours, the rebalance can still run the same day.
After every run OptionsApp reports the result, by Telegram as well if set up: "Relative Strength orders placed" when orders were placed, and "Relative Strength run not executed" with the reason when nothing was traded.
8. Daily check in operation
With "Daily check" switched on, the strategy checks the regime filter on the weekdays without a rebalance at the set time:
- If the filter is no longer met, it sells all positions the same day.
- If it is met again, it buys back the positions that "Re-entry" sets (section 4.5). These purchases count as openings in the allowance again.
There is no daily check on holidays. Every change of the regime filter creates the message "Relative Strength regime changed".
9. Running positions and ending the strategy
The trades of an RSL strategy appear in the dashboard under "Stocks & ETFs" like all other stock trades. They have no profit target and no stop loss. They are closed by the rebalance, by the regime filter or by hand. How running trades are monitored and closed is described in Stocks & ETFs: orders and running trades.
While the strategy holds positions, the "Close positions" button appears on the right of the row with "Activate". It sells all positions of the strategy by market order and switches the strategy off. OptionsApp asks before anything is sent. This only works during regular trading hours. The strategy itself stays: switched on again, it buys at its next rebalance.
10. When nothing was traded
| Cause | Shown as | Solution |
|---|---|---|
| capital is 0 | note in the tooltip of the figures line on the ranking | enter an amount under "Capital" |
| a setting is missing | "Not complete" next to "Activate" | fill in the fields framed in red |
| regime filter not met | "Regime" tile with OUT, Plan "Sell" for all held titles | none, the strategy follows the filter |
| regime filter incomplete | "Regime filter not set up" | choose underlying and condition |
| date outside trading hours (holiday, shortened trading day) | message "run outside the trading hours" | change the time or the day |
| price data below 95 % | message "run not executed" with the reason | "Refresh data", then the strategy waits for the next date |
| OptionsApp or TWS were not running | no run in this period | keep OptionsApp and TWS running at the time |
| allowance used up | message on the run, new titles missing | next month or change the plan |
See also: Stocks & ETFs: strategy, entry and exit, Stocks & ETFs: taking an existing position under management (Manage position), Stocks & ETFs: exporting and importing strategies.