Expected shortfall calculator: inspect the historical trade tail

Inspect Pineify’s 95% historical trade-return tail average. Understand return signs, discrete percentile selection, ties, and small-sample limitations.

Calculate Conditional Value at Risk (Expected Shortfall) From Your Trades

What Is Conditional Value at Risk (Expected Shortfall)?

Expected shortfall summarizes outcomes in a distribution’s adverse tail, whereas VaR identifies a quantile threshold. Methods and sign conventions vary. A loss convention usually reports a positive loss magnitude; a return convention can report a negative adverse return. State the confidence level, horizon, and estimator before comparing values.

Pineify currently reports a 95% historical tail average using imported trade PnL percentages. It does not report a 99% CVaR or a dollar-denominated expected loss. The trade-level percentage is not automatically a percentage of total account equity.

Formula

Current Pineify implementation, for N imported trade percentages: 1. Sort all trade percentages ascending, including gains and losses. 2. Select index floor(0.05 × N), using zero-based indexing. 3. Use that observed value as VaR95. 4. CVaR95 = arithmetic mean of every trade percentage <= VaR95. This is an inclusive historical tail average. Its discrete index and inclusion of ties mean the selected tail can exceed exactly 5% of observations. It is not a fractionally weighted exact-5% estimator.

How to Read This Number

A more negative reported value means a worse average return in the selected historical tail. It is not a maximum possible loss or a promise about future frequencies. A positive value means the selected sample tail averaged a gain; it does not establish that losses are impossible.

For a reproducible arithmetic illustration, take 20 trades whose two lowest percentages are −10% and −4%, with all remaining returns positive. The app selects index 1, so VaR95 is −4% and CVaR95 is −7%. Two observations are included: 10% of this small sample, not exactly 5%. Repeated values at the threshold can include more observations.

A large difference between the threshold and tail mean shows that some selected outcomes were worse than the threshold. The difference alone does not prove a particular distribution shape or identify why those losses occurred.

What Counts as Good?

RangeValueWhat It Means
Negative tail meanBelow 0%The selected historical tail lost money on average in trade-percentage units. No universal acceptable cutoff follows.
Non-negative tail mean0% or aboveThe selected sample tail did not average a loss. Check sample coverage and missing trades before drawing conclusions.
Few tail observationsCount-dependentOne or two trades can dominate the estimate. There is no fixed trade-count guarantee of statistical reliability.

How Pineify Calculates Conditional Value at Risk (Expected Shortfall)

The calculation uses each parsed trade’s pnlPercent field. VaR95 is selected from the complete sorted array, and CVaR95 averages values at or below it. Trade duration, account exposure, and dollar position size are not used to weight this tail average. The current metrics engine has no 99% CVaR calculation and does not generate the claimed automatic small-tail warning banner. Use a compatible trade-list CSV and inspect the parsed returns, missing values, and any open-trade setting. Local parsing and metric calculations are separate from optional AI analysis: that feature sends a derived report summary to the analysis API, excluding the raw trade and equity-curve arrays. To investigate the result, reproduce the sorted values and selected count, then inspect the original trades and execution assumptions. A tail average is a diagnostic of the supplied sample, not an automatically chosen stop distance or position-sizing rule.

Review Your Conditional Value at Risk (Expected Shortfall)

Upload your TradingView backtest CSV and get Conditional Value at Risk (Expected Shortfall) (CVaR) alongside other return and risk metrics. Check the input assumptions before comparing results.

Analyze Your Backtest Now

Frequently Asked Questions

Everything you need to know about this metric