Maximum DrowDown
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tmr0

//@version=5
indicator("tMDD", format=format.percent, precision=0)
max = .0
max := max[1] > high ? max[1] : high

dd = low/max - 1

mdd = .0
mdd := mdd[1] < dd ? mdd[1] : dd

plot(dd*100, style=plot.style_area, transp=75, color=color.fuchsia)
plot(mdd*100, style=plot.style_stepline_diamond, transp=25, color=color.aqua)