Skip to content

Instantly share code, notes, and snippets.

@marketcalls
Created June 3, 2018 08:42
Show Gist options
  • Save marketcalls/beaf613c697396bfaa2246b0e2676af1 to your computer and use it in GitHub Desktop.
Save marketcalls/beaf613c697396bfaa2246b0e2676af1 to your computer and use it in GitHub Desktop.
Equity Drawdown - Marketcalls
////////////////////////////////////////////////////////////
// Copyright by Rajandran R v1.0 03/06/2018
// Website : www.marketcalls.in
////////////////////////////////////////////////////////////
study(title="Equity Drawdown - Marketcalls")
Eq=close
MaxEQ = Eq > MaxEQ[1] ? Eq : nz(MaxEQ[1], Eq)
DD = 100 * ( Eq - MaxEQ ) / MaxEQ
MaxDD = DD < MaxDD[1] ? DD : nz(MaxDD[1], DD)
plot(DD, color=red, title="Drawdown", style=area, linewidth=2, transp=40)
plot(MaxDD, color=blue, title="Max Drawdown", style=line, linewidth=3, transp=40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment