What Is the Ulcer Index? Formula and What Is Good
What is the ulcer index: the formula with the x100, a worked example, why the range is 0 to 100 and not 0 to 4, and why no level counts as good.
The ulcer index is one number for how deep your drawdowns were and how long they lasted. Every close is compared with the highest close in the look-back window, each of those percentage gaps is squared, and the index is the square root of their average, so it reads 0 when every close is a new high and climbs as price sits further below its peak for longer.
No level counts as good on its own. The published answers to what counts as a bad reading run from 2 to 40, and one published ceiling is arithmetically impossible. The formula settles both arguments.
What is the ulcer index?
A measure of downside risk built only from closes below a recent peak. StockCharts' ChartSchool quotes the inventor, Peter G. Martin, directly:
"Ulcer Index measures the depth and duration of percentage drawdowns in price from earlier highs. The greater a drawdown in value, and the longer it takes to recover to earlier highs, the higher the UI. Technically, it is the square root of the mean of the squared percentage drawdowns in value. The squaring effect penalizes large drawdowns proportionately more than small drawdowns."
It is not a signal generator, and the pages that explain it say so. ChartSchool: "Keep in mind that the Ulcer Index is not an indicator per se. It is just a measure of downside risk that can be used to compute risk-adjusted returns." earn2trade.com: "Investors and traders shouldn't treat the UI as a typical technical indicator but rather as a powerful measure of downside risk designed to calculate risk-adjusted returns." angelone.in puts it in one line: "First and foremost, the Ulcer Index is a measure of risk, not a trading indication."
Two versions of the origin are in print. ChartSchool, earn2trade, tradesviz.com and stockgro.club say Martin and Byron McCann developed it in 1987, "first introduced in their 1989 book, The Investor's Guide to Fidelity Funds". angelone splits it: "The Ulcer Index was developed by Peter Martin in 1987 and was later published in collaboration with Byron McCann in 1989."
The index never forecasts. It describes drawdowns that have already happened.
What is the ulcer index formula?
Three steps, and the multiplication by 100 in the first one often goes missing. ChartSchool prints them as:
Percent-Drawdown = ((Close - 14-period Max Close)/14-period Max Close) x 100
Squared Average = (14-period Sum of Percent-Drawdown Squared)/14
Ulcer Index = Square Root of Squared Average
earn2trade and howtotrade.com print the same three steps with the same multiplier, as "Percentage Drawdown = [(Close – 14-period High Close)/14-period High Close] x 100" followed by "Squared Average = (14-period Sum of Percentage Drawdown Squared)/14". So does angelone, as "Percentage Drawdown = [(Close on Current Day − Highest Close) / Highest Close] × 100", and so does stockgro.
app.tradingsim.com leaves the multiplier out. Its step reads "Drawdown Percentage = ((Close – Highest Close over 14-periods)/Highest Close over 14-periods)", with no x 100 anywhere in it. Follow that literally and every reading you produce is 100 times smaller than a reading built the other way, and nothing in the output will look wrong to you.
The drawdowns go in as percentages, so the index comes out in percentage points. stockgro prints its result with a percent sign, "5.13%", where other pages print a bare number. Write down which you are using.
Is the ulcer index built into ChartLabs?
Yes, on a price chart. It sits in the chart's Indicators menu, in the Standard list under Volatility, named Ulcer Index, and it draws in its own pane below price with the scale pinned at zero. The settings are Source, set to the close, and Length, at 14 by default, the same 14 most published descriptions quote. Ours carries the x 100, so its readings are in percentage points.
What is the ulcer index range?
Between 0 and 100, and that is arithmetic rather than opinion.
Each percentage drawdown is (Close - Max Close) / Max Close x 100. For any positive close that value is above minus 100 and at most 0: the best case is a close sitting at the window high, which gives 0, and the value only approaches minus 100 as the close approaches zero. Square it and you are inside [0, 10000). Average those squares and you are still inside [0, 10000). Take the square root and the ulcer index is inside [0, 100).
Two published ranges are impossible as printed:
- howtotrade.com: "It is important to note that the Ulcer Index indicator adopts a parameter range of 0 to 4, with 2 serving as the average or zero level." The zero level is 0, which ChartSchool states outright: "The index is zero if prices close higher each period." And 4 is not a ceiling. ChartSchool's own published reading of a 52-period average "at 4.71" is already past it.
- stockgro.club: "Ulcer index values range from zero to infinity." The lower bound is right. The upper bound is 100, for the reason above.
Both pages get the three calculation steps right. The ranges printed beside them do not follow from those steps.
A worked example, with round numbers
An example, not a recommendation and not a trade. Five periods, a running high of 100, and the index worked out three ways so you can watch depth and duration trade against each other.
| Case | Closes | Percentage drawdowns | Squared average | Ulcer index |
|---|---|---|---|---|
| One deep dip | 100, 100, 90, 100, 100 | 0, 0, -10, 0, 0 | 100 / 5 = 20 | square root of 20 = 4.47 |
| Two shallow dips | 100, 95, 95, 100, 100 | 0, -5, -5, 0, 0 | 50 / 5 = 10 | square root of 10 = 3.16 |
| One shallow dip, held | 100, 95, 95, 95, 95 | 0, -5, -5, -5, -5 | 100 / 5 = 20 | square root of 20 = 4.47 |
Read the first two rows together and the squaring is doing its work: the same total of ten percentage points, taken as one 10 percent dip instead of two 5 percent dips, scores 4.47 against 3.16. Read the first and third rows together and you get the duration half: four periods held 5 percent under water score exactly the same 4.47 as one period 10 percent under water.
Depth and duration are both in there, and the index cannot tell you which one you had. That is its main limitation, and a reading therefore needs its period and its series named beside it.
For a second example with a different shape, stockgro publishes a full worked calculation on a deliberately short two-period window. Closes of 100, 95 and 90 give "Percentage drawdown for day-3 = [(90 – 95) / 95] * 100 = -5.26%" and "day-2 = [(95 – 100) / 100] * 100 = -5%", then "Squared average = [(-5.26)^2 + (-5%)^2] / 2 = 26.325" and "Ulcer index = (26.325) ^ 0.5 = 5.13%". Both drawdowns check out and the root is consistent with the figure printed above it. The squared average itself does not quite reproduce: the rounded drawdowns give 26.33 and the exact ones give 26.35, not 26.325. It makes no difference to the answer, since all three round to 5.13, and the page is also right that the reversed series, 90, 95, 100, would give an index of zero.
What is a good ulcer index?
There is no universal level. angelone.in says it plainly: "No Absolute Threshold: There is no fixed Ulcer Index level that inherently categorizes an asset as universally safe or risky", and "No fixed number consistently indicates a high or low UI. It is better to compare the current reading to past levels or to other similar investments."
The levels that do get published come with a page attached, and they do not agree:
| Level | Printed as | Period behind it | Source |
|---|---|---|---|
| 0 to 4, with 2 as the middle | "a parameter range of 0 to 4, with 2 serving as the average or zero level" | 14 by default | howtotrade.com |
| 0 to infinity | "Ulcer index values range from zero to infinity" | 14 by default, 2 in its example | stockgro.club |
| Above 10 is rare | "With only one spike above 10 since 2008, investors can conclude that a spike above 10 is relatively rare" | 9-period index on weekly data | chartschool.stockcharts.com |
| 4.71 and 3.24 | Real 52-week averages of the 9-week index on two funds, "The 52-period moving average was at 4.71" and "The 52-week moving average is at 3.24" | 9-period index, 52-period average | chartschool.stockcharts.com |
| 10 as a filter | "if the stock has an ulcer index indicator value of 10 or more you will not place any trades" | 14 | app.tradingsim.com |
| Above 40 | "once you see readings above 40, a stock is in real trouble" | 14 | app.tradingsim.com |
| No fixed level | "No fixed number consistently indicates a high or low UI" | 14 by default | angelone.in |
Where trouble is said to begin spreads from 2 to 40. One of the ceilings cannot happen. And the only real published readings in that table, 4.71 and 3.24, were computed on a 9-period index over weekly bars rather than on the 14-period default the rest of the table quotes.
We adopt none of these levels. The ulcer index is a comparison tool. Run it on two instruments, or on two versions of your own strategy, over the same period, the same bar interval and the same scale, and the lower number had the shallower or shorter drawdowns. Taken alone, a single reading tells you almost nothing.
What period should I use for the ulcer index?
14 is the documented default, and the page that documents it uses 9 in every one of its own charts.
- ChartSchool documents the default in words, "Using a default setting of 14 periods", and its scan clause is "[ULCER(14) < 10]". Then both its worked charts use a 9-period ulcer index smoothed by a 52-period average, and its comparison table uses "a 52-week average of the 9-week Ulcer Index".
- Martin's own preference, as ChartSchool reports it: "Martin notes that the Ulcer Index works well with weekly data."
- earn2trade offers the long alternative, "Investors analyze longer look-back periods, such as 50 days", and tells you to check the setting before reading anything: "Hence you should check whether the default period is set at 14."
- howtotrade, which publishes the impossible range, also publishes this warning about settings: "the customization of parameters in the UI indicator introduces subjectivity, as different traders may choose different settings, leading to inconsistent interpretation of signals."
So the rule is the same as the rule for the range: record the period with the reading. A 9-period weekly index and a 14-period daily index are two different numbers about the same price series, and nothing on the chart tells you which one you are looking at.
One honest limit, from app.tradingsim.com: "there is a 14-day lookback period. When you are trading the stocks in real-time it will be very difficult to use the indicator for any forecast purposes".
Ulcer index against max drawdown, Sortino and Sharpe
Five measures of the same discomfort. What fits whom depends on whether you care about the worst moment, the whole ride, or the upside too.
| Measure | What it measures | The weakness, as published |
|---|---|---|
| Max drawdown | The single worst peak-to-trough fall | "a single worst point" that "ignores duration" (tradesviz.com) |
| Ulcer index | Depth and duration of every drawdown in one number | Depth and duration are mixed, as the three-case table above shows |
| Sharpe ratio | "Return / total volatility" | "Penalizes upside" (tradesviz.com). ChartSchool makes the same point: the standard deviation "accounts for both upside and downside volatility" |
| Sortino ratio | "Return / downside volatility" | "Ignores drawdown duration" (tradesviz.com) |
| Calmar ratio | "Return / max drawdown" | "Single-point; ignores duration" (tradesviz.com) |
tradesviz.com, a trade journal product, publishes an illustration of why duration is worth measuring. Two hypothetical traders, same worst moment and same return: both at minus 15 percent max drawdown and 30 percent total return, but one spent 2 days more than 10 percent under water and the other 45 days. Their ulcer indexes are 4.2 and 11.8, and the resulting UPIs are 7.14 and 2.54. Both divisions check out. A max drawdown column cannot tell those two apart, and the ulcer index can.
Our own analytics sit on the single-point side of that table. They report a maximum drawdown over your equity curve, with Sharpe, Sortino and Calmar beside it, and no ulcer index anywhere.
What is the ulcer performance index (UPI)?
Return divided by the ulcer index, also called the Martin Ratio. The two published versions use different numerators, so their numbers are not comparable with each other.
- ChartSchool, following Martin: the UPI "is simply total return less the risk-free return divided by the Ulcer Index", and its own table uses the 10-year Treasury yield as the risk-free rate.
- tradesviz: "UPI = Total Net P&L / Ulcer Index", with no risk-free subtraction at all.
Then tradesviz prints two worked examples with two different kinds of numerator on the same page. Its two-trader table divides a percentage return, 30 divided by 4.2 to get 7.14. Its example underneath divides money: "A trader with $30,000 total profit and an Ulcer Index of 5.2 has a UPI of 5,769". Both sums are right. They are not the same measure, and only the first can mean anything against that page's own interpretation bands, which run from "Losing money overall" below 0, through "Moderate" between 0.5 and 1.5, to "Excellent" above 3.0.
Those bands are one product's table, built for one numerator, and we do not adopt them as a standard. If you compute a UPI, write down which numerator you used and whether you subtracted a risk-free rate.
The same choice shows up one level down, in our own analytics: Sharpe is calculated from your daily returns, using a 5% yearly risk-free rate, annualized with the square root of 252. Two Sharpe figures built on two different risk-free rates are not comparable either.
How do you use the ulcer index on a backtest?
The ulcer index runs on an equity curve exactly as happily as on a price series, which is the version that suits a trader rather than a fund analyst. tradesviz does precisely that: "For each day, calculate the percentage drawdown from the peak cumulative P&L: Drawdown_i = (Equity_i − Peak_i) / Peak_i × 100", and its second step is the root mean square of those drawdowns, which the page calls "essentially the RMS (root-mean-square) of drawdowns".
So from a list of your own closed trades you can compute it with five columns and no indicator at all:
- Your balance after each trade, or at the end of each day
- The running peak of that balance
- The percentage below the peak at each step, times 100
- Each of those squared, then averaged over the n steps
- The square root of that average
Four things have to travel with the result, or it is not comparable with anything: whether the series is per trade or per day, how many steps n covers, the date range, and whether you used percentages or money. Two ulcer indexes from different step definitions are different numbers, in the same way that a 9-period and a 14-period index are.
The number is not comparable against someone else's published level. Not howtotrade's 2, not tradingsim's 40, not the fund averages of 4.71 and 3.24, which were computed on weekly fund closes. Compare your strategy with your other strategy.
ChartLabs is a manual backtesting app: you replay cleaned tick data from Dukascopy bar by bar, place practice trades by hand, and get the trade list that step 1 needs, with notes and tags on each trade and a CSV export to work from. The analytics already report a maximum drawdown over the equity curve, with Sharpe, Sortino and Calmar next to it, so the ulcer index is the one column you would add yourself.
The built-in indicator reads price, not your equity curve, so for a strategy the five columns above are still the route. There is no automatic backtest in ChartLabs, so the testing stays on the chart and in your trade list.
Our drawdown calculator is a different tool, and the difference is worth knowing. It shows what a losing streak does to your account: the balance left, the drawdown in money and percent, and the gain you need to get back. It computes no index, no drawdown duration and no average of drawdowns. For the testing process itself, the beginner's guide to backtesting a strategy covers the loop end to end, and backtesting accuracy covers the costs that decide whether your equity curve is realistic before you measure its drawdowns at all.
Where do I find the ulcer index?
It ships as a studio indicator on several charting platforms, ours included, and as a statistic in some trade journals.
ChartSchool describes it on SharpCharts with "advanced options" for horizontal threshold lines and a scan clause, "[ULCER(14) < 10]". app.tradingsim.com says it has "the ulcer index indicator in our library of technical indicators". tradesviz computes it inside its UPI, under "Summary > Overall Statistics > Scores/Metrics tab". howtotrade walks through adding it on TradingView and notes that on MT4 or MT5 "you must download and install the indicator manually before using it".
The five steps work on any trade export, whichever of those you use.
Next step: compute it on your own trade list rather than on a fund. ChartLabs has a 7-day free trial with no credit card required, then one plan at $20 a month or $200 a year: start your free trial.
Related Topics
Related
Backtesting a Trading Strategy: A Beginner's Guide
What backtesting is, why it matters, and how to run one step by step: defining your rules, choosing clean historical data, stepping through the chart trade by trade, logging results, and reading the metrics that tell you whether your strategy has a real edge.
Backtesting Accuracy: How Slippage and Data Quality Matter
Why backtest results and live results drift apart, and what actually closes the gap: clean tick data, honest spread assumptions, and commission and slippage modelled directly on every trade you log.