Skip to content
Module 1 / 2
  1. What Is Edge and Expectancy - The Foundation of a System
  2. TradingView Pine Script from Scratch
  3. Backtesting Without Cheating - Overfitting and Lookahead
  4. Excel as a Trading Laboratory
Algo Systematic Lesson 01

What Is Edge and Expectancy - The Foundation of a System

A trading system does not start with code, not with an indicator, but with understanding what an edge is. Most beginner traders confuse an edge with a high win rate, one good strategy from the internet, or the belief that their intuition works. In a systematic approach edge...

Introduction0:00 / 7:00
Illustration for lesson: What Is Edge and Expectancy - The Foundation of a System
1 / 7
Author
Zordon Intelligence Sp. z o.o.
Updated
7 min read
Structure sources
2

Introduction

A trading system does not start with code, not with an indicator, but with understanding what an edge is. Most beginner traders confuse an edge with a high win rate, one good strategy from the internet, or the belief that their intuition works. In a systematic approach an edge is a measurable, repeatable statistical asymmetry that, once all costs are subtracted, produces a positive expected value.

This lesson is the foundation of the entire course 21. Without understanding expectancy there is no point writing a single line of code in Pine Script or Python. You would only automate chaos. Here you will learn to define an edge, measure it in R units, and tell a random run of profits apart from a real edge.

What Edge Is in Systematic Practice

An edge is not a single indicator. An edge is a set of rules that over a large sample produces a positive expected value. It consists of three elements:

  1. Entry with context: Where and why you enter. For example, not “RSI < 30”, but “RSI < 30 in an uptrend defined as price > SMA200, after a 38.2-61.8% correction”.
  2. Exit with asymmetry: How you manage profit and loss so the average win beats the average loss, or the win rate offsets the R-multiple.
  3. No-trade filter: When you deliberately do not trade, so as not to destroy the edge.

An edge without the third element does not exist. A system that trades all the time also trades when there are no conditions for its edge.

Myth about edgeMeasurable reality
Edge means an 80% win rateEdge means a positive EV at any win rate, even 35%, if the R-multiple is > 1.5
Edge works foreverEdge is temporary and degrades as the market regime changes
Edge is a secret indicatorEdge is an execution protocol, risk management and costs
A backtest is enoughA backtest without costs, slippage and out-of-sample data is an illusion

Expectancy, Payoff and R-multiple - the mathematics of survival

A trading system is a probabilistic game. You do not judge a system by one trade, only by the distribution of results.

Expectancy (EV) = (WinRate * AvgWin) - (LossRate * AvgLoss)

Where:
WinRate = Winning trades / All trades
LossRate = 1 - WinRate
AvgWin = average profit in PLN or in R
AvgLoss = average loss in PLN or in R (a positive value)
R-multiple for a trade = (Profit or Loss) / Initial Risk R

Example: You risk 100 PLN, you close at +250 PLN -> +2.5R
You risk 100 PLN, you close at -100 PLN -> -1R
System Expectancy in R:
EV = (WinRate * AvgWin_R) - (LossRate * AvgLoss_R)

A system with a 40% win rate, AvgWin 2R, AvgLoss 1R:
EV = (0.4 * 2) - (0.6 * 1) = 0.2R per trade
Over 100 trades you expect +20R before you subtract commission and slippage costs.

Why do we count in R? Because R normalises every trade regardless of instrument and position size. Without R you cannot compare a system on the DAX with one on BTC.

SystemWin RateAvgWinAvgLossEV in RComment
A scalping55%0.9R1R-0.055RNegative after costs, despite the high WR
B trend38%2.5R1R+0.33RLow WR but high asymmetry - that is the edge
C mean-reversion70%0.6R1.2R0RBreakeven before costs, negative after costs

Conclusion: never judge a system by its win rate. Judge it by EV in R after costs.

Three types of edge and how to measure them

1. Structural edge (trend, momentum)

It assumes the market tends to continue an impulse. You measure it with: trend length versus correction, and the % of trades in the direction of the HTF.

2. Mean-reversion edge

It assumes a return to the mean after a deviation. You measure it with: distance from the mean, standard deviation, time to return.

3. Informational / microstructure edge

It assumes a liquidity asymmetry, order sequences, seasonality. The hardest one for a retail trader to sustain; it requires tick data and low costs.

Every edge must have a falsification protocol: a condition that says the edge has stopped working.

Edge falsification rule:
If after N=30 new OOS trades the rolling EV &lt; 0 and the Payoff Ratio &lt; 1 with a drawdown > 2* MaxDD from the backtest -> the edge requires a pause and a re-audit.

How not to confuse luck with edge

You need a minimum sample. For systems with a win rate of 40-60%, 100 trades is the absolute minimum before you can even start talking about an edge. For low win rate systems (<40%) you need 200+.

Use a simple measure of dependence on chance - the Profit Factor and a Z-test for randomness.

Profit Factor = Sum of Profits / Sum of Losses (absolute values)

PF > 1.5 -> a preliminary filter, PF > 1.2 but &lt; 1.5 -> requires Walk-Forward
PF &lt; 1.2 after costs -> no edge
System Quality Number (SQN) - Van Tharp:

