The script trades a spread between Dalian Commodity Exchange coke and coking coal futures. It estimates the spread from each contract's close, volume multiplier, and a fixed contract ratio, then calculates a z-score from a rolling set of daily observations.…
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
114 documents
This calendar-based strategy attempts to buy gold at the start of Friday’s session and close the position later in the session. It includes configurable start and end dates for backtesting, along with commission, slippage, order-processing, and position-size…
The document introduces a session-based momentum scalper for FCPO, with configurable presets for different chart intervals and a custom mode for manual take-profit and stop-loss settings. Its listed filters include an ATR ceiling and floor, minimum…
The described approach trades XAUUSD using a short and long simple moving average. A cross of the 30-period average above the 200-period average signals a long position, while a cross below signals a short position. The accompanying code also plots a…
This example applies a z-score to daily closing prices for a gold futures contract. It calculates the mean and standard deviation over a rolling window, then compares the latest close with that mean in standard deviation units. When flat, it buys after a…
This strategy uses a short and long simple moving average to generate directional trades. The description presents a 30-day average crossing a 200-day average as the long or short signal, with a fixed 40,000-point stop and target and a reversal when the…
This example demonstrates adding futures subscriptions for an equity index and a metal with extended market hours. It applies an expiration filter to each futures chain, then inspects available contracts and selects one whose expiry is more than 90 days…
This gold trading framework uses one-minute Heikin Ashi charts and Chandelier Exit as its primary directional signal. Traders can require agreement from an EMA filter, SuperTrend, and Schaff Trend Cycle before taking a trade. Signals can expire after a…
This strategy looks for price to pierce a confirmed pivot support or resistance level by an ATR-based buffer, then close back across that level within a short window. It enters long after a downward sweep or short after an upward sweep, optionally requiring…
This example trades a spread between continuous Light Sweet Crude Oil and RBOB Gasoline futures. It estimates a return relationship by regressing crude returns on gasoline returns over a rolling history, then measures the recent spread against its mean and…
This example applies the Commodity Channel Index to daily gold futures data as a threshold-based mean-reversion strategy. It enters long when CCI recovers from below its lower threshold into the middle zone, and enters short when it falls from above its…
This script outlines an intraday breakout system for a 15-minute chart, using a fixed price grid with configurable round-level spacing and offsets. It tracks levels below and above price, then looks for a confirmed candle that crosses an offset level. Long…
This trend-following method combines the Average Directional Index (ADX) with a fixed lookback price comparison. When ADX exceeds 10, a close crossing above its level 65 bars earlier generates a long signal; a crossing below generates a short signal. The…
This XAUUSD strategy combines a moving-average trend filter with price crossovers. It treats the market as bullish when the 20-period EMA is above the 50-period EMA and enters long when price crosses above the faster average. It enters short under the…
This document describes a JavaScript library for managing commodity futures positions through a CTP exchange interface. Its functions aggregate positions by contract and direction, submit or close orders, cancel pending orders, and report account balance…
This daily GLD strategy applies a fixed linear score to five features derived from price and volume, including short moving averages and interaction terms. The feature weights and normalization constants are embedded in the script, and the strategy holds a…
This model describes a seasonal approach to selling agricultural commodity futures, originally presented by Perry J. Kaufman to commodity producers. Its premise is that prices for crops with one annual harvest may tend to be weakest around harvest and…
This gold strategy builds an opening range during the 13:00–14:00 UTC hour on weekdays, then looks for a long breakout during a later entry window. A signal requires price to cross above the range high, a bullish bar, elevated volume, and volatility…
This intraday strategy builds a high-low range during the Asia session, defined in New York time, then trades breakouts during a following morning window. A close beyond the range, with a configurable tick buffer, triggers a long or short entry. An optional…
The script builds a daily high-low range during a configured Asia session, then permits close-confirmed breakouts during a later trading window. A long entry requires a close crossing above the range high and, when enabled, above an exponential moving…
This strategy combines moving-average crossovers, RSI thresholds, and candlestick engulfing patterns to generate long and short signals. Its explanation uses a 21-day average crossing the 200-day average as the primary direction signal, with the 50-day…
This short-term strategy uses a long-term exponential moving average to set directional bias, then looks for a cross of the 20-period average confirmed by RSI. It enters long when price is above the 200-period average, crosses above the 20-period average,…
The Commodity Selection Index (CSI) combines Average True Range, which reflects price range, with Average Directional Index information to rank commodities by volatility and trend strength. The described approach compares CSI with its own simple moving…
This Pine Script strategy trades gold using crossovers of 9-period and 21-period exponential moving averages, taking signals only when the ADX value exceeds 15 and the chart time falls within the specified weekday session. It places long and short entries on…