The article introduces pairs trading as an accessible starting point for understanding statistical arbitrage. It describes taking opposite positions in two historically related securities when their prices diverge, with the expectation that their…
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
765 documents
This article explains bivariate Archimedean copulas and their implementation in MQL5, focusing on the Frank, Clayton, Joe, Gumbel, N13, and N14 families. A generator function combines uniform marginal probabilities into a dependence model, with family…
The article outlines a multi-currency carry approach that seeks positive swap income while offsetting exchange-rate exposure through opposing positions in correlated currency pairs. It proposes using least-squares regression on historical daily prices to…
The article outlines a MetaTrader 4 Expert Advisor that trades a pair of forex symbols as a hedge. It explains using MarketInfo to access prices and trading properties for symbols beyond the active chart, and it recommends choosing pairs whose prices tend to…
This article introduces cointegration as a way to identify long-run relationships among stocks for statistical arbitrage, moving beyond simple correlation and two-asset pairs. It describes applying the Engle-Granger test to a pair and the Johansen method to…
This article explains the Augmented Dickey-Fuller test as a way to assess whether a series has a unit root, with stationarity as the alternative. It describes the regression behind the test, the role of the coefficient on the lagged series, and how the…
This article introduces statistical arbitrage through correlation, cointegration, and the Pearson coefficient, then demonstrates a screening workflow using historical prices. Its Python example compares instrument pairs, retains those above a correlation…
This article develops a multivariate statistical-arbitrage workflow intended to reduce dependence on fast order execution. It begins with liquid stocks from a related industry, screens candidates for recent correlation with a reference asset and with one…
This lesson introduces pairs trading as a way to trade a hypothesized economic relationship between two securities. It distinguishes cointegration from correlation, illustrates both concepts with simulated series, and describes testing a candidate pair with…
This lecture introduces factor models as regressions that explain an asset’s returns using other return series. It estimates an asset’s beta to a benchmark from historical returns, then uses a short benchmark position sized to offset the estimated market…
This lecture explains stationarity, orders of integration, and why these properties matter when analyzing financial time series. A stationary process has stable data-generating characteristics, while changes such as a drifting mean can make a historical…
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 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 reconstructs the selected FX pairs configuration from a frozen validation candidate set, then assesses its validation and holdout evidence. Selection uses the highest eligible validation Sharpe, with a deterministic backtest identity…
This example constructs a relative spread indicator from daily closes for soybean oil, palm oil, and rapeseed oil futures. It calculates the difference between two pairwise price spreads and scales that value by the difference between rapeseed oil and palm…
This pairs-trading model ranks available asset pairs by the Pearson correlation of their recent log-price changes and selects the pair with the highest correlation, provided it meets a minimum threshold. It retrieves historical closing prices at a…
This example outlines a mean-reversion approach for two assets. It applies the Engle–Granger two-step method: regress one price series on the other, test whether residuals are stationary, then estimate an error-correction model and check that its adjustment…
This example combines daily Intrinio observations for West Texas Intermediate and Brent crude prices with two oil fund positions. It calculates the Brent-minus-WTI spread and takes opposing positions in the funds: a positive spread leads to a long Brent fund…
This statistical arbitrage method trades a normalized relationship between silver and gold. It scales each price against its 20-period simple moving average, forms a ratio, smooths it with a short exponential average, and calculates a rolling Z-score. A move…
This document describes an exchange-integrated framework for pairing accounts or markets into long and short sides, then opening or closing both legs together. Users designate long and short matches, inspect their status, and trigger a paired hedge…
The document explains a market-neutral statistical arbitrage approach that pairs long and short baskets with equal value. It proposes scanning instruments to form baskets, assessing their correlations and cointegration, and filtering candidates with…
This example models a production-margin spread using polyester staple fiber futures against weighted PTA and ethylene glycol futures. It multiplies each contract price by its contract multiplier and a production ratio, then defines the spread as the…
This relative-value strategy models the log price of the EWY Korea equity ETF as a linear combination of Samsung Electronics and SK Hynix prices, with an intercept. It standardizes the regression residual over a rolling window and treats large positive or…
This controller describes a two-asset statistical arbitrage workflow. It requests candle data for each pair, estimates a hedge relationship with linear regression, and uses the spread’s z-score to choose between long-dominant/short-hedge and the reverse. It…