Rearview Download

Futures trend, long or flat

Trend following on futures, long or flat: hold a chain while it is above its 100-day average and has risen over the last 50 days, and step aside when it closes below its 50-day average. Each position risks 1% of equity to an ATR stop, counted in contracts at the chain's point value, so a quiet market and a jumpy one add similar risk. Indicators read each chain adjusted across its rolls; fills are at the prices of the contract held, and a held chain rolls on its own. A cash account backs every contract with cash for its full value, so it never borrows; a contract of a stock index future is worth $100,000 or more, so give the run a few million dollars.

Futures · futures/futures_trend.rvw

language 1
strategy "Futures trend, long or flat" {
  universe   futures
  enter long when close > sma(close, 100) and roc(close, 50) > 0
  rank by    roc(close, 50)
  stop       3 x atr(20)
  size       risk 1% with stop, max 3 positions
  max position 40%
  exit when  close < sma(close, exit_days)
  param      exit_days = 50 in 20..100 step 10
}

Functions it uses

sma, roc, atr

Try it

These need futures chains with their rolls, such as one file per contract converted with rvw convert futures. stocks_and_futures.rvwp holds the market ETF strategy and the futures trend in sleeves of 70% and 30%, rebalanced each month. See Futures and their rolls.

File ▸ New Script from Example adds it to a project. The examples read the sample’s index label, SYN500, and market ETF, SYNSPY; when your data has neither, a sheet asks what to read instead, one of your index labels (or every stock and ETF) and a ticker, so the example runs on your data as it is.

Before you trust what it does on your data, see whether it’s luck: Is this result luck?