SQN = sqrt(N) * (AvgR / StdDevR)

SQN > 2.5 = a system fit for trading
SQN 1.6-2.5 = average
SQN &lt; 1.6 = weak or too small a sample

Never calculate PF and SQN on the same data you optimised on. That is self-deception.

When the plan says do not trade

  1. When you do not have at least 100 trades logged in R: You do not have an edge, you have a hypothesis. Do not automate a hypothesis.
  2. When you calculate EV only on winners or ignore costs: An edge calculated without commission, swap and 1-2 ticks of slippage is marketing, not mathematics.
  3. When your system has EV < 0.1R after costs: Such a system will not survive variance. A pause, not trading.
  4. When you have no defined falsification condition: If you do not know when to stop trading a system that has stopped working, you do not have a system.
  5. When you change the rules after 3 losses in a row: That is the end of the edge and the beginning of discretionary chaos.

The mistakes that cost the most

  1. Confusing win rate with edge. A system with a 75% win rate and an AvgWin of 0.4R is a loser after costs. A novice chooses it because it “wins more often”.
  2. Calculating edge on too small a sample. 20 trades is noise. Building a bot on 20 trades is guaranteed overfitting.
  3. No normalisation to R. Comparing profits in PLN from different position sizes creates a false picture of the edge. Always R.
  4. Ignoring execution delay. In the backtest you enter at the close, in reality 0.2% slippage destroys the whole edge on M5.
  5. Building a system without a journal. An edge does not exist in the code, it exists in the journal. If you do not log the R-multiple, the Max Favorable/Adverse Excursion or the time in a position - you do not know what you are optimising.

Measurable exercise

Goal: Calculate your current (or hypothetical) EV in R.

Task:

  1. Export your last 50-100 trades (manual or from a demo) to a spreadsheet.
  2. For each one calculate the R-multiple: (net result of the trade) / (initial risk). If you had no defined risk, go back and define it, for example as the distance to the SL you should have placed.
  3. Calculate:
WinRate = COUNTIF(R>0) / N
AvgWin_R = AVERAGEIF(R>0)
AvgLoss_R = ABS(AVERAGEIF(R&lt;0))
EV = WinRate*AvgWin_R - (1-WinRate)*AvgLoss_R
PF = SUMIF(R>0)/ABS(SUMIF(R&lt;0))
SQN = SQRT(N) * (AVERAGE(R)/STDEV(R))
  1. Answer: Is EV > 0.15R? Is PF > 1.3 after subtracting 10% for costs? If not - you do not yet have an edge worth automating.

Keep the journal for 2 weeks, even with no live trading.

Test yourself

  1. A system has a 45% win rate, an AvgWin of 1.8R and an AvgLoss of 1R. Calculate the EV. Does it have an edge before costs?
  2. Why can a high win rate (70%) be worse than a low one (40%)? Give an example in R.
  3. How does an edge differ from luck, and with what minimum sample do you tell them apart?
  4. What is an R-multiple and why can you not compare systems on different markets without it?
  5. Define your own falsification condition: after how many trades and what result do you decide that your edge requires a pause?

Common questions

Can an edge be both trend and mean-reversion? Yes, but not in the same system without a clear regime switch. Mixing two contradictory logics in one system is the most common cause of having no edge. Build two separate modules and define which one operates in which regime (e.g. ADX, volatility).

I have a 65% win rate on demo, is that an edge already? Not without an R-multiple, a sample >100 and costs taken into account. A win rate without R is a vanity metric. Calculate the PF and the net EV in R. Only then are we talking about an edge.

How long does an edge last? From a few months to a few years. A structural edge lasts longer than an edge based on a specific RSI parameter. That is why you need Walk-Forward testing and recalibration. No edge is eternal.

Can I have an edge without a backtest, only from a forward test? Yes, a forward test is the best test, but it takes time. A backtest is for quickly falsifying bad ideas. If an idea does not pass a backtest with costs, there is no point in a forward test.

Does a low SQN mean the system is fit for the bin? Not necessarily. A low SQN can mean too small a sample, too large a standard deviation (inconsistent execution) or a lack of filters. First audit the execution and the filters, and only then reject the hypothesis.


Advertisement

Key takeaways

  • A trading system does not start with code, not with an indicator, but with understanding what an edge is. Most beginner traders confuse an edge with a high win rate, one good strategy from the internet, or the belief that their intuition works. In a systematic approach edge...

Structure sources

The material is based on source documents. Variable values — fees, limits, regulatory figures — are worth checking at the source before making a decision.

  • TradingView — Pine Script reference
  • Python for Finance — Yves Hilpisch

Disclaimer

  • Educational material. Not investment advice or a recommendation. Trading involves the risk of losing capital.
  • The materials are educational. They are not investment advice or a recommendation within the meaning of financial instruments trading regulations. Numbers in examples are illustrative unless a measurement date and source are given.

Who writes this and how we check it

The materials are written and verified by Redakcja Kurs Tradera — the rules are described on about the site: every number has a source, and we show gaps openly. Report a factual error via contact — corrections are described in the content.

Course progress 0 / 7
Next →

Progress is stored only in this browser (localStorage) — there is no account and no copy on the server. Clearing site data will remove it. Manage your data