Ulcer Index in Trading: Formula, Examples and How to Use It
Learn what the Ulcer Index measures, how to calculate it step by step, how to read the number, and how to use it with the Martin ratio to judge a strategy.

The Ulcer Index is a risk measure that tracks only the downside: how far a price or equity curve sits below its previous high, and how long it stays there. It is the square root of the average of squared percentage drawdowns, so a deep, long slump scores far worse than a brief dip. Traders use it to compare strategies, size up a drawdown they would have to sit through, and replace standard deviation when upside swings should not count as risk.
Below: what the number means, the formula with a worked example you can follow by hand, how to read it, the Martin ratio built on it, and where it falls short.
TL;DR
- The Ulcer Index measures the depth and duration of drawdowns from prior peaks and ignores upside volatility.
- Formula: take each period's percentage drawdown from the running high, square it, average the squares, then take the square root.
- Lower is better. A strategy with a lower Ulcer Index has had shallower or shorter drawdowns over the same window.
- Divide excess return by the Ulcer Index and you get the Ulcer Performance Index, also called the Martin ratio.
- It describes the past. It does not predict the next price move, so use it alongside max drawdown, profit factor and out-of-sample testing.
Table of Contents
- What the Ulcer Index measures
- How to calculate the Ulcer Index
- How to read an Ulcer Index value
- The Ulcer Performance Index (Martin ratio)
- Using the Ulcer Index in backtesting
- Limits of the Ulcer Index
- Putting it to work in your own testing
- FAQ
- Sources
What the Ulcer Index measures
Most risk statistics treat a big gain and a big loss as equally "risky". Standard deviation, the usual yardstick, counts both upward and downward changes. A strategy that jumps 8% in a week looks as dangerous as one that drops 8%. Few traders feel it that way.
The Ulcer Index looks only at drawdowns, meaning the percentage decline from an earlier high. It captures two things at once:
- Depth: how far below the peak you fell.
- Duration: how many periods you spent below the peak before recovering.
The duration part matters. The PerformanceAnalytics documentation for R notes that the index penalizes managers who take longer to recover to previous peaks. Two equity curves can both bottom out at a 12% drawdown, but the one that claws back in a month has a much lower index than the one that stays underwater for a year.
Peter Martin developed the measure in 1987, and it reached the public in the 1989 book The Investors Guide to Fidelity Funds, co-authored with Byron McCann, according to Martin's own write-up. The name comes from the stress that holding through a decline puts on an investor.
How to calculate the Ulcer Index
The calculation has three steps, and you can do it in a spreadsheet. Trading Technologies documents the drawdown term as (Close − n-period High Close) / n-period High Close × 100. The result is zero when price sits at a new high and negative when it is below.
- Percentage drawdown. For each period, find the highest close so far (or in your lookback window). Compute (close − highest close) ÷ highest close × 100.
- Square and average. Square each drawdown, then take the mean of the squares across the periods.
- Square root. The root of that mean is the Ulcer Index, expressed in percentage points.
Squaring does the heavy lifting. A 10% drawdown contributes 100 to the average, while a 2% drawdown contributes only 4. Deep losses dominate the result, which is why the index punishes severe slumps more than a plain average of drawdowns would.
A worked example
Take five consecutive periods of an equity curve. The numbers below are made up for illustration.
| Period | Equity | Running high | Drawdown % | Squared |
|---|---|---|---|---|
| 1 | 10,000 | 10,000 | 0.00 | 0.00 |
| 2 | 9,800 | 10,000 | -2.00 | 4.00 |
| 3 | 9,500 | 10,000 | -5.00 | 25.00 |
| 4 | 9,700 | 10,000 | -3.00 | 9.00 |
| 5 | 10,100 | 10,100 | 0.00 | 0.00 |
The squares add up to 38. Divide by 5 periods and you get 7.6. The square root of 7.6 is about 2.76. So the Ulcer Index for this short stretch is roughly 2.76.
A real calculation uses far more periods, typically a rolling window of 14 bars for the indicator version or the full test length for a strategy report.
Which data frequency to use
The frequency you choose changes the answer. Martin says weekly data is a robust choice and daily data also works, while quarterly or longer intervals are strongly discouraged because they can miss drawdown-and-recovery events inside the period. If your strategy holds trades for hours or days, daily equity marks are the sensible minimum. Whatever you pick, keep it identical when comparing two strategies.
Two definitions you will run into
Two versions circulate. The indicator version on charting platforms uses a rolling lookback for the running high, so the drawdown is measured from the highest close in the last n bars. The portfolio version measures from the all-time high of the whole series. Both square, average and root the drawdowns, but the rolling one forgets old peaks, so it will read lower after a long slump has aged out of the window. Know which one your tool uses before comparing numbers from two places.
How to read an Ulcer Index value
There is no universal "good" number. The index is expressed in percentage points of drawdown stress and depends on the asset, timeframe and window. What you can say is relative:
- A lower Ulcer Index means lower drawdown risk than a higher one, and higher values point to deeper or more sustained drawdowns.
- Risk-averse investors may avoid portfolios with high values, since those portfolios may be slower to recover after a severe decline.
- It can disagree with standard deviation. AAII notes that the Ulcer Index can sometimes give conflicting risk values compared with standard deviation, because it targets downside rather than general volatility.
A comparison that shows the difference
Imagine two hypothetical strategies tested over the same three years. Strategy A has a max drawdown of 14%, but it recovers within six weeks. Strategy B has a max drawdown of 11%, but it spends most of a year below its peak. On max drawdown alone, B looks safer. On the Ulcer Index, A would likely come out lower, because B accumulates many periods of moderate drawdown that each add to the average of squares.

