Problem 45860. Algorithmic Trading - 2 (optimize Calmar Ratio)

This is the second of a series of problems on quant trading. It builds on earlier problem 45776 <https://www.mathworks.com/matlabcentral/cody/problems/45776-algorithmic-trading-1-optimize-trading-strategy-simple-case>
Goal
  • Maximize the Calmar Ratio over the test period, calculated on daily returns, defined as C = CAGR/MDD, were MDD is the Maximum Drawdown of the return series, defined as the maximum relative drop from a peak (always positive).
  • Max Drawdown can be calculated by MDD = -min((1+cR)./(1+cummax(cR))-1), where cR=cumprod(R+1)-1 is the cumulative compound return over time, mR=cummax(cR) is the historical maximum cumulative compound return over time, and R = D.*(S(1:n-1)>t) is the daily return of the investment strategy
You are given
  • P, a [n x 1] vector of daily prices of the traded security, at market open (always positive)
  • S, a [n x 1] vector of trading signals, calculated just ahead of market open (can take any real value)
  • These will serve both as training and test set
Your function should return
  • t, a scalar threshold that determines this simple trading strategy: invest all the available funds in the security when S>t, stay in cash otherwise
Hints
  • The Calmar Ratio is a risk-weighted return metric. The optimal t also maximizes log(C) or, more simply maximizes sum(log(1+D.*(S(1:n-1)>t)))-cummax(cumsum(log(R+1)))

Solution Stats

16.67% Correct | 83.33% Incorrect
Last Solution submitted on Sep 28, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers2

Suggested Problems

More from this Author10

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!