Strategy Builder
Build allocation rules that switch holdings when their signals change state, then backtest the strategy.
On this page
Use this when
Use Strategy Builder to change holdings when a signal changes. For example, hold equities above a trend threshold and bonds otherwise. Rules run in the order you set.
Good for
- Rule-based regime switching with one or two signals.
- Ranked rotations across a small universe, such as top-N momentum and dual momentum.
- Comparing how different signals would have changed when the strategy traded.
Reach for a different tool when
- Strategies whose composition does not change. Use Portfolio Backtest.
- Testing whether an indicator predicts anything in the first place. Use Signal Analyzer.
First run
- Define the scenario
Set date range, benchmark, trading frequency, and initial capital.
- Build rules
Choose a signal for your market question, then add a risk-on rule first and a fallback last.
- Review execution settings
Open Trading and cash flows for execution assumptions. Use cooldown, lag, and ranked rules only when the question requires them.
- Run and validate
Inspect state changes before reusing the strategy in Portfolio Backtest.
Configuration guide
Set when the strategy checks signals and what each rule holds.
| Configuration | What it means | Why it matters |
|---|---|---|
| Scenario | Date range, benchmark, principal, and shared execution assumptions for the strategy run. | These settings define the historical test bed used to judge every rule transition. |
| Rule order | Rule evaluation runs from top to bottom. The first active rule wins. | Ordering is part of the strategy logic. A broad rule above a specific rule can prevent the specific rule from ever firing. |
| Fallback rule | The allocation used when no earlier signal is active. | Without a fallback, the strategy can have undefined behavior during regimes that do not match the signal set. |
| Signal definition | The condition that turns a rule on, such as trend, momentum, volatility, macro, calendar, or composite logic. | Signal design determines when trades happen. Small threshold or lookback changes can materially alter state history. |
| Trading frequency | How often the strategy can evaluate and switch rules. | Higher frequency reacts faster but can increase whipsaw, turnover, taxes, and slippage. |
| Lag and cooldown | Controls that delay execution or prevent rapid repeat switching. | These settings make the test more implementable, but they also change the timing of every transition. |
| Ranked allocation | A dynamic rule that selects assets from a universe by a ranking metric. | Ranking adds another model layer: universe, metric, lookback, selection count, and fallback all affect holdings. |
Common pitfalls
- Forgetting a fallback rule
Without a fallback, the strategy has undefined behavior in regimes none of your conditions describe. Always end the rule list with a fallback.
- A broad rule above a specific rule
Rules evaluate from top to bottom. The first match wins. Order rules from most specific to fallback so narrower rules can fire.
- High trading frequency without realistic costs
Set transaction cost and slippage before interpreting a strategy that trades often.
- Tuning thresholds until in-sample looks good
Use the holdout split. Weaker results after the split may indicate that the threshold fits only the earlier period.
Core concepts
- Allocation rule: a named asset mix whose fixed and ranked sleeves sum to 100%.
- Signal: a boolean condition that determines whether a rule is active.
- Rule order: the engine checks rules from top to bottom. The first rule whose signal is true becomes active.
- Fallback rule: the last rule should have no condition. It applies when no earlier rule is active.
- Trading frequency: how often the engine can switch between rules.
- Signal return basis: whether signals use total-return series or raw closes. Total return is the default. Uploaded
U.*aliases and unsupported.SIMraw signal series usetotal_returnwith a warning. Execution prices still use the selected mode. - Execution lag: rule changes trade no earlier than the next trading day. Strategy Builder backtests do not model same-day execution.
- Ranked rule: an allocation rule that selects the top or bottom N tickers from a universe by a ranking metric.
Ranked allocation
Any rule can select tickers instead of using fixed weights. Set its allocation type to ranked. Configure the universe, ranking metric, lookback, and weighting method. At each rerank, the engine scores the universe. It drops tickers that fail optional score thresholds or have insufficient price history. It then selects N tickers until the next rerank.
- Universe: 2 to 29 plain tickers to rank. The fallback is separate, so the total pool is up to 30.
- Metric: total return, volatility, price-over-SMA ratio, or RSI. The same metric applies to every ticker in the universe.
- Lookback: primary window in trading rows, with up to three optional secondary lookbacks. The engine averages scores across lookbacks, or combines them with per-lookback weights when you specify them. VAA, BAA, and HAA use a 12/4/2/1 weighting.
- Select and N: hold the top or bottom N tickers after sorting by score.
- Weighting: equal weight across the selected tickers, or inverse-volatility weighting proportional to 1 / annualized volatility over the primary lookback.
- Score thresholds: optional min and max scores that exclude tickers before selection. Useful for absolute-momentum filters that fall to cash when nothing passes.
- Fallback ticker: held for the ranked sleeve whenever zero tickers survive filtering.
- Rerank cadence: follows the strategy's trading frequency. Monthly reranks occur every 21 trading rows, and quarterly reranks occur every 63 rows. Between reranks, the model carries the selection forward.
- Ranked sleeve %: percent of the rule assigned to the ranked sleeve, in the range 1 to 100. Use 100 to keep the rule ranked-only. When set below 100, the remainder fills a fixed sleeve defined by the rule's static weights.
Composing a fixed sleeve with the ranked sleeve. Below 100%, the rule's weights field becomes the fixed sleeve. The realized allocation equals ranked picks times sleeve_fraction, plus the fixed sleeve at its configured weights. The sleeve_fraction equals the ranked sleeve percentage divided by 100. Aggregation is additive when tickers overlap. The schema rejects a fixed ticker that is in the universe or equals the replacement ticker.
Only the fallback ticker can receive both ranked and fixed contributions. Fixed sleeve tickers are calendar anchors. A missing rebalance price makes the rule use the default rule for that day. A late-inception fixed ticker moves the effective backtest start date to that ticker's inception date. A missing universe ticker drops out of ranking.
Example. A rule sets ranked sleeve % = 70, universe = [SPY, QQQ, EFA], fallback = BIL, n = 2, and fixed sleeve = [{AGG, 30%}]. It holds 35% of each of the top-2 ranked picks plus 30% AGG on every rebalance.
Ranked rotations count as rebalance events, so trading-cost and slippage haircuts apply on the decision row the same way they do for fixed-weight rule transitions. What-if price overrides cannot target ranked universe or fallback tickers.
Main inputs
- Date range: historical sample used in the run.
- Principal: starting portfolio value.
- Benchmark: reference series used for comparison.
- Trading frequency: daily, weekly, biweekly, monthly, quarterly, or annual switching cadence.
- Trading costs and slippage: implementation costs applied to rule transitions.
- Cash flows: recurring or one-time contributions and withdrawals.
- In-sample / out-of-sample holdout: optional split date for separate metric tables before and after the date. Both tables use the same realized strategy run.
Signal types
Strategy Builder supports atomic signals and composite operators:
- Trend: moving average and related price-based rules, including dual-moving-average hysteresis
- Momentum: return momentum, composite momentum, and relative strength
- Volatility and risk: VIX, volatility, RSI, drawdown, and correlation rules
- Macro and calendar: yield curve and date-based filters
- Composites: AND, OR, and NOT over other signals
Results
A table compares the strategy with its baseline: ending value, CAGR, maximum drawdown, volatility, Sharpe ratio, and trade count. The line above the table names the window and the return, tax, and dollar bases. Named sections follow. Performance opens by default. Each other section loads when you open it.
- Performance: portfolio value, drawdown, and annual returns for the strategy and the baseline. Shading on the value chart marks the active rule. Inspect recoveries as well as endpoints.
- After tax: appears for a tax-aware run. It shows after-tax figures and the tax ledger.
- Rules: return by rule, the ranked selections of a ranked rule, regime stability, the transitions with the latest first, and the signal history. The signal history shows each atomic signal's indicator value and state. It uses the same evaluation path as the backtest, so charted values match the decisions of the engine.
- Returns: the monthly returns heatmap and rolling metrics.
- Baseline comparison: cumulative active return, the return regression, relative metrics, and active return by rule.
- Trading: transition count, holding periods, turnover, and trading costs.
- All metrics: every return and risk metric for the strategy and the baseline. Choose the metrics to show.
- Current signal: the latest fully observed rule, signal state, and active weights. Use it to confirm the strategy does what you expect on the latest data.
- What-if: temporary threshold, direction, or price overrides for the current signal. Saved analyses do not change.
- Robustness: grid search, walk-forward validation, the start-year matrix, and the robustness lab.
- In-sample / out-of-sample: paired metric tables for the two windows when you enable a holdout split.
Save analysis and Share are at the top of the page. The Share menu also saves the rules as a Library strategy.
For unexpected results, see Debug a strategy.
In-sample / out-of-sample holdout
Strategy Builder supports an in-sample / out-of-sample holdout. Choose a split date to compare metrics before and after that date on the same backtest path.
- The split does not refit signal thresholds or change rule order, ranked selections, transition timing, costs, or cash flows.
- The requested date snaps to the nearest prior trading day. Both sides need enough history. Otherwise, the result shows a warning instead of partial metrics.
- For rolling or expanding train/test schedules, use walk-forward validation in the Robustness section of the results.
Debug a strategy
When results are unexpected:
- Open the Strategy Builder with the strategy loaded.
- Open Rule attribution and check regime stability. Frequent switching may indicate a noisy signal or a threshold set too close to the boundary.
- In Rule attribution, check the return by rule. If one rule contributes most of the return, the other rules may not be firing at useful times.
- Open Trading. High transition counts combined with trading costs may erode performance.
- Open Signal Analyzer. Test the signal in isolation for forward predictive value on the target asset.
Signal research to strategy
The typical signal-to-strategy workflow moves through three tools:
- Signal Analyzer: test whether an indicator predicts a later outcome. Evaluate hit rate, return spread, and forward-return distributions by signal regime.
- Strategy Builder: if the signal shows predictive value, build a tactical strategy that switches allocations based on that signal. Review transition behavior and rule attribution.
- Portfolio Backtest: load the tactical strategy into a portfolio allocation and run a full historical backtest with cash flows, rebalancing, and optional tax-aware accounting.
See Signal Analyzer and Portfolio Backtest for the individual tool references.
Glossary
Glossary
- Allocation rule
- A named asset mix whose weights sum to 100%, evaluated against a condition.
- Signal
- A boolean condition, such as trend, momentum, volatility, or a calendar trigger, controls whether a rule is on or off.
- Fallback rule
- A rule with no condition, placed last. The strategy holds it whenever every earlier rule's signal is false.
- First-match-wins
- Rules evaluate from top to bottom. The first true condition determines the active allocation.
- Whipsaw
- Rapid switching between rules driven by a noisy signal. Often costs more than the signal earns.
- Cooldown / lag
- Controls that delay execution or block repeat switches. Make backtests more implementable but change every transition's timing.
- Ranked rule
- An allocation that picks the top or bottom N tickers from a universe by a metric, instead of holding fixed weights.
- Fixed sleeve
- The portion of a ranked rule allocated to specific tickers at fixed weights, distinct from the ranked sleeve which holds top-N picks. The rule's weights field defines the fixed sleeve, which fills 100 minus Ranked sleeve %.
- Walk-forward validation
- Refit on a rolling train window, evaluate on the next test window. Surfaces whether parameter choices generalize.