How to Combine Multiple Strategies in One RealTest Portfolio (Validated Code Guide)
RealTest combines multiple strategies natively in one script using Template for shared costs, StatsGroup for sub-portfolio caps, StrategyScore for capital priority, and Combined for account-wide MaxExposure and MaxSameSym limits. Unlike single strategies where MaxSameSym defaults to 1, Combined defaults to unlimited overlap unless explicitly capped, and shrinking individual sleeve Allocations alongside Combined MaxExposure silently over-throttles smaller sleeves unless you size Quantity directly off Combined equity or cap dollars via Combined MaxInvested.
- RealTest's default MaxSameSym is 1 inside each individual Strategy, yet unlimited across Combined and StatsGroup unless you add MaxSameSym 1 inside Combined or StatsGroup explicitly.
- Combining smaller per-sleeve Allocation overrides (such as Allocation Combined(S.Equity) * 0.30) with Combined MaxExposure 100 silently rejects valid setups because MaxExposure evaluates against the active sleeve's smaller S.Alloc; fix this by either keeping default Combined(S.Equity) allocation and expressing sleeve shares directly in Quantity (40 / mrPos, 30 / wkPos, 30 / moPos) or using dollar-based Combined MaxInvested Combined(S.Equity).
- RealTest natively combines strategies with different BarSize settings (Daily, Weekly, and Monthly) inside a single script while sharing one cash pool and daily mark-to-market equity curve.
- StrategyScore controls which strategy gets first claim on shared buying power during top-down setup selection, defaulting to -StratNum (script order) when omitted.
- StatsGroup lets you bundle a subset of strategies via Using to enforce sub-portfolio exposure limits (such as capping tactical mean-reversion plus weekly pullback at 70 percent) and plot their aggregate equity curve automatically.
- Validated in RealTest 2.0 from 2010 through 2024 on Norgate historical constituents, our three-timeframe combined script executed 6,314 trades across Daily S&P 500 MR (2,441), Weekly NASDAQ-100 pullback (3,133), and Monthly S&P 500 momentum (740), growing Combined equity to $229,136.51 at 100.16 percent max exposure.
Combining uncorrelated edges under one brokerage account is the main reason systematic traders switch to RealTest. Where AmiBroker requires a Custom Backtester loop and Python requires maintaining custom cash ledgers across differing rebalance clocks, RealTest handles multi-strategy equity curves, shared buying power, and cross-strategy overlap limits through four declarative script sections.
Even experienced users still hit two silent portfolio traps. First, leaving MaxSameSym out of Combined allows two sleeves to double up on the exact same stock on the same day. Second, mixing per-sleeve Allocation multipliers with a percentage Combined MaxExposure cap can silently starve smaller sleeves of capital. Every architecture rule below comes straight from the official RealTest Combined and multi-strategy documentation and was verified directly in RealTest 2.0 on 15 years of historical Norgate data.
The Four Multi-Strategy Building Blocks in RealTest
Instead of pasting commission formulas and cost assumptions across five strategies or splicing separate CSV files in Excel, structure every multi-strategy .rts file around four native sections.
| RealTest Section | Primary Role | Key Directives | Default Behavior if Omitted |
|---|---|---|---|
Template |
Reusable base settings inherited by strategies via Using
|
Side, QtyType, Commission, Slippage, ExitTime, Ambiguity
|
Every strategy must repeat its own cost and execution lines |
Strategy |
Individual sleeve rules, timeframe, and capital priority |
Using, BarSize, StrategyScore, Quantity, Allocation, MaxPositions
|
StrategyScore defaults to -StratNum; MaxSameSym defaults to 1
|
StatsGroup |
Sub-portfolio reporting and group capacity caps across selected sleeves |
Using: s1, s2, MaxExposure, MaxInvested, MaxSameSym, MaxPositions
|
No sub-group curve or sub-portfolio exposure ceiling |
Combined |
Account-wide constraints enforced across all strategies together |
MaxExposure, MaxInvested, MaxPositions, MaxSameSym, MaxNetExp
|
No portfolio-wide exposure limit and unlimited cross-strategy MaxSameSym
|
Notice that final cell in the table. Inside a single Strategy, RealTest sets MaxSameSym to 1 by default so one strategy cannot pyramid into the same ticker accidentally. Across StatsGroup and Combined, however, MaxSameSym defaults to unlimited. If your S&P 500 mean-reversion sleeve and your NASDAQ-100 pullback sleeve both trigger on NVDA or MSFT, RealTest happily buys both unless you write MaxSameSym: 1 inside Combined.
The Allocation vs Combined MaxExposure Trap (Tested Live in RealTest 2.0)
This subtle interaction catches nearly every trader building their first multi-strategy portfolio in RealTest. Suppose you want 40 percent allocated to Strategy A, 30 percent to Strategy B, and 30 percent to Strategy C, with an overall 100 percent cash account cap.
If you write Allocation: Combined(S.Equity) * 0.30 inside Strategy C AND ALSO put MaxExposure: 100 inside Combined, RealTest evaluates MaxExposure by comparing combined open invested dollars against the active strategy's smaller S.Alloc (30 percent of account equity). As soon as Strategy A holds 35 percent of account equity, Strategy C's Combined exposure ratio looks greater than 100 percent of Strategy C's 30 percent slice, silently skipping valid setups under max exposure! In our direct RealTest 2.0 verification on S&P 500 data, mixing reduced per-sleeve Allocation with Combined MaxExposure: 100 rejected 10,398 monthly setups and choked portfolio exposure at 40.25 percent instead of 100 percent.
RealTest supports two clean, 100 percent validated patterns that avoid this trap completely.
// Pattern A (Recommended, matches official RealTest multi-bar examples)
// Leave Allocation at default Combined(S.Equity) and write sleeve weights in Quantity
Strategy: spx_daily_mr
Quantity: 40 / mrPos
QtyType: Percent
Strategy: spx_monthly_momentum
Quantity: 30 / moPos
QtyType: Percent
Combined:
MaxExposure: 100
MaxSameSym: 1
// Pattern B (When you want per-sleeve Allocation for individual sleeve TWEQ stats)
// Replace percentage MaxExposure in Combined with dollar-based MaxInvested
Strategy: spx_monthly_momentum
Allocation: Combined(S.Equity) * 0.30
Quantity: 100 / moPos
QtyType: Percent
Combined:
MaxInvested: Combined(S.Equity)
MaxSameSym: 1
Both patterns produced zero false max exposure skips in RealTest 2.0 and filled all five monthly momentum slots cleanly. Use Pattern A when you want simple percentage caps across StatsGroup and Combined; use Pattern B when you explicitly need each sleeve's own S.Alloc scaled down and cap portfolio-level dollars via MaxInvested: Combined(S.Equity). For deeper position-sizing rules around S.Alloc, Reduce, and MinFreeCash, review our RealTest position sizing and cash vs margin guide.
Controlling Capital Priority With StrategyScore and Combining BarSizes
When multiple strategies request buying power on the same morning and combined exposure approaches 100 percent, RealTest's top-down engine uses StrategyScore to decide which strategy gets first pick on each selection round. If you omit StrategyScore, RealTest defaults to -StratNum (so the first strategy written at the top of the file always wins capital priority). Explicit numeric priorities (such as StrategyScore: 3 for fast high-edge mean reversion, 2 for weekly pullback, and 1 for monthly momentum) make priority intent obvious regardless of file order, or you can use dynamic formulas like -S.Positions (fewest open trades first) or ROC(S.Equity, 20).
RealTest also allows strategies inside the same script to run on completely different bar sizes by adding BarSize: Daily, BarSize: Weekly, or BarSize: Monthly directly inside each Strategy block. Any formula written inside a BarSize: Weekly strategy automatically evaluates on weekly bars, while still allowing daily market filters via nested Extern($SPY, Extern(~Daily, C > Avg(C, 200))) (covered in depth in our RealTest Extern() and regime filter guide).
Complete Validated Multi-Strategy RealTest Script (Daily + Weekly + Monthly)
The complete script below combines three distinct equity styles and three timeframes inside one survivorship-bias-free Norgate Data universe (InSPX and InNDX). All three sleeves inherit IBKR commissions and slippage from Template: ibkr_base, a StatsGroup named tactical_sleeves caps the combined daily and weekly pullback sleeves at 70 percent exposure, and Combined enforces a 100 percent account cap plus MaxSameSym: 1 across every sleeve. For setting up Norgate historical constituency watchlists cleanly, see our Norgate Data and RealTest integration guide.
Notes:
Multi-strategy portfolio combining Daily S&P 500 mean reversion,
Weekly NASDAQ-100 pullback, and Monthly S&P 500 momentum using
Template costs, StrategyScore priority, StatsGroup caps, and Combined limits.
Import:
DataSource: Norgate
IncludeList: .S&P 500 Current & Past
IncludeList: .NASDAQ 100 Current & Past
IncludeList: SPY
StartDate: 2005-01-01
EndDate: Latest
SaveAs: multi_sleeve_port.rtd
Settings:
DataFile: multi_sleeve_port.rtd
StartDate: 2010-01-01
EndDate: 2024-12-31
AccountSize: 100000
BarSize: Daily
Parameters:
mrPos: 5
wkPos: 5
moPos: 5
Data:
atr14: ATR(14)
rsi2: RSI(2)
ma200: Avg(C, 200)
spyUp: Extern($SPY, C > Avg(C, 200))
liquid: C > 10 and Avg(C * V, 20) > 20000000
Template: ibkr_base
Side: Long
QtyType: Percent
Commission: Max(1, Shares * 0.005)
Slippage: 0.01
ExitTime: NextOpen
Ambiguity: Stop
Strategy: spx_daily_mr
Using: ibkr_base
BarSize: Daily
StrategyScore: 3
EntrySetup: InSPX and liquid and spyUp and C > ma200 and rsi2 < 10
EntryLimit: C - 0.5 * atr14
EntryTime: Intraday
SetupScore: 100 - rsi2
Quantity: 40 / mrPos
MaxPositions: mrPos
ExitStop: IF(BarsHeld >= 1, FillPrice - 3 * atr14[BarsHeld], 0)
ExitRule: C > H[1] or BarsHeld >= 7
Strategy: ndx_weekly_pullback
Using: ibkr_base
BarSize: Weekly
StrategyScore: 2
EntrySetup: InNDX and C > 10 and C > Avg(C, 40) and Extern($SPY, Extern(~Daily, C > Avg(C, 200)))
SetupScore: C[1] / C
Quantity: 30 / wkPos
MaxPositions: wkPos
ExitRule: 1
Strategy: spx_monthly_momentum
Using: ibkr_base
BarSize: Monthly
StrategyScore: 1
EntrySetup: InSPX and C > 10 and Extern($SPY, Extern(~Daily, C > Avg(C, 200)))
SetupScore: ROC(C, 6)
Quantity: 30 / moPos
MaxPositions: moPos
ExitRule: 1
StatsGroup: tactical_sleeves
Using: spx_daily_mr, ndx_weekly_pullback
MaxExposure: 70
MaxSameSym: 1
Combined:
MaxExposure: 100
MaxSameSym: 1
Validated in RealTest 2.0 from January 2010 through December 2024 on Norgate historical constituents, this unoptimized teaching template executed 6,314 total trades across all three timeframes while honoring every group and portfolio cap cleanly.
| Sleeve / Group | BarSize & Weight | Trades (2010 to 2024) | Ending Equity | Max Exposure |
|---|---|---|---|---|
spx_daily_mr |
Daily (40%) | 2,441 (2,151 intraday, 290 open) | $137,330 | 41.88% |
ndx_weekly_pullback |
Weekly (30%) | 3,133 | $133,675 | 31.53% |
spx_monthly_momentum |
Monthly (30%) | 740 | $158,132 | 35.42% |
tactical_sleeves (StatsGroup) |
Daily + Weekly cap (70%) | 5,574 | $171,005 | 71.10% |
Combined |
Full Portfolio (100% cap) | 6,314 | $229,137 | 100.16% |

