Skip to content
Level 4 · Trading System ResearcherLessonPart 29 · page 4 of 630 min
30Minutes
2AFL functions
3Sources
StandardRequires
AFL functions taught here2

Trade Statistics: Wins, Losses, Payoff and Expectancy

The metrics in the last two lessons describe the account. This lesson’s describe the trades: how many there were, how often they worked, how big the wins were against the losses, and how long each one tied up capital. They are the numbers that tell you what kind of thing your rule actually is, and one of them — the expectancy — is present in the report under a name almost nobody looks for.

By the end you should be able to reconstruct Avg. Profit/Loss, Payoff Ratio and Profit Factor from the Winners and Losers blocks with a calculator, and to say how much weight the sample size will carry.

The statistics page groups them into an all-trades line, a Winners block and a Losers block, each reported separately for All, Long and Short trades. The programmatic metric names are documented exactly; the report’s own row labels for the Winners and Losers blocks are not enumerated in the User’s Guide, so this course gives you the documented strings and asks you to read the on-screen labels off your own report.

Metric string What it holds
"AllQty" Number of all trades
"AllAvgProfitLoss" Report row Avg. Profit/Loss
"AllAvgProfitLossPercent" Report row Avg. Profit/Loss %
"AllAvgBarsHeld" Report row Avg. Bars Held
"WinnersQty", "WinnersPercent" Count and percentage of winning trades
"WinnersAvgProfit", "WinnersAvgProfitPercent" Average win, in currency and percent
"WinnersLargestWin", "WinnersLargestWinBars" Biggest single win and its length
"WinnersMaxConsecutive" Longest run of consecutive winners
"LosersQty", "LosersPercent" Count and percentage of losing trades
"LosersAvgLoss", "LosersAvgLossPercent" Average loss, in currency and percent
"LosersLargestLoss", "LosersLargestLossBars" Biggest single loss and its length
"LosersMaxConsecutive" Longest run of consecutive losers

"AllQty" is the number of trades, and it decides how much any of the other numbers can support. This is not a philosophical point; it is arithmetic you can do.

For a proportion such as a win rate, the standard error under the simplest possible assumption — independent trades, each a coin flip with the same probability — is the square root of p(1−p)/n. At a 50 per cent win rate:

Trades Standard error of the win rate
30 9.1 percentage points
214 3.4 percentage points
300 2.9 percentage points

With 30 trades, a reported win rate of 50 per cent is consistent with a true rate anywhere in a range roughly 18 percentage points wide. There is no analysis you can perform on that sample that will rescue it.

Small samples also break specific metrics in specific ways. Profit Factor is undefined when there are no losing trades at all, and enormous when there is one small one. A spectacular ratio computed on eleven trades is a property of the sample, not of the rule.

The rest of this lesson uses one set of illustrative figures. They are invented so the arithmetic can be checked line by line; they are not a result.

Reported figure Value
Number of all trades 214
Winners, count and per cent 89, 41.59
Losers, count and per cent 125, 58.41
Average win ("WinnersAvgProfit") 1,180
Average loss ("LosersAvgLoss") −620
Total profit of winners 105,020
Total loss of losers −77,500
Net Profit 27,520
Avg. Bars Held 31.4

AmiBroker’s win rate is "WinnersPercent": 89 of 214 trades, or 41.59 per cent. The old backtester’s row for the same idea was called Percent profitable.

There is no metric named “Win Rate”, “Hit Rate” or “Success Rate” anywhere in the report. If you write “win rate” in your notes, you are using shorthand for "WinnersPercent", and it is worth knowing that is what you are doing.

The next lesson is entirely about why this number, read on its own, tells you almost nothing. For now, note only that 41.59 per cent is neither good nor bad until you know what the winners and losers were worth.

Average win, average loss and Payoff Ratio

Section titled “Average win, average loss and Payoff Ratio”

Payoff Ratio is the ratio of the average win to the average loss. Metric string "PayoffRatio"; the old backtester called it Ratio avg win/avg loss. It is colour-coded: below 1 bad, 1 to 2 neutral, above 2 good.

Payoff Ratio = 1,180 / 620 = 1.903

The average winner is a little under twice the average loser. Note what the ratio does not contain: how often each occurs. A Payoff Ratio of 3.0 on a rule that wins one time in ten is a losing rule. Payoff Ratio and "WinnersPercent" are two halves of one statement and neither is readable alone.

Profit Factor is the profit of winners divided by the loss of losers. Metric string "ProfitFactor".

Profit Factor = 105,020 / 77,500 = 1.355

Every 1.00 of losses was accompanied by 1.355 of gains. It is the whole-sample version of the same relationship Payoff Ratio expresses per trade, and unlike Payoff Ratio it already has the frequency of winners baked in: it is Payoff Ratio multiplied by the ratio of winner count to loser count. Here, 1.903 × (89/125) = 1.355, which is a useful identity to know because it tells you immediately that these are not two independent pieces of evidence.

Expectancy, which is in the report under another name

Section titled “Expectancy, which is in the report under another name”

AmiBroker has no report row named “Expectancy”. What it has is:

  • Avg. Profit/Loss — (Profit of winners + Loss of losers) ÷ (number of trades), which the User’s Guide notes is “also known as Expectancy ($)”;
  • Avg. Profit/Loss % — the same computation on percentage profits, “also known as Expectancy (%)”.

Note the exact form: Avg. Profit/Loss, with a slash, a period after “Avg”, and no space around the slash. Both are colour-coded bad below zero, good above.

