Lesson 0.1.1 · 30 min

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.

Fig. — Two axes to classify a way of trading: how much a rule decides and how much the machine executes (schematic)
01/03
Module
0.1 · Welcome and expectations
Duration
30 min
Prerequisites
None
Updated
Level 0 lessons
  1. 0.1 · Welcome and expectations

    1. 0.1.1 Systematic, algorithmic and quantitative trading versus discretionary trading
    2. 0.1.2 Realistic expectations: costs, time and risk of loss
    3. 0.1.3 Course structure, entry tests, personal repository and learning with AI
  2. 0.2 · Modern working environment

    1. 0.2.1 Installing Python with uv: versions and support cycle
    2. 0.2.2 Virtual environments and dependencies: uv init, uv add, pyproject.toml and lockfiles
    3. 0.2.3 Editors (VS Code, Cursor, PyCharm) and notebooks (Jupyter, JupyterLab, marimo)
    4. 0.2.4 Basic terminal, paths, environment variables and .env files
    5. 0.2.5 Git and GitHub: commits, branches, pull requests and .gitignore
    6. 0.2.6 Introduction to AI coding assistants: prompts, review and tests
  3. 0.3 · Language fundamentals

    1. 0.3.1 Variables, types and operators; floating point and decimal for prices and ticks
    2. 0.3.2 Strings, f-strings and formatting numbers and dates
    3. 0.3.3 Lists, tuples, dictionaries, sets and comprehensions
    4. 0.3.4 Control flow: if, elif, else, for, while and match-case
    5. 0.3.5 Functions: arguments, *args and **kwargs, lambdas and scope
    6. 0.3.6 Exceptions; modules and packages, with Python 3.15 lazy imports
  4. 0.4 · Intermediate Python

    1. 0.4.1 Object-oriented programming: classes, inheritance, composition and dataclasses
    2. 0.4.2 Typing: type hints, mypy or ty, and Pydantic for configurations
    3. 0.4.3 Iterators, generators, decorators and context managers
    4. 0.4.4 Files (CSV, JSON, YAML, TOML) and dates with time zones
    5. 0.4.5 Professional logging and testing with pytest
    6. 0.4.6 Concurrency: threading, multiprocessing, asyncio and free-threading
  5. 0.5 · Numerical computing and data

    1. 0.5.1 NumPy 2: arrays, broadcasting, vectorization, linear algebra and random generators
    2. 0.5.2 pandas 3.0: Series, DataFrame, time indexes, Copy-on-Write, the str type and pd.col()
    3. 0.5.3 Selection, filtering, groupby, merge, pivot, resample and moving windows
    4. 0.5.4 Polars: lazy versus eager API, expressions, performance and when to pick it over pandas
    5. 0.5.5 DuckDB and essential SQL: SELECT, JOIN, GROUP BY and window functions on Parquet
  6. 0.6 · Visualisation

    1. 0.6.1 Object-oriented Matplotlib, Seaborn and Plotly: price, drawdown and candlestick charts
    2. 0.6.2 Quick dashboards with Streamlit: a monitoring dashboard in a single script
  7. 0.7 · Minimum mathematics and statistics

    1. 0.7.1 Simple and log returns, compound interest and descriptive statistics
    2. 0.7.2 Probability and distributions, correlation versus causation and simple regression
    3. 0.7.3 Intuitive linear algebra: vectors and matrices as groundwork for portfolios

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.

TermAnswersWhat it meansExample
DiscretionaryWho decides?A person decides each trade with their own judgment, even if they use indicatorsBuying because the chart "looks like" it is turning
SystematicWho decides?A written rule decides; the person only applies itBuying if the 50-session average crosses above the 200-session one
AlgorithmicWho executes?A program sends, splits or manages the ordersA VWAP algorithm that spreads a purchase over the day
QuantitativeHow is it built?The rules and the position sizing come from a statistical analysis of data and are validated with itA 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:

MarketTrader decidesOrderMarketDataRule decidesOrder
Mermaid source
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.

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.

IN [01]python
import pandas as pd

precios = pd.read_csv("sint_diario.csv", parse_dates=["fecha"],
                      index_col="fecha")
precios["cierre"].tail(3)
OUT [01]SINT prices
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:

IN [02]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()
OUT [02]The rule as a function
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:

IN [03]python
senal.equals(senal_cruce(precios["cierre"]))
OUT [03]Reproducibility
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:

IN [04]python
# 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%}")
OUT [04]From signal to position
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

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.

  1. 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.

  1. 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
IN [05]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%}")
OUT [05]Parameters 20 and 100
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.

Each answer is folded under its question

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?

    • AAutomated systematic
    • BDiscretionary in the decision, algorithmic in the execution
    • CQuantitative
    • DManual systematic
    Show answer

    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?

    • AIt makes more money
    • BIt has no losses
    • CGiven the same data it always produces the same decision, so it can be tested on the past
    • DIt needs no data
    Show answer

    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?

    • ATo make the code faster
    • BBecause 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
    • CBecause pandas requires it
    • DTo reduce commissions
    Show answer

    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?

    • AThat it uses machine learning
    • BThat it trades very fast
    • CThat its rules and its position sizing come from a statistical analysis of data and are validated with it
    • DThat it has many rules
    Show answer

    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