Skip to content
Browse the docs

Rule reference

Conditions you can combine

The single tests a rule of several conditions is built from, each of which can also stand alone. Each one with what it does, its settings, and an example to try.

On this page

Price against its moving average

The close above or below its simple or exponential moving average. On its own it is the trend filter many people know.

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy SPY when the close is above its 200-day SMA; sell when the close is below its 200-day SMA, over the last 10 years

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

One moving average against another

A faster average above, below or crossing a slower one. Combined with a filter, it buys only when the filter also holds.

When
SMA(50) is above SMA(200) and RSI(14) is below 70
Then
Buy; the symbols that are in share the portfolio equally
Otherwise
Sell when SMA(50) falls below SMA(200); the RSI condition only decides when to buy
How often
Checked every trading day
Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy QQQ when its 20-day EMA crosses above its 50-day EMA and RSI(14) is below 70, over the last 5 years

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

Golden cross on SPY but only buy when RSI is under 70, over the last 10 years

Reads as: how often Checked every trading day.

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

Recorded tests of combined conditions rules, beside simply holding, in the evidence explorer.

RSI above or below a level

The RSI over any length against a level. A short RSI, such as two days, reacts to very short dips.

When
The close is above its 200-day SMA and RSI(2) is below 10
Then
Buy; the symbols that are in share the portfolio equally
Otherwise
Sell when RSI(2) is above 70
How often
Checked every trading day
Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy QQQ when the price is above its 200-day SMA and RSI(14) is below 40; sell when RSI(14) rises above 70, 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(2) is below 10 while the close is above its 200-day SMA; sell when RSI(2) is above 70, over the last 10 years

Reads as: how often Checked every trading day.

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

Recorded tests of combined conditions rules, beside simply holding, in the evidence explorer.

MACD crossing its signal line

The MACD line crossing above or below its signal line, as a condition beside others.

When
MACD(12,26,9) crosses above its signal line while the close is above its 200-day SMA
Then
Buy; the symbols that are in share the portfolio equally
Otherwise
Sell when MACD crosses back below its signal line
How often
Checked every trading day
Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy SPY when MACD crosses above its signal line while price is above the 200-day SMA, exit when MACD crosses back below. Backtest over 10 years.

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

Recorded tests of combined conditions rules, beside simply holding, in the evidence explorer.

Price against a Bollinger band

The close below the lower band, above the upper band, or either side of the middle line.

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy QQQ when the price is below the lower Bollinger band and RSI(14) is below 30; sell when RSI(14) rises above 50, over the last 5 years

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

A new high or low (channel break)

The close breaking above the highest close, or below the lowest, of the last so many trading days.

When
The close breaks above the highest close of the previous 20 trading days while it is above its 50-day EMA
Then
Buy; the symbols that are in share the portfolio equally
Otherwise
Only the 8% trailing stop sells
How often
Checked every trading day
Settings in the example below
SettingValue
Stop8% below
How oftenChecked every trading day
Try in the Strategy Agent

Buy SPY on a 20-day breakout if it's above its 50-day EMA, 8% trailing stop. Backtest over 10 years.

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

Recorded tests of combined conditions rules, beside simply holding, in the evidence explorer.

A rise or fall over some days

The close against the close a number of trading days earlier: a fall of so much in a day, or a rise over a month.

The engine's own statement of it: The close against the close N trading days earlier (N = 1 for a one-day fall).

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy Tesla when its 20-day return is below -10%; sell when its 20-day return is above 15%, over the last 5 years

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

Buy Apple when it drops 3% in a day and hold for 10 days, over the last 10 years

Reads as: sells after 10 trading days; how often Checked every trading day.

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

A fall from a recent high

How far the close is below its highest close of the last so many trading days.

The engine's own statement of it: The close against the highest close of the last N trading days, that close included; with no window named the reader uses 252 and says so.

Settings in the example below
SettingValue
Sells on a gain of15%
How oftenChecked every trading day
Try in the Strategy Agent

Buy Nvidia when it is 10% below its 50-day high, sell after a 15% gain, over the last 5 years

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

buy Tesla when it drops 10% and sell when it's back up 15%, over the last 10 years

Reads as: sells on a gain of 15%; how often Checked every trading day.

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

A market-wide series against a level (the VIX)

A stored daily series that is not a share price, against a level. Today the agent reads the VIX's close, a measure of how much traders expect prices to swing.

The engine's own statement of it: The engine reads any stored daily series by id against a level, on its own values dated before the day of the trade; the reader offers the VIX's close only ("the VIX is below 25"); a monthly or quarterly series is refused because it is stored under the period it describes, not the day it was published.

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy SPY when the VIX is below 20 and sell when the VIX is above 30, over the last 10 years

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

A gap at the open

The day's opening price against the day before: a gap up or down of so much from the previous close, or an open above the previous high or below the previous low.

A rule that buys on a gap up and names no way to sell is given a stop below the gap, and the card says so.

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy Nvidia when it gaps up 2% and sell when it closes back below the gap, over the last 2 years

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

Buy QQQ when it gaps down 2%; sell when its 5-day return is positive, over the last 10 years

Reads as: how often Checked every trading day.

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

A condition read on another symbol

Any condition can be read on another symbol, such as the S&P 500 fund, so a rule trades one thing while watching another. Often used as a market filter.

The engine's own statement of it: The condition is worked out on that symbol's own daily closes dated before the day of the trade; on a day it has no close its last earlier one is used if at most 7 calendar days older, otherwise nothing is run; "the market" is read as SPY and the card says so.

Settings in the example below
SettingValue
How oftenChecked every trading day
Try in the Strategy Agent

Buy TLT when SPY is below its 200-day SMA, sell when SPY is above its 200-day SMA, over the last 10 years

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

Golden cross on QQQ, only taking trades while SPY is above its 200 day average, over the last 10 years

Reads as: how often Checked every trading day.

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

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