Win Rate Means Nothing Without This Number (Free TradingView Snippet)
The formula that matters more than win rate, and a free snippet that shows it on any TradingView strategy.
A strategy can win 90% of its trades and still lose money. Win rate tells you how often you're right. Expectancy tells you what each trade makes on average, and that's the number that decides whether a strategy makes money.
The formula
Expectancy per trade = (win rate × average win) − (loss rate × average loss)
Say a strategy wins 90% of the time, makes $20 per win and loses $2,000 per loss:
0.9 × $20 − 0.1 × $2,000 = $18 − $200 = −$182 per trade.
Nine wins buy you dinner. One loss takes the rent.
Add it to any TradingView strategy
- Open your strategy in the Pine Editor.
- Tap Copy code below and paste it at the very bottom of the script.
- Save. A small table shows the trades, win rate, average win, average loss and expectancy per trade, from the Strategy Tester's own numbers.
It works with Pine Script v5 and v6 strategies. If your script already has a table in the bottom-right corner, change position.bottom_right to another corner.
What real data says
I tested three simple rule sets on SPY's full daily history, 1993 to 2026:
- A rule that never closes a losing trade (it only sells at +1%) won 178 of its 178 closed trades, a 100% win rate. While it waited, the account was down as much as 54%, and one trade took 4 years and 8 months to reach its +1%.
- On SPY, a rule that won 75% of its trades made more than one that won 44%. On QQQ it flipped: a 51% rule made more than a 68% one.
- None of the three beat simply buying and holding SPY over the same years.
Win rate on its own told me nothing. Expectancy, and how deep the losing trades went, told me what I needed to know.
Want more free tools like this?
I share trading tools, scripts and walkthroughs on Instagram at @tctradinglab and on YouTube at TC Trading.
Don't have TradingView yet? Get it here. That's an affiliate link, so I may earn a commission at no extra cost to you.
Not financial advice. A backtest shows how rules would have done, not how they will do. Test anything before you trade it with real money.