2
$\begingroup$

Lets say I have some strategy (long/short) backtested for certain period. Strategy has entries/exits only at the end of the day and may have overnight positions hold. Now I would like to compare returns of my strategy to the market (for instance SPY as benchmark) and find correlation coeff. between my returns and market.

So my question is what's right/standard rule for calculating returns for strategy ? I'm considering using Unrealized+Realized value

Following is simplified matlab code for single stock (there is no transaction cost accounted).

"Backtester"

% positions sizes for every day 
positions = [2 1 -10 15 5 0];

% execution prices (daily closes)
price=[50.0 51.0 49.0 51.0 53.0 52.0];

% actual 'trades' 
tradedQty = diff([0 positions]);

% here cash for positions
cash = cumsum(-tradedQty.*price);

% and here I calculate my mark-to-market potrtfolio value
markToMarketPnL = cash + (positions).*price;

disp(markToMarketPnL)

It gives MTM (actually real+unreal) for every day.

0 2 0 -20 10 5

Now I need to compare it to market return. For finding market returns I use SPY's prices and returns as $ r_m = \frac{SPY(i)}{SPY(i-1)} - 1 $

So the question now - what is 'standard' way to calculting daily returns for my 'strategy' to be compared with $r_m$ in sense of finding correlation coefficient or $\beta$ etc ?

First thought is to use following : $$ r(i) = \frac{MTM(i)}{MTM(i-1)} - 1 $$

But in this case sometimes I may get values near/equal to 0 in denominator and my ret. goes to infinity (see results of example).

Someone uses 'invested money' as denominator, but I'm unsure about this. What should be in this case there in denominator ? long+short exposure for previous day ?

Another idea I got is to use NAV (net asset value) for portfolio to derive returns. For single stock it'd be equal to used stock prices of course, but for many stocks it has sense of price of some 'synthetical' portfolio

$$ NAV(i) = \frac{\sum_{j \in long}{pos(j,i)\cdot mktPrice(j,i)} + \sum_{k \in short}{\lvert pos(k,i)\rvert \cdot mktPrice(k,i)}}{\sum_{j \in long}{pos(j,i)} + \sum_{k \in short}{\lvert pos(k,i)\rvert}} $$

where $pos(i,j)$ - position size of i-th stock at j-th day, $mktPrice(i,j)$ - close/current price of i-th stock at j-th day

Pls advice or point me to good resource for these kind of things.

$\endgroup$
2
  • $\begingroup$ You definitely need to include invested money as part of the computation. This is easy for long positions. For short positions, determine the margin requirement that a broker would've required to allow you to take that short position. $\endgroup$
    – user59
    Oct 29, 2014 at 16:23
  • $\begingroup$ @barrycarter Yes, seems it's only reasonable solution. $\endgroup$
    – mde
    Oct 31, 2014 at 15:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.