Skip to main content

Ulcer Index for Amibroker (AFL)

extremist about 9 years ago Amibroker (AFL)

  • Rating:
    2 / 5 (Votes 6)
  • Tags:
    oscillator, amibroker

The ulcer index is a stock market risk measure or technical analysis indicator devised by Peter Martin

https://en.wikipedia.org/wiki/Ulcer_index

code converted from

https://www.tradingview.com/script/QuqgdJgF-Indicator-Ulcer-Index/

credit : LazyBear.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN(" Ulcer Index ");

//https://www.tradingview.com/script/QuqgdJgF-Indicator-Ulcer-Index/
// Credits : LazyBear - TradingView.

length = Param( "Length", 10, 1, 5000, 1 );
cutoff = Param( "Cut off", 5, 0, 100, 0.1 );

hcl=hhv(close,length);
r=100.0*((close-hcl)/hcl);
ui=sqrt(sum(r^2, length)/length);
col=IIf(ui>cutoff,colorRed,colorAqua);
Plot( ui, "Ulcer Index ("+length+","+cutoff+") ", col);
Plotgrid(cutoff,colorBlack,9, 1);

_SECTION_END();

1 comments

Leave Comment

Please login here to leave a comment.