← Back to Documentation

Strategy Gallery

Strategy Gallery is the discovery surface for strategies. Use it to inspect public or shared strategies, then copy the ones you want into your Library for reuse.

Access: Public

Open Strategy Gallery →

Core Concepts

Every strategy is built from a small set of composable pieces:

Building BlockWhat It Does
ConditionA named allocation rule. A strategy has one or more conditions (for example "Risk-On" and "Risk-Off"). Each condition has its own set of asset positions with target weights.
SignalA boolean rule that decides which condition is active on any given day. Signals are evaluated daily; the first condition whose signal is true wins. The last condition must be a fallback (no signal); it's the default when nothing else fires.
PositionA single asset position within a condition: a ticker, an allocation weight (positions within a condition sum to 100%), and optional modifiers (leverage, expense ratio, etc.).
Rebalance PolicyControls when the strategy rebalances its internal positions back to target weights, by time, by drift threshold, or both. See the Rebalancing guide for details.

Strategy Types

The Strategy Builder supports three common patterns:

  1. Buy & Hold (single ticker): hold one asset permanently. One condition, one position. Example: 100% SPY.
  2. Buy & Hold (multi-ticker / asset allocation): hold multiple assets at fixed weights with internal rebalancing. One condition, multiple positions. Example: 60% SPY / 40% AGG rebalanced monthly.
  3. Signal-based (tactical / LFLR): switch between conditions based on a signal. Two or more conditions, the first with a signal, the last as the fallback. Example: hold UPRO when SPY > 200-day SMA, otherwise hold SHY.

Signal Types

Signals are the rules that trigger condition switches. Each signal evaluates a condition on each trading day and produces a true/false result.

SignalParametersWhen It Fires
SMAPeriod (days)Price is above the simple moving average
EMAPeriod (days)Price is above the exponential moving average (more responsive to recent data than SMA)
VIX ThresholdThreshold levelCBOE Volatility Index is below the threshold (low fear = risk-on)
RSIPeriod, thresholdRelative Strength Index is above the threshold (momentum is positive)
MomentumLookback (days)Price is higher than N days ago (positive trend)
DrawdownThreshold (%)Current decline from all-time high is less than the threshold

Composite Signals

Combine multiple atomic signals into a composite signal tree using logic operators:

  • AND: all child signals must be true.
  • OR: at least one child signal must be true.
  • NOT: inverts a child signal.

Condition Evaluation Rules

When a strategy has multiple conditions, the engine evaluates them in order:

  1. Conditions are checked in the order they appear in the strategy (first-match wins).
  2. The first condition whose signal is true becomes active.
  3. The last condition must have no signal; it's the fallback that activates when no other signal fires.
  4. When the active condition changes, the engine forces an immediate rebalance to the new condition's target weights.

Position allocations within each condition must sum to 100%. Different conditions can hold completely different assets (for example, a risk-on condition with 100% UPRO and a risk-off condition with 100% SHY).

Example: Classic 60/40

Example of a two-asset allocation with monthly rebalancing:

  • Type: Buy & Hold (multi-ticker)
  • Condition: 1 condition (fallback, no signal)
  • Positions: SPY at 60%, AGG at 40%
  • Rebalance: Monthly, time-based

Example: Leveraged Trend-Following (LFLR)

Example of a signal-based strategy with a leveraged risk-on state:

  • Type: Signal-based (2 conditions)
  • Risk-On condition: Signal = SPY > 200-day SMA. Position: 100% UPRO (3x leveraged S&P 500)
  • Risk-Off condition: Fallback (no signal). Position: 100% SHY (short-term treasuries)
  • Rebalance: Monthly

Using Strategies in Portfolios

Once saved, a strategy becomes a reusable building block. In the Portfolio Backtest, each strategy occupies an "allocation" (an independently-managed sub-portfolio with its own allocation weight). Allocations rebalance internally according to their own policy, then the portfolio rebalances across allocations.

Each allocation manages its own internal positions. Portfolio-level rebalancing then manages the split across allocations.

Ticker Modifiers

Each ticker input has a gear icon that opens the modifier modal. Modifiers let you apply leverage, expense ratios, fill-backward history, return/volatility targets, and other transforms to individual tickers within a strategy, all using testfol.io-compatible expressions.