With our figures:

Avg. Profit/Loss = ( 105,020 + (−77,500) ) / 214 = 27,520 / 214 = 128.60

That is the expected profit per trade, in currency, and it is simply Net Profit divided by the number of trades.

The formulation everyone writes, and why it is not always right

Section titled “The formulation everyone writes, and why it is not always right”

The version that appears in every trading book is:

Expectancy = %Winners × AvgWin − %Losers × AvgLoss
= 0.4159 × 1,180 − 0.5841 × 620
= 490.76 − 362.14
= 128.62

which agrees with Avg. Profit/Loss to a rounding error. AmiBroker’s own documentation uses exactly this formula in its first custom-metric example, and it adds the warning that matters: it only equals the dollar-weighted expectancy under constant position size. With compounding or variable sizing, larger trades weigh more than smaller ones, and the simple formula produces an over-optimistic answer.

The guide gives two alternatives for that case. One iterates the trades and sums the percentage profit of each — the profit per 100 invested — then divides by the number of trades, which removes the size weighting entirely. The other expresses each trade as an R-multiple, the profit divided by the amount risked on that trade, which is meaningful whenever a maximum-loss stop defines the risk. Both require the custom backtester interface, which Part 36 introduces; the arithmetic, though, you can now do by hand from a trade list exported to a spreadsheet.

Avg. Bars Held is the sum of bars in trades divided by the number of trades. Metric string "AllAvgBarsHeld".

It has one counting rule that surprises people: entering today and exiting tomorrow counts as a two-bar trade. The count is inclusive of the entry bar, so Avg. Bars Held is not “the average number of days between entry and exit” — it is one more than that, on daily data with no gaps.

Its real value is as a cost multiplier. A shorter holding period means more round trips for the same capital, and every round trip pays the spread and the commission. Two rules with the same Avg. Profit/Loss and holding periods of five and fifty bars are not comparable propositions: the fast one has to overcome roughly ten times the cost drag, and it is the one whose result will be most sensitive to whether your cost assumption was right. The trade list’s Profit/bar column is the per-trade version of the same idea.

Avg. Bars Held also tells you something about the evidence. A system holding for 200 bars gets far fewer independent observations out of the same history than one holding for 5, so two systems with the same trade count are not carrying the same weight of evidence if their holding periods differ by an order of magnitude.

The Winners and Losers blocks hold counts, averages, largest values and consecutive runs, with documented metric strings and asymmetric names, and every loser figure is negative. Payoff Ratio is the average win over the average loss; Profit Factor is total winnings over total losses, and equals Payoff Ratio scaled by the ratio of counts. Avg. Profit/Loss is the expectancy per trade, and it is Net Profit divided by the trade count, but the textbook formula behind it holds exactly only under constant position size. Avg. Bars Held counts the entry bar and is the number that decides how much your cost assumption matters.

Every one of these numbers depends on the sample being big enough to mean anything, which is why the trade count came first. The next lesson takes the one statistic in this group that is most often quoted alone, and shows what happens when it is.

Check your understanding

Question 1. A report shows 60 winners averaging 800 and 90 losers averaging −500. What is Avg. Profit/Loss?
Show the answer and why

Answer: 20

Profit of winners is 60 × 800 = 48,000; loss of losers is 90 × −500 = −45,000. Their sum, 3,000, divided by the 150 trades gives 20 per trade. Note that 300 is the difference between the two averages, which is not a statistic AmiBroker reports and is not the expectancy.

Question 2. Payoff Ratio is 1.90 and there are 89 winners and 125 losers. What is Profit Factor?
Show the answer and why

Answer: 1.36

Profit Factor is total winnings over total losses, which equals the Payoff Ratio multiplied by the ratio of the counts: 1.90 × (89 / 125) = 1.35. The two metrics are not independent evidence — knowing Payoff Ratio and the two counts determines Profit Factor exactly.

Question 3. Which of these are true of the trade statistics? Select all that apply.
Show the answer and why

Answer: The metric string for the average loss carries a negative sign, Entering on one bar and exiting on the next counts as two bars held, Profit Factor is undefined when there are no losing trades

The losers metrics are negative, bar counting includes the entry bar, and Profit Factor divides by the loss of losers, so it has no value when that is zero. There is no row named Expectancy: the report gives Avg. Profit/Loss and Avg. Profit/Loss %, which the documentation notes are also known as Expectancy in dollars and in percent.

Question 4. A system reports a Profit Factor of 4.2 over 14 trades. What is the most defensible reading?
Show the answer and why

Answer: The figure is dominated by sampling noise and supports no conclusion about the rule

Fourteen trades cannot support a conclusion about a ratio built from the totals of two small groups. One or two large winners set the numerator, and a single additional loser could halve the figure. Nothing is wrong with the calculation; there is simply not enough evidence in it, and optimising against a number like this fits the parameters to a handful of accidents.

Sources for this lesson

3 verified · checked 2026-08-31

  1. 01AmiBroker User's Guide — System test report window§ New backtester reportamibroker.com/guide/w_report.html2026-08-31
  2. 02AmiBroker User's Guide — How to add user-defined metricsamibroker.com/guide/a_custommetrics.html2026-08-31
  3. 03AmiBroker User's Guide — Portfolio Backtester Interface Reference§ Stats object and Trade objectamibroker.com/guide/a_custombacktest.html2026-08-31

Every technical claim on this page was checked against the official AmiBroker documentation on the date shown. Where the course disagrees with folklore, the source is how you can tell which one to trust.