That is the practical value. Max drawdown gives you the single worst moment. The Ulcer Index tells you how much of the ride was spent underwater. If you want the worst-case view first, our guide to maximum drawdown and why a 50% loss needs a 100% gain covers it, and the two measures work well as a pair.
The Ulcer Performance Index (Martin ratio)
Risk numbers are most useful next to return. The Ulcer Performance Index, or Martin ratio, follows the shape of the Sharpe ratio but swaps the denominator. It divides excess return by the Ulcer Index, so it shows the extra return earned per unit of drawdown risk. AAII describes the calculation as annualized return minus the annualized risk-free return, divided by the Ulcer Index.
A quick example with made-up figures: a strategy returns 14% annualized, the risk-free rate is 4%, and the Ulcer Index is 5. The Martin ratio is (14 − 4) ÷ 5 = 2.0. A second strategy returns 18% with an Ulcer Index of 12. Its ratio is (18 − 4) ÷ 12, about 1.17. The second strategy earns more in absolute terms, yet it pays for it with far more time and depth underwater, and the ratio shows that.
Use the ratio to rank candidates on the same market and period. Do not compare a Martin ratio from daily data on one asset with one from weekly data on another.

Using the Ulcer Index in backtesting
A backtest produces an equity curve, and the Ulcer Index is a ready-made summary of how painful that curve was. It can serve as a risk measure for historical strategies in place of standard deviation. Here is a workable routine.
- Test the original rules on a long window that includes both rising and falling markets.
- Record the headline metrics: win rate, profit factor, max drawdown, and the Ulcer Index from the equity curve.
- Change one rule at a time, such as the stop placement or the trend filter, and retest on the same data.
- Keep the change only if risk falls without return collapsing. A tweak that raises profit factor slightly but doubles the Ulcer Index is usually curve fitting or a bigger burden on your nerves.
- Check on data the rules have not seen. Improvements that only work on the period you tuned them on are not improvements.
A high win rate can hide a poor Ulcer Index. A strategy that wins 80% of the time but gives it all back in a handful of long losing stretches will look fine on win rate and badly on drawdown stress. This is why traders who verify strategies from YouTube videos should look past the headline win rate. If you want the full process, our step-by-step guide to backtesting a trading strategy walks through it.
Drawdown limits and the rules you actually trade under
If you trade futures with a funded account, drawdown is not just a statistic. Many accounts enforce a drawdown limit that can follow your peak balance, which makes recovery time especially costly. Trailing drawdown in futures trading explains how that rule works. A strategy with a low Ulcer Index is generally easier to run inside such limits, because it spends less time far below its high.
Ruin and sample size
A single backtest is one path through history. A low Ulcer Index from that path does not mean the next sequence of trades will behave the same. Reshuffling or resampling trades gives a range of drawdowns rather than one figure, and our piece on 95th percentile simulations and risk of ruin shows how to read that range.
Limits of the Ulcer Index
It is backward looking. The index describes what happened. It is not a forecast of the next price movement, and a calm stretch gives no promise of another one.
Some traders use it as a signal, with caution. Some traders watch for spikes above normal historical levels as a prompt to consider exiting long positions. Treat that as a hypothesis to test on your own data, not a rule. Verify any such signal through a backtest before risking capital.
It depends on the window. A rolling 14-bar index and a full-history index answer different questions. A short window reacts fast but forgets old crashes.
It ignores trade-level detail. The index works on the equity curve. It cannot tell you whether losses came from a few oversized trades or from many small ones, how long the average trade lasted, or whether a strategy depends on one outlier win. Look at profit factor and the trade list too.
It cannot see the tail you have not lived through. If your data contains no crash, the index will not show one.
Putting it to work in your own testing
A sensible dashboard for judging any strategy has four pieces: return, max drawdown, a duration-aware measure like the Ulcer Index, and profit factor. Each hides something the others reveal.
Backtestify reports win rate, profit factor and max drawdown for every strategy you test, lets you describe rules in plain English, and puts original and improved versions side by side on recent data. You can see how a rule change affects drawdown before you trade it, then export the result in TradingView Pine Script format. You can browse tested setups in the published strategy library, including losers, or check the methodology to see how trades are simulated. The Free plan lets you start; Pro is $29 per month or $190 per year and adds unlimited backtesting, improvement and forecasting.
FAQ
What is a good Ulcer Index value?
There is no universal threshold. The number depends on the asset, the data frequency and the window, so compare it only between strategies tested the same way. Lower means shallower or shorter drawdowns, and a lower value is better when returns are similar.
How do I calculate the Ulcer Index in Excel?
Add a column for the running maximum of your equity or close, then a column for percentage drawdown: (value − running max) ÷ running max × 100. Square that column, average it with AVERAGE, and take the square root with SQRT. Use the same data frequency every time you compare.
What is the difference between the Ulcer Index and standard deviation?
Standard deviation counts upward and downward moves alike. The Ulcer Index counts only declines from prior highs and also reflects how long they last. The two can give conflicting rankings, which is the reason many traders look at both.
What is the Martin ratio?
The Martin ratio, or Ulcer Performance Index, divides a strategy's return above the risk-free rate by its Ulcer Index. It works like the Sharpe ratio but measures reward per unit of drawdown stress instead of per unit of total volatility.
Can the Ulcer Index predict the next price move?
No. It measures past drawdown depth and duration. Some traders treat spikes as a warning, but that is a rule you should test on historical data before relying on it.
Sources
- Ulcer Index and UPI Measure Investment Risk and Risk-Adjusted Performance (Tangotools)
- Ulcer Index, Trading Technologies Help Library
- R: calculate the Ulcer Index (PerformanceAnalytics)
- Understanding the Ulcer Index (Investopedia)
- The Ulcer Index of the AAII Stock Screens (AAII)