Skip to content
Browse the docs

Rule reference

Timing rules: in or out of one share

Rules that decide, each day, whether to hold a share or fund or to sit in cash. Each one with what it does, its settings, and an example to try.

On this page

Moving average crossover (golden cross)

A moving average is the average closing price over the last so many days. This rule holds the share while a faster average is above a slower one, and holds cash when it falls below.

With the faster average set to one day, the rule compares the price itself with its average: in while the close is above it, out when it is below.

When
The 50-day simple moving average is above the 200-day simple moving average
Then
Hold the instrument with the whole portfolio
Otherwise
Sell and hold cash when the 50-day falls back below the 200-day
How often
Checked every trading day
Settings used when you name none
SettingValue
Faster average50 days
Slower average200 days
How oftenChecked every trading day
Try in the Strategy Agent

Moving average crossover on SPY over the last 5 years

Try it: open the Strategy Agent with these words typed in, unsent
Try in the Strategy Agent

Golden cross strategy on SPY over the last 10 years

Reads as: faster average 50 days; slower average 200 days; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent
Try in the Strategy Agent

Golden cross strategy on the FTSE 100 fund over the last 5 years

Reads as: faster average 50 days; slower average 200 days; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent

Templates in the community library that use it:

  • Golden cross on SPY: Own the S&P 500 while its 50-day average is above its 200-day average, and sit in cash when it isn't.
  • SPY above its 10-month average: Hold the S&P 500 while it closes above its roughly 10-month (210-day) moving average, otherwise cash.
  • Golden cross on QQQ: Own the Nasdaq 100 while its 50-day average is above its 200-day average, and sit in cash when it isn't.
  • Golden cross on the total US market: Own VTI (the whole US stock market) while its 50-day average is above its 200-day average.
  • Small-cap golden cross on IWM: Own US small caps (IWM) only while their 50-day average is above the 200-day average.
  • Tech sector golden cross on XLK: Own the technology sector ETF while its 50-day average is above its 200-day average.
  • Gold trend: 20/100-day crossover on GLD: Hold gold (GLD) while its 20-day average is above its 100-day average; a faster trend rule than the golden cross.

Recorded tests of trend (moving averages) rules, beside simply holding, in the evidence explorer.

Explained step by step in the Education Centre.

Exponential moving average crossover

The same idea with exponential averages, which count recent days for more, so they turn sooner after a change of direction.

Settings used when you name none
SettingValue
Faster average12 days
Slower average26 days
How oftenChecked every trading day
Try in the Strategy Agent

EMA crossover on QQQ over the last 5 years

Try it: open the Strategy Agent with these words typed in, unsent
  • An exponential average needs a long run of past prices before it settles, so the test reads more history before its first day than a simple average does. The result says how much it read.

RSI dip (mean reversion)

RSI scores the recent rises against the recent falls, from 0 to 100: a low score means mostly falls. This rule buys when the score drops below a low level and sells once it has climbed back above a higher one.

When
The 14-day RSI drops below 30
Then
Buy the instrument with the whole portfolio
Otherwise
Exit to cash when RSI rises back above 50
How often
Checked every trading day
Settings used when you name none
SettingValue
RSI length14 days
Buys when RSI is below30
Sells when RSI is above50
How oftenChecked every trading day
Try in the Strategy Agent

RSI strategy on Apple over the last 5 years

Try it: open the Strategy Agent with these words typed in, unsent
Try in the Strategy Agent

Buy SPY when RSI(14) drops below 30 and sell when it rises above 70, over the last 10 years

Reads as: rsi length 14 days; buys when rsi is below 30; sells when rsi is above 70; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent
Try in the Strategy Agent

RSI strategy on Tesla, buy under 30, sell over 70.

Reads as: rsi length 14 days; buys when rsi is below 30; sells when rsi is above 70; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent

Templates in the community library that use it:

  • Buy the dip on SPY with RSI: Buy the S&P 500 when its 14-day RSI says it's oversold, and exit once RSI recovers above 50.
  • Buy the dip on QQQ with RSI: Buy the Nasdaq 100 when its 14-day RSI says it's oversold, and exit once RSI recovers above 50.
  • RSI dip-buying on Apple: Buy Apple when its 14-day RSI drops below 30, and exit once RSI recovers above 50.
  • Financials dip-buying: RSI on XLF: Buy the financial sector ETF when its 14-day RSI drops below 30, and exit once RSI recovers above 50.

Recorded tests of mean reversion (rsi) rules, beside simply holding, in the evidence explorer.

Explained step by step in the Education Centre.

  • Name only a buying level and the agent sets the selling level for you, and the card says which it used.

Breakout (Donchian channel)

Buys when the close is the highest of the last so many trading days, and sells when the close is the lowest of the same number of days.

When
The close is above the highest close of the previous 20 trading days
Then
Buy the instrument with the whole portfolio
Otherwise
Exit to cash when the close is below the lowest close of the previous 20 trading days
How often
Checked every trading day
Settings used when you name none
SettingValue
Channelthe last 20 trading days
How oftenChecked every trading day
Try in the Strategy Agent

Breakout strategy on GLD over the last 5 years

Try it: open the Strategy Agent with these words typed in, unsent
Try in the Strategy Agent

20-day breakout strategy on Nvidia over the last 5 years

Reads as: channel the last 20 trading days; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent

Templates in the community library that use it:

  • 20-day breakout on SPY: Buy the S&P 500 when it closes at a new 20-day high, and exit when it closes at a new 20-day low.
  • Turtle-style 55-day breakout on gold: Buy GLD on a close above its 55-day high and exit on a close below its 55-day low.
  • 20-day breakout on NVIDIA: Buy Nvidia when it closes at a new 20-day high, and exit when it closes at a new 20-day low.

Recorded tests of breakout (donchian) rules, beside simply holding, in the evidence explorer.

MACD crossover

MACD is the gap between a fast and a slow exponential average, and its signal line is an average of that gap. The rule buys when the gap crosses above its signal line and sells when it crosses back below.

Settings used when you name none
SettingValue
Faster average12 days
Slower average26 days
Signal line9 days
How oftenChecked every trading day
Try in the Strategy Agent

MACD strategy on SPY over the last 10 years

Try it: open the Strategy Agent with these words typed in, unsent
  • Like any exponential average, MACD reads a long run of past prices before the test's first day.

Bollinger bands

The bands sit a set number of standard deviations above and below a moving average, so they widen when prices swing more. The rule buys when the close falls below the lower band and sells when it is back at the middle line.

Settings used when you name none
SettingValue
Band length20 days
Band width2 standard deviations
Sells atthe middle line
How oftenChecked every trading day
Try in the Strategy Agent

Bollinger band strategy on SPY over the last 5 years

Try it: open the Strategy Agent with these words typed in, unsent
  • Say "sell at the upper band" to sell there instead of at the middle line.

These pages describe how Quantis Trade works and what its tests show about the past. They are not forecasts and not advice.