[Canonical HTML article](https://algoway.trade/blog/trading-model-precision-recall-imbalance.html)

# **Trading Model Precision vs Recall: Accuracy Can Mislead**

Published November 28, 2026

![AlgoWay trading automation](https://algoway.trade/static/img/social.jpg)

A trading classifier can be 95% accurate while identifying none of the events it was built to find. If only five bars in a hundred meet the target definition, predicting “no event” on every bar earns that score without finding a single one.

**Precision asks how many predicted positive signals were correct. Recall asks how many actual positive events the model found.** Both need a clearly defined label and an evaluation period. Neither number, by itself, measures money earned.

This evaluation belongs upstream of automated trading. In an [AlgoWay alert-to-order workflow](https://algoway.trade/blog/automate-tradingview-alerts-to-any-broker-with-algoway.html), a successful execution does not establish that the model selected a useful trade. Decide what counts as a signal, measure the predictions, then evaluate the orders and resulting returns separately.

## Define the event before counting it

For an illustrative binary classifier, let positive mean that the closing price five completed bars later is more than 0.5% above the current close. Negative means that condition is not met. This definition is only an example, not a suggested strategy or a profitability label. It says nothing about the intervening price path, an executable entry, stops or costs.

A true positive is a predicted positive whose later outcome meets that definition. A false positive is a predicted positive whose outcome does not. A false negative is a qualifying event the model missed. A true negative is a correctly rejected event.

The word “positive” must stay attached to the same class throughout the report. In scikit-learn's binary metrics, `pos_label` identifies that class. A score for the abundant no-event class answers a different question from a score for the scarce signal class.

## Read a 1,000-bar example

Suppose a hypothetical test set has 1,000 eligible bars: 50 positive outcomes and 950 negative outcomes. A model predicts positive on 40 bars. Of those, 20 really are positive and 20 are negative. It misses the other 30 positives and correctly rejects 930 negatives. These are invented counts for arithmetic, not a model test or observed performance.

[Precision](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.precision_score.html) is true positives divided by all predicted positives: 20 / (20 + 20) = **50%**. Half of the proposed signals match the outcome label.

[Recall](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.recall_score.html) is true positives divided by all actual positives: 20 / (20 + 30) = **40%**. The model finds two out of five qualifying events.

[Accuracy](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html) counts all correct predictions: (20 + 930) / 1,000 = **95%**. The always-negative baseline also scores 950 / 1,000 = 95%, but its recall is zero. Equal accuracy conceals very different behavior.

Baseline precision is mathematically undefined because it predicts no positives: the denominator is zero. The documented default for scikit-learn's precision metric returns zero and issues a warning in that case; the `zero_division` setting can change how this is reported. Record the absence of signals explicitly. A quiet bot has not demonstrated perfect selectivity.

## Compare the signal set, not just one percentage

Now consider another hypothetical setting on the same 1,000 bars. It predicts 100 positives: 35 correct and 65 false. It misses 15 positive outcomes and correctly rejects 885 negatives. Precision becomes 35%, recall becomes 70%, and accuracy becomes 92%.

This setting finds more qualifying events but also sends more false signals. It is not automatically better or worse for trading. A workflow with limited position capacity may value selectivity differently from one designed to capture a larger fraction of opportunities.

The official [scikit-learn precision-recall example](https://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html) discusses imbalanced classes and comparing thresholds. For an actual scored model, calculate the counts at each candidate threshold; do not assume precision will improve smoothly each time the threshold rises. Keep threshold selection inside the validation process and reserve a later period for evaluation.

## Why precision is not your trading win rate

Our positive label looks at one future closing price. A correctly predicted outcome could still produce a losing trade if a stop exits earlier, entry arrives late, or costs exceed the available move. A false positive under the five-bar label could still encounter a profitable exit before that horizon. The label and the trading policy ask different questions.

Even if the label exactly described a profitable trade under a fixed execution model, precision would still leave the sizes of wins and losses unanswered. For example, 20 gains of $10 and 20 losses of $20 produce a $200 gross loss despite an equal number of wins and losses. See the [expectancy calculation with trading costs](https://algoway.trade/blog/trading-expectancy-win-rate-costs.html) for the cash accounting that a classification score leaves out.

Also distinguish positive bars from independent opportunities. Several nearby bars may describe the same price move. A position rule may accept the first signal and suppress the rest. Report classification metrics on the defined sample, then simulate the actual entry and exit rules rather than treating every positive bar as a separate tradable position.

## Keep enough evidence to interpret the score

Save the label definition, horizon, evaluation dates, positive-event count, predicted-positive count and all four confusion-matrix counts alongside the percentages. State whether observations were weighted and which class was scored. Changing the proportion of positive events changes the setting in which precision was measured.

Use [chronological trading-model validation](https://algoway.trade/blog/time-series-trading-validation-split.html) so training precedes evaluation, and account for [overlapping future-label windows](https://algoway.trade/blog/time-series-gap-overlapping-labels.html) at the boundary. A clear confusion matrix cannot rescue a test that already saw its own future.

Before enabling order delivery, the report should answer two separate questions: what did the classifier detect, and what happened when the complete trading policy acted on those detections? “95% accurate” answers neither question well enough on its own.
