Ulcer

Ulcer ( IDataHolder data , int length );

Default values:

length: 14

Description

Returns the Ulcer Index of data for the last length bars. The Ulcer Index is equal to root mean square of price percentage retracement which is calculated using the formula:

Input parameters

Parameter Default value Description
data - Defines data for which the Ulcer Index is found.
length 14 Defines period on which the Ulcer Index is found.

Example

declare lower;
input length = 100;
input risk_free_rate = 0.01;

def somedate = 20000101;
def growth = close - close[length];
def days = DaysFromDate(somedate) - DaysFromDate(somedate)[length];
def annualreturn = growth / close[length] * 365 / days;

plot MartinRatio = (annualreturn - risk_free_rate) * 100 / Ulcer(close, length);

This example calculates the Martin Ratio for an instrument.