This example strategy trades relative price relationships among soybean oil, rapeseed oil, and palm oil futures. It calculates a normalized spread index from the three daily closing prices, then compares five-period and fifteen-period moving averages. A…
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
The document outlines two high-frequency approaches for Chinese markets. In its BBO strategy, traders place small orders near the best bid and offer when the order book has a liquidity gap and large orders on both sides. The idea is to earn from incoming…
The distance approach selects two instruments whose historical price series moved together, then trades when their price spread exceeds a chosen threshold during a later testing period. The strategy buys the instrument with the lower price and shorts the one…
This description outlines an expert advisor that opens positions across two forex pairs and calculates direction and lot size from recent price history, using the last 60 bars without technical indicators. The stated premise is that the selected pairs should…
The document lays out a screening process for spreads used in pairs trading and statistical arbitrage. Candidate constituents are tested for cointegration, mean-reverting behavior, practical reversion speed, and frequent crossings of the spread’s mean. It…
This article introduces cross-commodity futures arbitrage as trading the relative price of two related contracts, typically entering opposing positions when their spread or ratio moves away from an expected range and closing as it reverts. It groups…
This brief description outlines a MetaTrader 5 expert advisor that forms two currency pairs from three currencies and trades them as a correlated pair, with EUR/USD and EUR/GBP given as an example. It opens four initial orders across the two pairs, split…
This code provides helper measures for selecting groups of four stocks as candidate partners in a vine copula workflow. One traditional method chooses the quadruple with the greatest sum of pairwise correlations. Other methods operate on empirical ranked…
This document explains how a Kalman filter can update a pair’s hedge ratio over time, avoiding the need to choose a fixed lookback window or a manually selected observation-weighting scheme. It models one asset’s price as a linear function of the other, with…
This implementation outlines a workflow for building a mean-reversion spread from three or more assets. It fills missing price observations using forward filling or spline interpolation, converts prices to logarithms, and applies the Johansen procedure to…
This Expert Advisor trades two currency pairs that share a quote currency and are expected to have positive long-term correlation. It examines recent bar history without indicators, looks for both pairs to rise in one portion of the window and fall in…
This platform-support exchange concerns a pair-trading strategy that failed to run in simulation. The suggested fix is to leave the data-extraction module’s start-date option unbound to live-trading parameters. The explanation is that the strategy’s…
This technical guide models a positive mean-reverting portfolio as the exponential of an Ornstein–Uhlenbeck process. It fits the model by maximizing average log-likelihood, selecting the portfolio asset ratio that produces the best fit. The model parameters…
The document describes a trading indicator that compares two currency pairs. Users choose a second symbol, a correlation method, and a lookback period; the resulting indicator is intended to help assess whether the pairs are moving together or diverging.…
The document implements an H-construction approach for analyzing price series, based on a cited study of statistical variability in spreads. It converts a series into Kagi-like turning points or Renko-like threshold steps. The H-inversion statistic counts…
The H-strategy uses Renko or Kagi turning points to study how far a price or spread typically moves before reversing. It defines an H threshold, marks extrema and the later times when a move of that size confirms a turn, then measures the count of reversals,…
The code implements a two-asset pairs trading strategy using a rolling ordinary least squares transformation and its z-score. It opens a short-spread position when the z-score exceeds an upper threshold and a long-spread position when it falls below a lower…
The article presents correlation as a guide to building a diversified trading portfolio. For trend following, it recommends combining instruments with lower correlations so positions do not behave like a single exposure. For pairs trading, it suggests…
These notes introduce statistical arbitrage through pairs of assets whose price spread is believed to be stable over time. The example tests for cointegration, estimates the spread’s mean and standard deviation, and sets entry thresholds around that mean.…
This article presents a multi-year backtest of a market-neutral crypto pairs strategy using ETC and FIL quoted in USDT. The broader method selects a pair based on cointegration and mean-reversion evidence, estimates a hedge ratio, tracks the spread with…
A trader asks about an unusually large backtest result for an index spread strategy on a day when the underlying market fell sharply. They report that the fills show no leg being left unpaired, so the source of the result is unclear. The discussion does not…
This document describes a Generic Non-Parametric Representation distance for comparing two financial series. It combines a distribution-distance component with a dependence component, with a parameter controlling their relative contribution. The dependence…
This document explains a stochastic-control approach to trading two cointegrated assets whose log-price spread is modeled as a stationary process. A mean-reverting spread represents relative mispricing, while a market index and a risk-free asset capture…
This article explains how to assess whether a cryptocurrency pair spread is suitable for mean-reversion trading. It presents the Augmented Dickey-Fuller (ADF) test as a check for a unit root, with a low p-value used to reject non-stationarity, and the Hurst…