7/1/2023 0 Comments Max drawdown geekforgeek![]() ![]() That’s possible because we know how the problem has been broken down into patterns. For instance, if the problem changes to “calculate the minimum drawdown”, we just have to replace ranges::max with ranges::min. Playing with patterns is also useful for tackling problem variations fluently. Playing with patterns is a productive training for our brain. Playing with patterns is to programmers creativity as playing with colors is to painters creativity. The same challenge gave us the opportunity to find another solution with the same patterns. If you have some difficulties at this point, write down the “intermediate” STL code without ranges. Std::partial_sum(std::begin(stock), std::end(stock), std::begin(maxs), (auto l, auto r), view::reverse(stock), mins)) The MDD problem can be formulated as follows: given an array A, find the maximum difference A - A with j & stock) Let’s see how to solve this problem and how to bring more value out of it. In economics, MDD is an indicator of risk and so an important problem to solve. In the series above, the maximum drawdown is 16. The Maximum drawdown is just the highest value among all the drawdowns. You know, the 2008 crisis affected C++ too, renaissance in 2011/2012, some disappointments in 2014/2015 because C++14 was a minor release and “Concepts” didn’t make it, and nowadays the stock is increasing since programmers feel hopeful about C++20.ĭrawdowns are the differences between the value at one year and the value at the previous maximum peak. price of a stock on a certain period of time).įor example, here is the hypothetical price series of the fake “CPlusPlus” stock: In finance, the drawdown is the measure of the decline from a historical peak in some series of data (e.g. My previous post has been well received by the ecosystem so I have decided to write a short follow-up article on another classical problem that can be solved with similar patterns.
0 Comments
Leave a Reply. |