Skip to content
Edition NigeriaGlobal
Country: Mexico

You are in the Mexico edition. Type your country to switch.

The Americas

Set up your profile

You are learning in the Mexico edition, with examples in pesos and from Mexico.

Algorithmic trading · Lesson 2 of 8

From idea to rules: a hypothesis, data and a test that could prove you wrong

An algorithm needs rules precise enough for a computer: what to trade, when to enter, how much and when to leave. Before writing them, a careful researcher writes down why the idea should work, what would prove it wrong, and which data will be used, so that the test cannot quietly bend to fit the result.

Advanced11 min read5 steps

This lesson is complete in writing. A video for it is on its way.

What you will learn

  • By the end you can turn a loose trading idea into exact rules a computer could follow.
  • You can name the three main sources of a lasting edge and test an idea against them.
  • You can write down, before testing, what result would prove an idea wrong.
  • You can keep a research log that records every version tried, and explain why the count matters.

Key terms in this lesson

Hypothesis
A testable statement of what you expect to find, with evidence that would prove it wrong.
Null hypothesis
The plain explanation a statistical test tries to rule out, such as 'the strategy's true average excess return is zero'.
Sample size
The number of observations, such as trades, in a test. Small samples make it hard to tell a real effect from luck.
Multiple testing
The problem that testing many ideas at a fixed threshold makes some pass by luck. The more tests, the higher the threshold each should meet.
Paper trading
Practising investing with picks that involve no real money.

Step 1 of 5

An idea is not a rule

Opening this step…

Step 2 of 5

Why should it work? Sources of edge

This step opens when you finish the one above.

Step 3 of 5

Writing the rules

This step opens when you finish the one above.

Step 4 of 5

A test that could prove you wrong

This step opens when you finish the one above.

Step 5 of 5

Keeping a research log

This step opens when you finish the one above.

Key takeaways

The key takeaways open when you finish every step.

Lesson quiz

5 questions. You need 85% to pass.

The quiz opens when you finish every step.

Read first

Stockertim Learn is education. It explains how investing works and never recommends buying or selling anything.

Up next

Trading: risk, costs and processData hygiene for backtests: poin…Read nowData hygiene for backtests: point-in-time data, survivorship, look-ahead and corporate actionsTrading: risk, costs and process · Advanced · 15 minTrading: risk, costs and processBacktesting properly: out-of-sam…Read nowBacktesting properly: out-of-sample tests, walk-forward, multiple testing and overfittingTrading: risk, costs and process · Advanced · 15 minTrading: risk, costs and processCosts and capacity: slippage, ma…Read nowCosts and capacity: slippage, market impact and why paper results shrinkTrading: risk, costs and process · Advanced · 15 minTrading: risk, costs and processExecution and microstructure for…Read nowExecution and microstructure for algorithms: the order book, queues and latencyTrading: risk, costs and process · Advanced · 15 minAI & securityAI in banking, brokerage and inv…Read nowAI in banking, brokerage and investing appsAI & security · Beginner · 15 minTrading: risk, costs and processRisk per trade and position sizeRead nowRisk per trade and position sizeTrading: risk, costs and process · Intermediate · 15 minAI & securitySupervised and unsupervised lear…Read nowSupervised and unsupervised learning, with market examplesAI & security · Advanced · 15 minInvesting strategiesresearch a company before invest…Read nowHow to research a company before investingInvesting strategies · Beginner · 15 minTrading: risk, costs and processThe trading journal: honest revi…Read nowThe trading journal: honest review, loss limits and cool-off rulesTrading: risk, costs and process · Intermediate · 15 minTrading: risk, costs and processThe written trading planRead nowThe written trading planTrading: risk, costs and process · Intermediate · 15 minFinancial data & analyticsSignificance and data-miningRead nowSignificance and data-miningFinancial data & analytics · Intermediate · 15 minAdvanced strategies & derivativesBacktesting pitfalls: why past r…Read nowBacktesting pitfalls: why past results misleadAdvanced strategies & derivatives · Advanced · 15 min
English