Ulcer Index

The Ulcer Index was authored by Peter Martin in 1987. It is designed as a measure of an instrument’s volatility or risk. The user may change the input (close) and period length. This indicator’s definition is further expressed in the condensed code given in the calculation below.See also Ulcer Index.

Ulcer Index

How To Trade Using the Ulcer Index

The Ulcer Index may be used to evaluate a instrument’s volatility or risk. No trading signals are calculated.

How To Access in MotiveWave

Go to the top menu, choose Study>Performance>Ulcer Index

or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.


//input = price, user defined, default is close
//period = p1, user defined, default is 30
//index = current bar number, LOE = less or equal
//sqrt = square root

Plot: ulcer = ulcer(index, p1, input);
Method ulcer(int index, int period, Object input) 
sumSq = 0, iprice = 0, dd = 0; 
peak = 0;
for (int i = index-period+1; i LOE index; i++) 
    iprice = price[i];
    if (iprice moreThan peak) peak = iprice;
        dd = (100 * (iprice/peak) -1);
        sumSq = sumSq + (dd * dd);
return Math.sqrt(sumSq/period);