Given m real numbers {1 ... n} please provide a formula or algorithm to find the largest "drawdown." I'm having trouble formulating into words exactly what a drawdown is, but I have illustrated it in the below graph. A poor definition of "drawdown" would be "The distance between and peak and the lowest subsequent valley." The biggest drawdown in this graph is A-B, or (A-B)/A percent.
Edit: Right after I posted this I came up with an algorithm, but there may be more efficient versions. I'm interested in how you guys approach this.