Expected Shortfall Calculator: CVaR for TradingView Backtest Results
Calculate Expected Shortfall (CVaR) from your TradingView backtest CSV. See the average loss in the worst 5% and 1% tails. Free, client-side, no signup.
Calculate Conditional Value at Risk (Expected Shortfall) From Your TradesWhat Is Conditional Value at Risk (Expected Shortfall)?
I ran a strategy for six months that looked great on win rate. Then I checked the worst five trades and realized my average loser was a lot worse than I thought. Expected Shortfall, also called CVaR (Conditional Value at Risk), is the measure that caught it.
Expected Shortfall asks: "In the worst 5% (or 1%) of my trades, how much do I lose on average?" Unlike Value at Risk (VaR) which gives you a threshold (the 95th percentile loss), Expected Shortfall looks past that threshold at the whole tail. If VaR says your 95th percentile loss is $500, Expected Shortfall tells you the average of all losses beyond that $500 mark. If the tail is fat, Expected Shortfall can be dramatically higher than VaR.
The key difference is simple: VaR tells you the minimum loss in the tail. Expected Shortfall tells you the average loss inside the tail. CVaR is always at least as strict as VaR, and when a strategy has a few blowout losers it catches risk that VaR misses entirely.
Formula
How to Read This Number
CVaR is expressed in the same unit as your trades (dollars or percentage). A positive CVaR means you have net gains even in the tail (rare with directional strategies). A negative CVaR is the expected loss per trade in the tail.
Lower (more negative) is worse. A CVaR_{95%} of -$200 means your worst 5% of trades average a $200 loss. The same strategy might have VaR_{95%} of only -$120, giving a false sense of safety.
The gap between VaR and CVaR matters. If VaR_{95%} is -$120 and CVaR_{95%} is -$400, your tail is heavy with outlier losses. If they are close (VaR -$120, CVaR -$150), the loss distribution is well-behaved and the worst trades are not much worse than the threshold.
At 99% confidence, CVaR will naturally be more extreme because it isolates the very tail. I always check both levels when I upload a new CSV. The difference between the two tells me whether the risk is concentrated in a few extreme trades or spread across a broader tail.
What Counts as Good?
| Range | Value | What It Means |
|---|---|---|
| Excellent | CVaR >= 0 | No expected loss even in the worst tail. The strategy makes money on its worst trades (rare in practice). |
| Good | CVaR < 5% of avg trade | Tail losses are small relative to typical trade size. The strategy handles drawdowns well. |
| Fair | CVaR 5-15% of avg trade | Moderate tail risk. Worth checking if extreme losses cluster around specific market conditions. |
| Poor | CVaR > 15% of avg trade | Significant tail risk. The strategy has a few trades that are much worse than the typical loser. |
| Warning | CVaR 99% >> CVaR 95% | Fat tail. The worst 1% of trades are outliers far worse than the worst 5%. Review stop-loss logic. |
How Pineify Calculates Conditional Value at Risk (Expected Shortfall)
When I first used Pineify to check my own strategy CSV, I remember staring at the VaR number and thinking "that does not seem so bad." Then I looked at the CVaR next to it. VaR_{95%} was -$187. CVaR_{95%} was -$612. That gap told me my strategy had a few catastrophic losers hiding behind an okay-looking VaR threshold. Pineify calculates both VaR and CVaR at 95% and 99% automatically from your TradingView CSV. You get the numbers side by side, plus the full trade list sorted so you can see exactly which trades land in the tail. My own CSV with 347 trades showed me that the worst 17 trades (5%) accounted for over 40% of total losses. Without CVaR I would have missed that concentration entirely. The calculation handles the edge cases too. If you have fewer than 20 trades, the script warns you that CVaR is unreliable because the tail sample is too small. It clips at the available data and shows a warning banner. Below 100 trades I would not trust the 99% CVaR at all, and Pineify flags that in the report. No logarithms. No matrix math. You upload the CSV and the CVaR numbers show up in the same report panel as VaR, Sharpe, and drawdown metrics.
Get Your Conditional Value at Risk (Expected Shortfall) in Seconds
Upload your TradingView backtest CSV and get Conditional Value at Risk (Expected Shortfall) (CVaR) plus 15+ other professional metrics. No signup needed.
Analyze Your Backtest NowFrequently Asked Questions
Everything you need to know about this metric