Advertisement
kocurekc

Pine Script - Ulcer Index

Apr 17th, 2014
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. study("Ulcer Index")
  2. // Ulcer Index
  3. // source: http://en.wikipedia.org/wiki/Ulcer_index
  4. //
  5. // Rewrite for Tradingview "Pine Script" by Kocurekc, April 2014
  6. // https://getsatisfaction.com/tradingview/
  7. // https://www.tradingview.com/u/kocurekc/
  8. // Code is provided as public domain, no warranty
  9.  
  10. len = input(title="Lookback Period", type=integer, defval=14, minval=2)
  11.  
  12. drawdown = ((close - highest(close, len)) / highest(close, len))*100
  13. SofS = pow(sum(pow(drawdown,2),len)/len, 0.5)
  14. hline(10, linestyle=dashed)
  15. plot(SofS)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement