Skip to content
Browse the docs

Rule reference

Ways to sell, shorts, and what cannot run yet

Stops, profit targets and time limits, selling short, and the rules the engine does not run yet. Each one with what it does, its settings, and an example to try.

On this page

Stop loss and trailing stop

A stop sells when the price falls a set amount below where it was bought. A trailing stop follows the price up and sells on a fall of that much from the highest price since the purchase.

Settings in the example below
SettingValue
Faster average50 days
Slower average200 days
Stop10% below
How oftenChecked every trading day
Try in the Strategy Agent

Golden cross on Apple with a 10% trailing stop over the last 5 years

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

Momentum strategy on Nvidia with a 15% stop loss over the last 5 years

Reads as: stop 15% below; how often Checked every trading day.

Try it: open the Strategy Agent with these words typed in, unsent
  • Each is an order at a price level, checked against every day's high and low after the day of the purchase. A stop fills at its level on a day whose low reaches it, or at that day's opening price when the day opens below the level. A target fills at its level on a day whose high reaches it, or at that day's opening price when the day opens above it. The level for a day is set from prices before that day, so a day's own high never lifts the stop it is checked against. A position bought at a day's close is not checked on that day. Daily prices do not show which came first inside a day, so on a day that reaches both a stop and a target the stop is taken.

Selling on a gain

Sells the whole position once it is up a set amount from the price paid. No stop is needed beside it.

The engine's own statement of it: At each trading day the previous close is compared with the average purchase price; at the target or more above it the whole position is sold at that day's close; no stop is needed.

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 Nvidia when it is 8% below its 50-day high; sell when it is up 12% from the purchase price or after 30 trading days, 10% stop loss, over the last 5 years

Reads as: stop 10% below; sells on a gain of 12%; sells after 30 trading days; how often Checked every trading day.

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

Selling after some days

Sells a set number of trading days after the purchase, unless a stop, a target or the rule's own exit sells it first.

The engine's own statement of it: A position bought at the close of trading day T is sold at the close of trading day T + N; a stop, the profit target or the rule's own exit can sell earlier.

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

Golden cross on SPY, sell after 20 days, over the last 10 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

Selling short

Selling short means selling shares you have borrowed and buying them back later: it makes money when the share falls and loses when it rises.

A share can only fall to zero, but it can rise without limit, so a short can lose more than the money put in.

The engine's own statement of it: A timing rule on one share run short or long-or-short, a ranking that sells short its bottom N, and fixed weights with a negative weight; the borrow fee is stated on the request, a short pays its dividends in full, the money from the sale earns no interest, and a run whose account is wiped out is refused; a stop on a short, a short on several timed shares and leverage on top of a short are refused.

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

short Tesla when its 50-day average is below its 200-day average, over the last 5 years

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

long SPY when it is above its 200-day average, short when it is below, 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
Try in the Strategy Agent

Every month hold the 3 stocks with the best 12-month return among Apple, Microsoft, Nvidia, Alphabet, Amazon, Meta and Tesla and short the 2 weakest, over the last 10 years

Reads as: holds the top 3; ranked on the return over the last 12 months; how often Rebalanced every month.

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

long Coca-Cola, short PepsiCo, over the last 10 years

Reads as: weights KO 100%, PEP 100% sold short; how often Rebalanced every month.

Try it: open the Strategy Agent with these words typed in, unsent
  • Borrow fee: assumed 1% a year on the value of the shares sold short, charged every trading day (an assumption: there is no record of what each share really cost to borrow, and a share that is hard to borrow can cost many times more. Say "borrow fee 3%" to change it).
  • Dividends on shares sold short are paid by the account in full.
  • The money from a short sale earns no interest; only the account's own spare cash does.

What cannot run yet

The engine says plainly what it cannot do, and the agent tells you before anything runs. Nothing is charged. These are its own lists:

  • A condition on trading volume: rules read prices only (closes, and the open for a gap).
  • A yearly rebalance: the engine rebalances daily, weekly, monthly or quarterly, or never.
  • Adding money on a schedule: every backtest starts with one amount.

And these kinds of rule:

A post-earnings strategy
The dates companies reported earnings (and whether they beat expectations) are not loaded into the backtest engine, so it cannot buy after an earnings report.
Post-earnings announcement drift
The dates companies reported earnings (and the size of each surprise) are not loaded into the backtest engine, so it cannot buy after an earnings surprise.
An insider-buying strategy
Insider (SEC Form 4) filings are shown on the Smart Money page but are not loaded into the backtest engine, so it cannot buy on the day a filing became public.
A calendar rule
The backtest engine has no rule that buys and sells on calendar dates (months of the year, days of the month, meeting dates), so a calendar rule cannot be run.
A macro regime strategy
The backtest engine reads share prices only: it cannot read a macro series (the yield curve, unemployment, a recession indicator) inside a rule yet.
An inflation regime strategy
The backtest engine reads share prices only: it cannot read the inflation rate (CPI) inside a rule yet.
A credit regime strategy
The backtest engine reads share prices only: it cannot read a credit spread inside a rule yet (and the usual spread series is not licensed for use here).
A pair trade
A pair trade that opens and closes on the gap between two prices is a second rule on a price made from two shares, and that rule is not built (a fixed pair, one share bought and the other sold short in equal amounts, does run).

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