In R, I see there are two packages that have a maxdrawdown function.
One is fTrading and the other is PerformaceAnalytics.
Each of those does a different calculation.
- fTrading seems to make the assumption that the values are prices of an asset so the drawdown is in valuation.
- The same applies to PerformanceAnalytics except it gives the answer as a percentage.
Is there a package with a maxdrawdown function that expects P/L data in a series and gives the draw down based on that?
e.g if you had the following data
c(12,10,5,-4,-2,1,5,6)
The max drawdown would be :
-4 + -2=-6.
maxdrawdown
from the tseries package ...fTrading::maxDrawdown
is based ontseries::maxdrawdown
(which is older). The advantage to usingtseries
is that it doesn't Depend on several packages that you might not want to install and load.