Ulcer Index Calculator. Measure Your Strategy's Drawdown Pain
Calculate Ulcer Index and UPI / Martin Ratio from your TradingView backtest CSV. Free, client-side, no signup. Lower Ulcer means smoother equity.
Calculate Ulcer Index From Your TradesWhat Is Ulcer Index?
Picture this: you backtest a strategy that closes 70% of trades in profit. The equity curve looks fine at a glance. But when you zoom in, you notice the account spent four months slowly drifting 18% below its high before finally recovering. Max drawdown says 18%. The real story is how long that drawdown lasted. Ulcer Index captures both the depth and the duration of every underwater period, not just the worst one.
Ulcer Index was created by Peter Martin in the 1980s as a more complete drawdown measure. It squares each period's drawdown percentage from the running peak, averages those squares, and takes the square root. This means deep drawdowns get extra weight, and long drawdowns accumulate more "ulcer points" per period. The result is a single number that tells you how much time your strategy spent in drawdown territory and how painful those periods were.
UPI (Ulcer Performance Index, also called Martin Ratio) divides a strategy's excess return by the Ulcer Index. It answers "was the return worth the drawdown pain?" A UPI above 0.5 is decent. Above 1.0 is excellent. Both metrics come together in Pineify's report.
Formula
How to Read This Number
For Ulcer Index, lower is always better. A value of 0 means the equity curve never dipped below its peak. Values between 0 and 0.10 suggest a smooth equity ride. Between 0.10 and 0.25 is typical for strategies with brief, shallow drawdowns. Above 0.50 means the strategy spends significant time underwater. I have seen strategies with 40% win rates but Ulcer Index under 0.15 that consistently outperformed high-win-rate strategies with Ulcer over 0.40.
For UPI / Martin Ratio, higher is better. This measures how much return you got per unit of drawdown pain. A UPI below 0 means the strategy lost money overall. Between 0 and 0.5 is mediocre. Between 0.5 and 1.0 is reasonable. Above 1.0 signals a strategy where the return comfortably justifies the drawdown. Above 2.0 is exceptional. My own high-frequency scalper returned a UPI of 1.8 on a 600-trade sample, which surprised me because the win rate was barely 55%. The squaring penalty in Ulcer Index was working in my favor.
One thing to watch for: a strategy with very few trades can show misleadingly low Ulcer Index because it never had time to hit a real drawdown. Below 30 trades, I would treat both Ulcer Index and UPI as preliminary numbers.
What Counts as Good?
| Range | Value | What It Means |
|---|---|---|
| Excellent | 0.00 - 0.10 | The equity curve is nearly flat or steadily climbing. Almost no time spent in drawdown. Rare for most strategies. |
| Good | 0.10 - 0.25 | Mild drawdowns that recover quickly. The strategy might dip 5-10% but bounces back within a few trades. |
| Fair | 0.25 - 0.50 | Moderate drawdown risk. Worth checking the drawdown chart to see if recoveries are fast or slow. May still be acceptable for trend-following systems. |
| Poor | 0.50 - 1.00 | Significant drawdown pain. The strategy spends substantial time below its peak equity. High risk of abandoning the system emotionally. |
| Very Poor | 1.00+ | Deep and prolonged drawdowns. The strategy likely has a structural problem, such as overfitting or a broken edge in current market conditions. |
How Pineify Calculates Ulcer Index
What sets Pineify apart for Ulcer Index is the data source. Most Ulcer Index calculators you find online ask for daily equity curve values or closing prices. That works if you have a spreadsheet of daily account balances, but most traders do not track that. What you do have is the TradingView Strategy Tester CSV export with every single trade's P&L. Pineify reconstructs the trade-by-trade equity curve from your CSV. Each trade adds its net profit to the running balance. The peak equity updates after each trade. Every drawdown between trades is calculated from real entries and exits, not interpolated from daily bars. The result is a Ulcer Index based on exactly when your strategy was actually in drawdown, not an estimate. When I uploaded my first CSV to test this, the Ulcer Index came back at 0.31. I had assumed my strategy was smoother because the max drawdown was only 12%. The 0.31 number made me look closer at the drawdown chart, and sure enough, there were three separate periods where the equity drifted 8-10% below peak and took 15-20 trades to recover. I had been mentally smoothing those out. The Ulcer Index caught it. The UPI came in at 0.82. That was a relief. It meant the return justified the drawdown pain. But the Ulcer Index alone told me I needed to work on drawdown recovery speed. Pineify does this for free, entirely in your browser. Your CSV never reaches a server. You get Ulcer Index, UPI, a full drawdown chart, and 16+ other KPIs from a single upload. No Python scripts, no Excel formulas, no manual math.
Get Your Ulcer Index in Seconds
Upload your TradingView backtest CSV and get Ulcer Index (UI) plus 15+ other professional metrics. No signup needed.
Analyze Your Backtest NowFrequently Asked Questions
Everything you need to know about this metric