Course Name: Getting Started with Algorithmic Trading!, Section No: 9, Unit No: 6, Unit type: Notebook
why do we need to ensure the value never drops below 1?
# Ensure the value never drops below 1
running_max[running_max < 1] = 1
Course Name: Getting Started with Algorithmic Trading!, Section No: 9, Unit No: 6, Unit type: Notebook
why do we need to ensure the value never drops below 1?
# Ensure the value never drops below 1
running_max[running_max < 1] = 1
Hi Sebastian,
Generally, the portfolio value starts with 1 and hence the maximum value of the portfolio or peak can't be less than 1.
However, there could be cases where the portfolio value drops below 1.
For example, if the cumulative returns are -10%, -5%, -15%, then the running_max value would be 1*(1-0.1)(1-0.05)(1-0.15) = 0.738.
So to avoid such cases, we set the running_max value as 1.
To learn more about the Maximum Drawdown metric, you can check out the practice module on Maximum Drawdown for Risk Analysis available on Quantra.
I hope this was helpful.