This example demonstrates how risk management models can be added to a modular algorithmic trading framework. It configures a portfolio drawdown limit and a per-security unrealized profit threshold, showing both a composite model that combines the rules 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
5,922 documents
This framework example uses a moving-average crossover universe-selection model to choose assets, then applies a constant upward price insight and equal-weight portfolio construction. Its configuration sets daily data resolution, leverage of 2.0, an initial…
This algorithm ranks a universe of growth and safety ETFs using a weighted combination of one month and three month performance. About every month, it selects the symbol with the highest score. If that top-ranked fund has a positive score, the algorithm…
This document presents a visual framework for comparing a trading strategy’s equity with a buy-and-hold benchmark over a selected date range. It plots strategy profit, benchmark return, and their difference, then summarizes the share of bars when the…
This installment describes updates to a MetaTrader auto-optimizer, especially automatic generation of historical and forward optimization periods. A selected overall date range is divided into alternating windows: historical periods use a chosen duration,…
This article presents a file-based pattern for managing parameters in a multi-currency MQL5 Expert Advisor when a long list of inputs becomes difficult to maintain and the platform limits the number of inputs. A text file supplies the symbol list, while…
The article describes an MQL5 trading system organized as an ensemble of seven agents with different intended horizons and styles, including trend following, momentum, breakout, scalping, volatility, and swing trading. Each agent interacts with market data…
This capstone notebook compares equal weight, inverse volatility, mean-variance optimization, and hierarchical risk parity using a common signal on a diversified ETF universe. A rolling Ridge model uses momentum, moving-average distance, and volatility…
This notebook isolates portfolio allocation by fixing each case study’s selected signal and comparing allocation-stage backtests. It considers methods such as equal weight, inverse volatility, score weighting, mean-variance optimization, risk parity, and…
This notebook compares portfolio allocation methods across case studies while holding each study’s selected signal prediction fixed. It loads allocation-stage backtests tied to the same spine prediction, then examines methods such as equal weight, inverse…
This notebook compares structured graph-style retrieval with embedding-based vector retrieval on institutional holdings from 13F filings. It constructs a point-in-time holdings snapshot at a fixed cutoff, limits the stock universe, and creates questions…
This notebook compares portfolio allocations from PyPortfolioOpt, Riskfolio-Lib, and skfolio using the same ETF return panel. It fits allocators on a training period, checks that equivalent objectives and aligned weights agree within solver tolerances, and…
This notebook constructs the long-only, fully invested Markowitz framework, including feasible portfolios, the efficient frontier, maximum-Sharpe and minimum-variance solutions. It explains how portfolio variance depends on the covariance matrix and how…
This notebook turns model rankings into simple crypto perpetual-futures portfolios so later experiments can measure the effect of changing sizing, costs, or risk controls. It applies entry rules such as selecting the highest-scored contracts for longs and…
This document compares alternative position-sizing methods for CME futures strategies selected from a baseline ranked by equal-weight validation Sharpe. Equal weighting treats every selected product alike, although futures contracts can have very different…
This notebook turns model prediction sets into comparable S&P 500 options backtests. On each weekly decision date, it ranks predicted returns, selects the highest-ranked symbols in the liquid universe, and sells equally weighted at-the-money straddles.…
This notebook evaluates validation predictions derived from equity and options research by translating them into long-only equity portfolios. It uses an equal-weight top-K baseline, compares several portfolio concentrations, and follows the label-specific…
This notebook compares equal weight, inverse volatility, minimum variance, and hierarchical risk parity using the same ETF universe, forecasts, rebalance schedule, and backtest protocol. A rolling Ridge model ranks ETFs from momentum, moving-average…
The notebook explains Value at Risk (VaR), which marks a loss quantile, and Conditional Value at Risk (CVaR), which averages losses beyond that threshold. Using daily ETF returns, it compares historical, Gaussian, Cornish–Fisher-adjusted, and Student-t Monte…
This notebook explains Hierarchical Risk Parity (HRP), a portfolio construction method designed to limit sensitivity to noisy covariance estimates. It describes its three stages: cluster assets by correlation distance, reorder them according to the resulting…
This notebook assesses registered ETF backtests across the strategy pipeline, from signals and allocation through costs and risk overlays. It reads existing predictions and backtests rather than fitting models or adding new backtests, while deriving cohort…
This notebook compares six ways to weight ETF portfolios selected by the same predicted ranking: equal weight, score weighting, inverse volatility, risk parity, mean-variance optimization, and hierarchical risk parity. It varies the number of selected funds…
This notebook gathers registered double machine learning estimates from multiple trading case studies and compares their uncertainty and diagnostics. It loads current rows from each study’s registry, checks registry integrity and label uniqueness, makes…
This notebook presents a diagnostic framework for an ETF allocation backtest. It calculates risk and return measures such as Sharpe, Sortino, Calmar, volatility, value at risk, and maximum drawdown; tracks rolling performance and drawdown recovery; and…