Rearview Download

Coin trend with a market filter

Coin trend with a market filter: hold the coins that trend up, but only while the stock market does too. A coin is bought when it closes above its 50-day average and the broad market ETF is above its 200-day average; on a weekend the ETF's values are Friday's. Coins trade every day, so a coin's average counts every day and the run's figures use a 365-day year. Coins are never shorted, and a Reg T account buys them with cash.

Coins · coins/coin_trend.rvw

language 1
strategy "Coin trend with a market filter" {
  universe   crypto
  regime     close("SYNSPY") > sma(close("SYNSPY"), 200)
  enter long when regime and close > sma(close, days)
  exit when  close < sma(close, days) or not regime
  rank by    roc(close, days)
  size       30% of equity, max 3 positions
  param      days = 50 in 20..100 step 10
}

Functions it uses

sma, roc

Try it

These need data with coins in it beside the market ETF, such as Yahoo Finance’s daily files converted with rvw convert ohlcv --crypto. stocks_and_coins.rvwp, beside the script, holds the market ETF strategy and the coin trend in sleeves of 80% and 20%, rebalanced each month. See Coins and the exchange’s days.

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?