All free tools

Trading metric

Win Rate & Win/Loss Ratio Calculator

Turn a count of winning and losing trades into your win rate and win-to-loss ratio. Just remember that a high win rate alone does not make a track record profitable, as the explanation below shows.

Win rate
65.38%
52 total trades.
Win / Loss ratio
1.89 : 1
Winning trades for every losing trade.

What win rate and win/loss ratio are

Win rate is the share of your trades that closed profitably, expressed as a percentage: winning trades divided by total trades. The win/loss ratio is a closely related figure, the number of winning trades for each losing trade, found by dividing wins by losses. A win rate of 65% and a win/loss ratio of roughly 1.9 to 1 describe the same record from two angles.

Both are simple counts and neither considers the size of the wins and losses. That is the key limitation: a strategy can win most of the time and still lose money if the occasional losses are large, and a strategy can win less than half the time and still be profitable if the wins are big enough. This is why win rate is almost always read alongside average win size, the reward-to-risk ratio, and expectancy.

Why win rate is used

Win rate is one of the first numbers people look at because it is intuitive and easy to compute. It matters most in combination with the payoff of each trade. A useful anchor is the breakeven win rate implied by a strategy's reward-to-risk ratio: the higher the reward per unit of risk, the lower the win rate a strategy needs just to break even.

On its own, win rate says nothing about whether an approach suits you or will hold up in the future. It is a description of a sample of past trades, and how you weigh it is entirely your own decision.

What are TradingView and Pine Script?

TradingView is one of the most widely used charting and market-analysis platforms, where traders and analysts study price movement across stocks, crypto, forex, and futures on interactive charts. Pine Script is TradingView's own lightweight programming language, created so anyone can build custom tools that run directly on those charts.

People use Pine Script to build four main kinds of tools. Indicators calculate and plot values on the chart, exactly like the calculation above, but recomputed automatically on every bar. Strategies add explicit entry and exit rules and can be backtested against historical data in TradingView's Strategy Tester to see how they would have behaved. Screeners scan many symbols at once for conditions you define. Alerts notify you the moment a condition you specified occurs, so you do not have to watch the screen.

The value is precision and automation. Instead of eyeballing a chart, you describe exactly what you want measured, visualized, or notified about, and TradingView runs it consistently across any market and timeframe. That is why traders, analysts, and developers write Pine Script: it turns a manual charting idea into a repeatable tool. These tools are for tracking, visualizing, and testing market ideas; they do not tell you what to trade, and that decision always remains yours.

Writing that code by hand means learning Pine Script's syntax, its type system, and the exact names of hundreds of built-in functions. It is a real programming language, and small mistakes stop a script from compiling in the Pine Editor.

Turn this into Pine Script

You calculated this from trade counts by hand. When a strategy is coded in Pine Script, TradingView's Strategy Tester tracks winning and losing trades for you and reports the win rate automatically, and you can also read the counts directly with built-ins like strategy.wintrades and strategy.closedtrades. The work is turning your rules into that strategy in the first place.

Pine Script v6
//@version=6
strategy("Win Rate Example", overlay=true)

// ... your entry and exit rules go here ...

winRate = strategy.closedtrades > 0 ? strategy.wintrades / strategy.closedtrades * 100 : na
plot(winRate, "Win rate %")

PineScripter is an AI built specifically for Pine Script. You describe what you want in plain English and it writes TradingView-ready v5 or v6 code. Because it is specialized on the Pine Script language and its exact function signatures, it tends to produce code that compiles far more reliably than general-purpose models like ChatGPT, which often invent functions that do not exist in Pine Script.

Related free calculators

From the blog

PineScripter is an AI developer tool that helps you write Pine Script code. It is not a financial advisor and will never offer financial, investment, or trading advice. Everything on this page, including the calculator and the explanations, is provided purely for educational and informational purposes. Any decision about how to interpret an indicator or trade a market is entirely your own. See our full disclaimer for more.