This notebook demonstrates position-level exits and portfolio-level controls through constructed examples. Static rules include stop losses, profit targets and time exits; dynamic rules include trailing stops that follow prior highs, tightening trails, and…
Knowledge library
Summaries and key ideas, written by Stratmill's research agent, of the books, papers, articles and code our AI agents read. Each page links to its original.
Search the library
76 documents
This notebook tests whether standard portfolio allocation can improve an every-bar NASDAQ-100 trading strategy that is already burdened by transaction costs. It selects predictions using validation performance on the declared cost-feasible universe, then…
This notebook studies how position sizing affects FX backtests after the model has already selected which currency pairs to trade. It preserves the winning baseline’s predictions, signal mapping, costs, and execution settings, then varies allocation rules.…
This notebook applies position-level risk controls to leading ETF allocation combinations while keeping each underlying prediction, concentration, and allocator fixed. It compares stop-losses, trailing stops, and time exits with the original strategy,…
This chapter presents portfolio construction as the process of converting return forecasts, risk estimates, and constraints into weights, leverage, and rebalancing decisions. It lays out a research workflow for documenting allocator choices, avoiding…
This notebook explains how to evaluate position-level exits and combine them with portfolio-wide controls. Fixed stop-loss, take-profit, and time exits are contrasted with trailing and tightening stops; a scaled exit reduces a position at successive profit…
This notebook explains when a strategy is clearest as precomputed arrays and when it benefits from a sequential simulation that carries positions, fills, cash, realized profit and loss, or equity forward through time. Array-based backtests are attractive…
This tutorial derives the Kelly fraction for a binary wager by maximizing expected logarithmic wealth growth, then extends the idea to continuous returns and a multi-asset portfolio. It uses symbolic differentiation and simulations with shared coin-toss…
This chapter presents a research workflow for using predictive models in trading, where stable out-of-sample forecasts may matter more than unbiased coefficient estimates. It covers regularized regression methods such as Ridge, LASSO, and Elastic Net, along…
This notebook explains when a trading strategy is clearer to simulate bar by bar with evolving state than to express as precomputed signals or weights. It contrasts array-based backtests, which can be fast and convenient for parameter sweeps, with sequential…
This notebook compares ways to allocate capital across US equity positions while holding the model, checkpoint, rebalance dates, and selected stocks fixed. It examines weights based on prediction strength, prediction-interval width, individual stock…
This notebook evaluates stop losses, trailing stops, and fixed-duration exits on selected US equity strategies. A stop loss responds to losses from entry, a trailing stop responds to declines from a position’s peak, and a time exit closes after a set holding…
This notebook compares ways to size positions in a US equities panel while holding the model, checkpoint, rebalance dates, and selected stocks fixed. Prediction-based methods scale capital by forecast magnitude or interval uncertainty; inverse volatility and…
This notebook compares portfolio weighting rules for selling straddles on selected S&P 500 symbols. It holds the chosen symbols constant and varies allocation, using equal weight as the baseline. The methods include weighting by predicted score, inverse…
This notebook runs a fixed equity-characteristics strategy on a reserved holdout period using predictions and a portfolio allocator selected earlier. It keeps the configuration, position sizing, concentration, rebalance cadence, and cost assumption…
This notebook explains how futures contract specifications affect backtest accounting. It shows how the contract multiplier converts price moves into dollar P&L, how price times multiplier determines notional value for sizing, and why per-contract…
This notebook turns stock-level predictions into validation portfolios. On each rebalance date, it sorts stocks by predicted return, buys the top group and shorts the bottom group, and assigns equal capital to every position. It applies this baseline across…
This document explains how to evaluate a previously selected US equities strategy on holdout data while keeping its configuration fixed. It derives the correct holdout prediction set from the selected model’s training identity and checkpoint, then applies…
This document explains why stop-losses, trailing stops, and time exits cannot be evaluated in a case study whose backtest holds weights across a month and observes only the realized monthly forward return. Such rules depend on the price path between entry…
This document presents an event-driven method for holding a limited number of intraday positions. Predictions are aligned to price bars using the latest available score, subject to an optional freshness limit. Entry signals use a rolling quantile computed…
This document describes several ways to convert prediction scores into trading signals: fixed cutoffs, rolling per-asset percentiles, and cross-sectional percentiles. Fixed thresholds use a chosen score level; rolling thresholds adapt to an asset’s recent…
This live-trading demonstration describes a daily rebalance workflow for a fixed universe of US large-cap stocks. It compares broker-held positions with model targets, converts the differences into an order basket, and routes orders through a risk-control…
This code describes how backtest settings are resolved from case study configuration and how run identity accounts for changes to the traded universe and prediction age. Its central lesson is that any filter that changes the portfolio or prediction set must…
This notebook studies six allocation methods applied to selected crypto perpetual strategy configurations. The rankings and entry rules remain fixed while the capital assigned to each position changes. The methods use model scores, individual contract…