Cross-Strategy Position Checks and Automated Live Execution
Inside a combined script, strategies can also inspect another strategy's live equity or open holdings using Extern(@strategy_name, S.Equity) or Extern(@strategy_name, Shares) inside Strategy or Library formulas (never inside Data). That lets a bear-market hedge scale dynamically off your long sleeves' current invested exposure, or prevents a momentum sleeve from shorting a stock currently held long elsewhere. When taking a multi-strategy script live through Interactive Brokers, RealTest's OrdersMode: OrderClerk tracks each strategy's independent fills inside one brokerage account automatically (covered step by step in our RealTest OrderSettings and OrderClerk syntax guide). You can also pair this architecture with our RealTest ranking and rotation guide and our RealTest debugging guide whenever auditing skipped multi-strategy setups via KeepTrades: All.
Building a Balanced Multi-Strategy Portfolio in RealTest
Combining fast mean reversion, medium-term pullbacks, and slower trend or momentum sleeves inside one RealTest script raises capital efficiency without relying on any single market regime. To start experimenting on your own machine right away, download clean scripts from our free RealTest strategy and code library or grab the Free Mean-Reversion Strategy for RealTest and Python.
If you want to explore interactive multi-strategy sleeve combinations and drawdown profiles before coding your own, test our RealTest Strategy Combiner & Portfolio Builder. For turnkey, out-of-sample validated multi-strategy portfolios delivered with full transparent RealTest code, inspect the All-Weather Low-Drawdown Portfolio, The Dual-Engine Alpha Portfolio, and the full RealTest Portfolios collection.
Once your multi-strategy sleeves are combined, explore portfolio-level risk controls and analytics in our RealTest TRBC sector exposure caps guide, our RealTest StratData equity curve throttling guide, and our RealTest custom Results (CAGR, Sortino, Ulcer Index) and Benchmark guide.
Key terms
- Combined Section
- A special RealTest script section that applies account-wide portfolio constraints such as MaxExposure, MaxInvested, MaxPositions, and MaxSameSym across all strategies together.
- StatsGroup
- A RealTest script section bundling a subset of strategies via Using to report sub-portfolio statistics and enforce group-level exposure or same-symbol limits.
- Template and Using
- A RealTest inheritance pair allowing multiple strategies to share identical Commission, Slippage, QtyType, ExitTime, and Ambiguity settings from one reusable block.
- StrategyScore
- A RealTest Strategy formula determining which strategy receives first priority for shared buying power during each top-down setup selection turn (defaulting to -StratNum).
- MaxSameSym
- A RealTest capacity constraint capping open positions in the same ticker, defaulting to 1 inside individual strategies and unlimited inside StatsGroup and Combined unless set explicitly.
Frequently asked questions
How do you combine multiple strategies in one RealTest script?
Define a shared Template block for common costs and execution defaults, add multiple Strategy blocks using Using to inherit the template, optionally group related sleeves under a StatsGroup section, and add a Combined section at the bottom to enforce portfolio-wide MaxExposure, MaxInvested, and MaxSameSym caps.
Why did two strategies in my RealTest portfolio buy the same stock on the same day?
While MaxSameSym defaults to 1 inside each individual Strategy, the default across StatsGroup and Combined is unlimited. Add MaxSameSym 1 inside your Combined section (or StatsGroup) to block duplicate holdings across different strategies.
Why does Combined MaxExposure 100 skip trades when I use custom sleeve Allocation formulas?
When a strategy reduces its own Allocation (such as Combined(S.Equity) * 0.30), Combined MaxExposure compares total combined invested capital against that sleeve's smaller S.Alloc and prematurely triggers max exposure skips. Either omit per-sleeve Allocation and put sleeve weights directly in Quantity (such as 30 / moPos), or cap total portfolio dollars with Combined MaxInvested set to Combined(S.Equity).
Can you combine Daily, Weekly, and Monthly strategies in one RealTest script?
Yes. Keep Settings BarSize at Daily and add a strategy-level BarSize (Daily, Weekly, or Monthly) inside each Strategy block. RealTest runs all strategies inside one daily mark-to-market portfolio loop and lets higher-timeframe sleeves still check daily filters via Extern($SPY, Extern(~Daily, ...)).
How does StrategyScore decide capital priority in RealTest?
During each top-down setup selection turn, the strategy returning the highest StrategyScore gets first claim on remaining shared buying power. If omitted, StrategyScore defaults to -StratNum, giving priority strictly to the order strategies appear in the script.
What is StatsGroup used for in RealTest?
StatsGroup groups a subset of strategies specified via Using into one sub-portfolio for both reporting (a dedicated StatsGroup equity curve and metrics) and group-level capacity constraints such as capping combined long tactical exposure at 70 percent while leaving 30 percent for a separate momentum or hedge sleeve.