Ulcer Performance Panel
A Sharpe-style ratio divides return by plain standard deviation of returns, which punishes a smooth uptrend with occasional sharp up-days exactly as much as it punishes a genuinely painful, prolonged drawdown - the two feel completely different to a trader holding the position, but a plain volatility measure cannot tell them apart. The Ulcer Index only accumulates depth and duration BELOW the trailing peak: every bar the price spends underwater contributes to it, and every bar it spends making new highs contributes nothing. This indicator computes the Ulcer Index over a rolling window (the peak used is the highest close WITHIN that window, not an all-history peak, so an old high from years back does not haunt every reading forever), then divides the window's own annualised return by it to get the Martin ratio - a higher reading means more return earned per unit of "how much this actually hurt to hold", not per unit of raw variance. The annualised return uses a calendar-based bars-per-year estimate from the chart's own period; see NOTES for what that approximates and what it does not. Notes and limitations - The annualised return is a calendar approximation: it assumes the market trades every minute of every day of the year at the chart's own bar period. It is directionally useful for comparing symbols or windows against each other, but is not a precise session-aware annualisation. - When a window has zero drawdown at all (a perfectly flat or strictly rising close series), the Ulcer Index is zero and the Martin ratio is left undefined for that bar (plotted as a gap) rather than shown as an artificial infinity. - No other project in this catalogue is included here. The Ulcer Index maths is reimplemented inline in this file - house style forbids including another project's source regardless of whether a matching one already existed.
Indicator · MT4 · v1.0 · Free
About Ulcer Performance Panel
Ulcer Performance Panel is an indicator for MetaTrader 4. It has 1 setting, such as Window. MQL source code included.
Files in the download: UlcerPerformancePanel.mq4, UlcerPerformancePanel.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Window | 20 | Bars of trailing history used for both the Ulcer Index and the return estimate |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Martingale · MT4 Indicator · MQL4 Source Code