In Journal of J, McCormick calculated (and pictured) the maximal drawdown.
Here is an alternative.
We use his values
10000* 50 75 40 60 35 80
500000 750000 400000 600000 350000 800000
and our values
?.@$~ 20
14 16 8 6 5 8 6 16 16 19 13 12 3 1 9 12 17 0 9 5
First the simple determination of the maximal drawdown as a percentage of the
last maximum:
>./(>./\ (1- {.%~ <./)/.]) 500000 750000 400000 600000 350000 800000
0.53333333
>./(>./\ (1- {.%~ <./)/.]) ?.@$~ 20
1
A bit more complicated is localisation of the max and min:
((({~ {.@]);{:@]) [:((i.,]) >./) [:(1- %~)/"1 {."1) ((>./\@:({."1) ({.,:
{:@(\:~))/. ])) (,.i.@#) 10000* 50 75 40 60 35 80
+--------+----------+
|750000 1|0.53333333|
|350000 4| |
+--------+----------+
And
((({~ {.@]);{:@]) [:((i.,]) >./) [:(1- %~)/"1 {."1) ((>./\@:({."1) ({.,:
{:@(\:~))/. ])) (,.i.@#) ?.@$~ 20
+-----+-+
|19 9|1|
| 0 17| |
+-----+-+
The first (rhs) step determines the respective max, min pairs, with locations
((>./\@:({."1) ({.,: {:@(\:~))/. ])) (,.i.@#) 10000* 50 75 40 60 35 80
500000 0
500000 0
750000 1
350000 4
800000 5
800000 5
((>./\@:({."1) ({.,: {:@(\:~))/. ])) (,.i.@#) ?.@$~ 20
14 0
14 0
16 1
5 4
19 9
0 17
The rest (lhs) is administration to filter out the max drawdown.
R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm