Net profit versus expectancy
Lesson 19 · about 11 min
The Strategy Tester opens on a big green or red number: net profit. It is the least useful figure on the panel. Net profit depends on the start date, the initial capital, the sizing rule and one or two lucky trades as much as on the rules you wrote. The numbers worth reading are per-trade and relative, and the tester has most of them if you know which tab to open.
The tabs
- Overview: net profit, equity curve, drawdown curve, a few headline ratios.
- Performance Summary: the full table: gross profit and loss, number of trades, percent profitable, average trade, average winner and loser, ratio of average win to average loss, largest win and loss, profit factor, max drawdown, commission paid, and more, split by long and short.
- List of Trades: every entry and exit with date, price, quantity, profit, cumulative profit and run-up and drawdown per trade. This is where you verify the strategy did what you meant.
- Properties: the settings the run used, including initial capital, commission, slippage and the date range. Check it before believing anything.
From net profit to expectancy
Expectancy, from the risk-management course, is the average result per trade: (win rate × average winner) − (loss rate × average loser). The tester gives you every input:
- Percent profitable = win rate.
- Avg winning trade and avg losing trade, in currency.
- Avg trade = net profit ÷ number of trades, which is expectancy in currency directly.
In R, divide by the average dollars risked per trade. A strategy that risks 1% of $10,000 on every trade has 1R ≈ $100, so an average trade of $35 is +0.35R. If your sizing is risk-based (module 6), 1R is constant in percent terms and this conversion is honest. With percent-of-equity sizing, R varies per trade and the average is only approximate.
Profit factor = gross profit ÷ gross loss. Above 1 is profitable before the costs you forgot; 1.3 to 2.0 is a typical range for a real system with many trades; above 3 on a large sample deserves suspicion, not celebration.
Ratio of average win to average loss with percent profitable together tell you the shape of the system. A 35% win rate with a 3:1 ratio and a 70% win rate with a 0.5:1 ratio can have the same expectancy and feel completely different to trade.
Putting the numbers on the chart
The strategy.* namespace exposes the same statistics to the script, so a table can show them beside the equity curve:
//@version=6
strategy("Stats table demo", overlay=true, initial_capital=10000,
default_qty_type=strategy.percent_of_equity, default_qty_value=10,
commission_type=strategy.commission.percent, commission_value=0.05)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
if ta.crossover(fast, slow)
strategy.entry("Long", strategy.long)
if ta.crossunder(fast, slow)
strategy.close("Long")
var table t = table.new(position.bottom_right, 2, 6, bgcolor=color.new(color.black, 60), border_width=1)
row(int r, string k, string v) =>
table.cell(t, 0, r, k, text_color=color.white, text_size=size.small)
table.cell(t, 1, r, v, text_color=color.white, text_size=size.small)
if barstate.islast
trades = strategy.closedtrades
wins = strategy.wintrades
losses = strategy.losstrades
winRate = trades > 0 ? wins * 100.0 / trades : 0.0
avgWin = wins > 0 ? strategy.grossprofit / wins : 0.0
avgLoss = losses > 0 ? strategy.grossloss / losses : 0.0
avgTrade = trades > 0 ? strategy.netprofit / trades : 0.0
pf = strategy.grossloss > 0 ? strategy.grossprofit / strategy.grossloss : 0.0
row(0, "Trades", str.tostring(trades))
row(1, "Win rate", str.tostring(winRate, "#.#") + "%")
row(2, "Avg win / loss", str.tostring(avgWin, "#.##") + " / " + str.tostring(avgLoss, "#.##"))
row(3, "Avg trade", str.tostring(avgTrade, "#.##"))
row(4, "Profit factor", str.tostring(pf, "#.##"))
row(5, "Max DD", str.tostring(strategy.max_drawdown, "#.##"))
strategy.grossloss and strategy.max_drawdown are reported as positive numbers. Multiplying by 100.0 before dividing keeps the win-rate arithmetic in floats, so the result is a percentage rather than a truncated count.
Reading a report honestly
Go through this order every time:
- Properties: are commission and slippage non-zero? Is the date range the one you think?
- Number of trades: fewer than about 100 means the rest is noise (next lesson).
- Avg trade relative to costs: if avg trade is $35 and commission plus slippage per round trip is $20, the edge is mostly cost.
- Largest winning trade as a share of net profit: if one trade is 40% of the total, remove it mentally and re-read.
- Percent profitable and win/loss ratio: can you trade this shape? A 30% win rate is arithmetic on paper and eight losses in a row in practice.
- Only then, the equity curve.
Key idea: Read the tester per trade: avg trade (expectancy in currency), profit factor, win rate with the win/loss ratio, and the largest trade's share of the total. Net profit is the output of those numbers and the sizing rule, not evidence on its own.
The long/short split
The Performance Summary splits every statistic into long and short. Many "profitable" strategies are one profitable side and one side that loses slightly less than the first makes. Reading the split usually tells you to drop a side or to give it different rules.
Try it: Run any strategy from module 6 and fill in a table by hand: trades, win rate, average winner, average loser, expectancy, profit factor, largest trade as a percent of net profit. Then compute expectancy in R using your risk per trade. Compare with the on-chart table above.
Recap
- Net profit depends on start date, capital and sizing; per-trade statistics describe the rules.
- Expectancy in currency is avg trade; in R, divide by average dollars risked; profit factor is gross profit over gross loss.
- Win rate and win/loss ratio together describe the shape of the system and how it will feel.
- Check Properties, trade count, avg trade versus costs, and the largest trade's share before the equity curve.
strategy.closedtrades,strategy.wintrades,strategy.grossprofit,strategy.netprofitandstrategy.max_drawdownput the same numbers in a table.
See it drawn
Original diagrams for the ideas on this page. Illustrative, not real market data.