This code describes a mean-reversion strategy for the spread between Dalian Commodity Exchange coke and coking coal futures. It calculates a weighted value spread using contract prices, contract multipliers, and a specified leg ratio, then estimates the…
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
13 documents
The script describes a two-sided futures strategy on hourly bars. It identifies confirmed swing low and swing high fractals, then enters long when price breaks above a bullish fractal’s high during a short-over-long moving-average uptrend. It enters short…
The strategy models a refining spread using crude oil, fuel oil, and a third petroleum product in a 3:2:1 weighting. It calculates the spread as the weighted value of the two product legs minus the weighted crude leg, then compares the current spread with…
This example implements a daily mean-reversion strategy for a Shanghai Futures Exchange gold contract. It calculates a Z-score from recent closing prices, enters long when the score falls below a negative entry threshold and short when it rises above a…
This script describes a three-leg futures strategy that treats hog value minus weighted corn and soybean meal costs as a proxy for livestock feeding profitability. It estimates the spread’s mean and standard deviation from daily bars, calculates a z-score,…
This futures strategy tracks the ratio of copper to aluminum contract values, adjusting each contract’s daily close by its volume multiplier. It calculates the historical mean and standard deviation of that ratio, then uses the current ratio’s z-score to…
This example describes a three-leg futures strategy that treats polyester fiber value minus the weighted costs of PTA and ethylene glycol as a production margin. It estimates the margin’s mean and standard deviation from recent daily bars, then calculates a…
This Chinese-corn-futures example combines the Chande Momentum Oscillator (CMO) with a short moving average to generate long and short entries. Signals include reversals from overbought or oversold levels, CMO crossings of its signal line, and zero-line…
This example describes a short-term price timing strategy for a gold futures contract. It calculates an AR indicator from recent daily bars by comparing the accumulated distance from open to high with the distance from open to low, scaled as a percentage.…
This futures strategy tracks the crush spread formed from soybean, soybean meal, and soybean oil contracts. It weights the three contract prices using an approximate processing ratio, computes the spread as the combined meal and oil value less the soybean…
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…
This example describes a daily gold futures strategy using a 10-bar Aroon calculation. It opens a fixed-size long position when Aroon Up crosses above Aroon Down or when Aroon Up is above 75 while Aroon Down is below 25. The short rules reverse those…
This code builds a synthetic steel mill profit spread from daily futures prices for rebar, iron ore, and coke. It calculates the spread as rebar minus weighted quantities of the two inputs, smooths it with a 15-day moving average, and estimates a standard…