---
title: "0.1.1 Systematic, algorithmic and quantitative trading"
description: "What separates discretionary trading from systematic, algorithmic and quantitative trading, with two axes to classify them and a first rule in Python."
url: "https://pythonparatrading.com/en/python-trading-course/level-0/systematic-algorithmic-quantitative-trading/"
lang: "en"
image: "https://pythonparatrading.com/og/en/python-trading-course/level-0/systematic-algorithmic-quantitative-trading.png"
---

# 0.1.1 · Systematic, algorithmic and quantitative trading versus discretionary trading

> Four words used as synonyms that are not synonyms. Before writing a line of code, you need to know what a rule decides, what a machine executes and what statistics adds.

- Course: [Level 0: Python from scratch and a data mindset](https://pythonparatrading.com/en/python-trading-course/level-0/)
- Module: 0.1 · Welcome and expectations
- Duration: 30 min
- Prerequisites: None

## By the end of this lesson

- Distinguish discretionary, systematic, algorithmic and quantitative trading, and place any way of trading on two axes: who decides and who executes.
- Explain what a decision gains and what it loses when it becomes a written rule.
- Read a trading rule written in Python and recognize the one-day lag between the signal and the trade.

## Four words that get misused

Forums, courses and broker ads talk about "algorithmic", "systematic" and "quantitative" trading as if they were the
same thing. They are not, and mixing them up leads to expensive mistakes: believing that automating an idea turns it
into a tested strategy, or that using machine learning makes a system quantitative.

| Term | Answers | What it means | Example |
|---|---|---|---|
| Discretionary | Who decides? | A person decides each trade with their own judgment, even if they use indicators | Buying because the chart "looks like" it is turning |
| Systematic | Who decides? | A written rule decides; the person only applies it | Buying if the 50-session average crosses above the 200-session one |
| Algorithmic | Who executes? | A program sends, splits or manages the orders | A VWAP algorithm that spreads a purchase over the day |
| Quantitative | How is it built? | The rules and the position sizing come from a statistical analysis of data and are validated with it | A mean-reversion rule tested against data, with costs and out of sample |

The first two rows answer the same question; the third, a different one; the fourth, yet another. That is why they can
be combined: there are discretionary traders who execute with algorithms, systems applied by hand and automated systems
that nobody has ever validated.

## Two axes, not a scale

The figure at the top arranges these combinations on a plane. The horizontal axis measures how much of the decision
lies in explicit rules; the vertical one, how much of the execution is done by a machine.

- **Bottom left**: discretionary trading. A checklist ("no trading before employment data", "stop always below the last
  low") moves the point to the right, but the decision still belongs to the person.
- **Bottom right**: manual systematic trading. The rule decides and the person enters the order at the broker. This is
  how many low-frequency systems start.
- **Top left**: algorithmic execution of human decisions. This is the norm at an asset manager: the manager decides what
  to buy and the desk uses algorithms to buy it with the least impact.
- **Top right**: automated systematic trading, the goal of this course. The rule decides, the program executes and the
  person supervises. In the corner, the highest-frequency quantitative strategies (statistical arbitrage, market
  making), where neither the decision nor the execution goes through a person.

Quantitative has no box of its own because it is not a position on the plane: it is a way of getting there. A system in
the top right corner is quantitative only if its rules came from data and were validated with it.

## What changes when the decision is a rule

Moving from the head to paper, and from paper to code, changes the nature of the decision. In the top row, the
discretionary decision; in the bottom one, the systematic decision, which can also be tested on the past:

```mermaid
flowchart LR
  M1[Market] --> P[Trader decides] --> O1[Order]
  M2[Market] --> DT[Data] --> R[Rule decides] --> O2[Order]
```

What you gain:

- **Reproducibility.** Given the same data, the rule always makes the same decision. That allows testing it on the past
  (backtest) and comparing versions.
- **Measurement.** If the rule is written down, you can count how many trades it makes, how much they cost and how much
  each one gains or loses. An intuition cannot be measured.
- **Scale.** The same rule applies to a hundred assets with the same effort as to one.
- **Discipline.** The rule feels no fear and no hurry. The person who supervises it does: the most frequent mistake of
  a systematic trader is not in the rule, but in switching it off after three losses in a row.

What you lose:

- **Context.** A rule only sees what it is given. A regime change (a crisis, a shift in monetary policy) can break it
  without the rule noticing.
- **Flexibility.** Each exception ("unless…") is one more rule, one more thing to validate and one more chance to
  overfit.

<aside class="callout" data-kind="aviso">

Systematic does not mean profitable. A written rule only guarantees that its result can be measured. A large part of
this course (levels 2 and 5) is about how to measure it without fooling yourself.

</aside>

## A rule written in Python

You do not need to understand every line yet: the language is covered in module 0.3 and pandas in 0.5. The idea is to
see what a rule looks like once it stops being a sentence. The data are the daily prices of **SINT**, a fictitious ETF
generated for the course (link in "Resources"): five years of sessions, from 2021 to 2025.

```python
import pandas as pd

precios = pd.read_csv("sint_diario.csv", parse_dates=["fecha"],
                      index_col="fecha")
precios["cierre"].tail(3)
```
```output
fecha
2025-12-29    139.56
2025-12-30    139.98
2025-12-31    142.22
Name: cierre, dtype: float64
```

The rule: be long when the 50-session moving average is above the 200-session one, and out of the market otherwise.
Written as a function, it takes a series of closes and returns a 1 or a 0 for each day:

```python
def senal_cruce(cierre: pd.Series, rapida: int = 50,
                lenta: int = 200) -> pd.Series:
    """1 if the fast average closes above the slow one; 0 otherwise."""
    media_rapida = cierre.rolling(rapida).mean()
    media_lenta = cierre.rolling(lenta).mean()
    return (media_rapida > media_lenta).astype(int)

senal = senal_cruce(precios["cierre"])
senal.value_counts()
```
```output
cierre
1    834
0    469
Name: count, dtype: int64
```

The zeros include the first 199 days, when there is still no 200-session average to compare against. Running the rule
twice on the same data gives exactly the same result. It looks trivial, and it is the property that makes everything
else possible:

```python
senal.equals(senal_cruce(precios["cierre"]))
```
```output
True
```

One detail remains that separates an honest backtest from an inflated one. A day's signal is computed with its
**close**: until the market closes, you do not know whether the fast average ended above the slow one. So the trade can
only be made from the next session on. In code, the position is the signal shifted by one day:

```python {2}
# the signal from the close is traded the next day
posicion = senal.shift(1).fillna(0).astype(int)
cambios = int(posicion.diff().abs().sum())
dias_dentro = posicion.mean()
print(f"Position changes in five years: {cambios}")
print(f"Days long: {dias_dentro:.1%}")
```
```output
Position changes in five years: 9
Days long: 63.9%
```

Using `senal` instead of `posicion` would mean buying at today's close with information from today's close itself.
That mistake has a name, **look-ahead bias**, and it is the most common one in systematic trading: a backtest that
contains it always looks better than what the strategy can deliver. It will come back in almost every level of the
course.

## What makes a system quantitative

The rule above is systematic and, as soon as it is connected to a broker, algorithmic. Is it quantitative? Not yet:
nobody has checked with data whether the parameters 50 and 200 make sense, how much it costs to trade, whether it works
on other assets or whether its result can be told apart from chance. That is what the course calls the quantitative
method, and it is the thread running through every level:

*Fig. — Course methodology: from data to monitoring.* Seven-step diagram in two rows: clean data, hypothesis, honest backtest (highlighted), statistical validation, risk, execution and monitoring, with a dashed arrow from monitoring back to the hypothesis. Note: paper trading before trading real money.

Clean data, hypothesis, honest backtest, statistical validation, risk, execution and monitoring. A system with a single
moving average that has gone through that cycle is more quantitative than a neural network that nobody has validated.

## Exercises

1. Classify these five ways of trading on the two axes (who decides, who executes) and say which ones could be
   quantitative: (a) a Telegram bot that forwards a "guru's" signals and executes them in your account; (b) a 60/40
   portfolio rebalanced by hand every January; (c) a fund that buys the 50 stocks with the best 12-month momentum,
   tested against 30 years of data; (d) a futures trader who trades breakouts "when he sees volume"; (e) a TWAP
   algorithm that executes the sale of a block of shares decided by a committee.

**Solution.**

(a) The decision is discretionary (the "guru" makes it) and the execution algorithmic; it is not quantitative: nobody
has validated the signals. (b) Manual systematic: the rule ("go back to 60/40 every January") decides and a person
executes; it can be quantitative if the allocation and the frequency were chosen with data. (c) Systematic and, if it
executes by program, algorithmic; it is the only clearly quantitative one. (d) Discretionary and manual: "when he sees
volume" is not a written rule. (e) Discretionary in the decision (the committee) and algorithmic in the execution.

2. This rule looks clear: "buy when the price breaks the high of the last 20 sessions and sell when it breaks the low
   of the last 10". Write three questions a programmer would have to ask you before being able to code it.

**Solution.**

Some possibilities: does "break" mean that the close exceeds the high, or that the intraday high touches it? Does the
20-session high include today's session (which would make it impossible to break at the close)? Do you buy at the close
of the breakout or at the next open? What happens if you are already long and there is another breakout? Can you go
short when the low breaks, or do you only close the position? Each answer changes the backtest result; a rule is not
written until it leaves none of these questions open.

3. Change the rule's parameters to 20 and 100 sessions and compute the number of position changes and the percentage of
   days long. Why does the number of trades change so much?

**Solution.**

```python
senal_rapida = senal_cruce(precios["cierre"], rapida=20, lenta=100)
posicion_rapida = senal_rapida.shift(1).fillna(0).astype(int)
print(f"Position changes: {int(posicion_rapida.diff().abs().sum())}")
print(f"Days long: {posicion_rapida.mean():.1%}")
```
```output
Position changes: 23
Days long: 61.9%
```

Short averages react sooner to each move, so they cross more often: more trades, more costs (lesson 0.1.2) and more
risk that the result depends on how the parameters were chosen.

## Self-assessment

1. A manager decides every morning what to buy by reading the news and sends the orders to a VWAP algorithm that spreads them over the day. How is this classified?

   - A. Automated systematic
   - B. Discretionary in the decision, algorithmic in the execution
   - C. Quantitative
   - D. Manual systematic

   *Answer B: Discretionary in the decision, algorithmic in the execution.* The decision does not follow a written rule (discretionary); only the execution is automated. Algorithmic describes how a trade is executed, not how it is decided.

2. What property does a written rule have that a discretionary decision lacks?

   - A. It makes more money
   - B. It has no losses
   - C. Given the same data it always produces the same decision, so it can be tested on the past
   - D. It needs no data

   *Answer C: Given the same data it always produces the same decision, so it can be tested on the past.* Reproducibility is what makes backtesting and validation possible. It says nothing about return.

3. In the lesson's code, why is the position `senal.shift(1)` and not `senal`?

   - A. To make the code faster
   - B. Because the signal is computed with the day's close and can only be traded from that moment on: using `senal` without shifting it would be look-ahead bias
   - C. Because pandas requires it
   - D. To reduce commissions

   *Answer B: Because the signal is computed with the day's close and can only be traded from that moment on: using `senal` without shifting it would be look-ahead bias.* With an unshifted `senal`, the backtest would buy at today's close using information from today's close itself and collect that same day's move. It is the most common mistake in systematic trading, and it shows up from the very first lesson.

4. What makes a system quantitative?

   - A. That it uses machine learning
   - B. That it trades very fast
   - C. That its rules and its position sizing come from a statistical analysis of data and are validated with it
   - D. That it has many rules

   *Answer C: That its rules and its position sizing come from a statistical analysis of data and are validated with it.* A system with a single moving average can be quantitative if the rule was tested against data; one with a neural network may not be if nobody measured whether it works.

## Key points

- Discretionary and systematic are about who decides; manual and algorithmic, about who executes. They are two axes, not a scale.
- Quantitative describes the method: the rule and the risk come from data and are validated with statistics.
- A written rule is reproducible: it can be tested, measured and repeated. That does not make it profitable.
- A signal from a close is traded after that close. Forgetting it (look-ahead bias) inflates any backtest.

## Resources

### Research

- [Your first system in Python: moving average crossover on SPY](https://pythonparatrading.com/en/first-system-moving-average-crossover/) · Research-0018 · 7 min
- [Introduction to Quant Research](https://pythonparatrading.com/en/quant-research-2/) · Research-0023 · 8 min

### Books

- [Ernest P. Chan, Quantitative Trading, 2nd ed. (Wiley, 2021)](https://www.wiley.com/en-us/Quantitative+Trading%3A+How+to+Build+Your+Own+Algorithmic+Trading+Business%2C+2nd+Edition-p-9781119800064) · wiley.com
- [Robert Carver, Systematic Trading (Harriman House, 2015)](https://www.systematicmoney.org/systematic-trading) · systematicmoney.org

### Data

- [Level 0 data: daily prices of the fictitious ETF SINT (CSV)](https://pythonparatrading.com/curso/datos/nivel-0/sint_diario.csv) · Download · sint_diario.csv

Next lesson: [0.1.2 · Realistic expectations: costs, time and risk of loss](https://pythonparatrading.com/en/python-trading-course/level-0/realistic-trading-expectations-costs-risk/)
