This is the third of a series of problems on quant trading. It builds on earlier problems 45776 and 45860
Goal
Similar to problem 45860, allowing short-selling and leverage. Check <https://www.sec.gov/answers/shortsale.htm> and <https://en.wikipedia.org/wiki/Leverage_(finance)>
Use a fractional trading strategy, allowing short selling and leverage, as follows:
  • Each day invest fraction E of the available funds, with -2 <= E <= 3
  • This is referred as a limit of 3x leverage on long positions, and 2x leverage on short positions
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 the state of the trading signal S
  • E, a 2 x 1 vector of security exposures in each state, i.e.: invest a fraction E(1) of the available equity when S(i) < t, and a fraction E(2) when S(i) >= t, with -2 <= E(k) <= 3, for any k
Hints
  • The array of daily returns can be calculated by R = D.*E(1+(S(1:end-1)>=t))'

Solution Stats

3 Solutions

2 Solvers

Last Solution submitted on Sep 28, 2024

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...