Trading Mechanical Systems using Leverage

Hi Craig,

How do you go about "testing"? Do you use some additional software or using excel for example?

Thanks....

Yes. I use C# to write my systems. For backtesting, the data for each trade taken is output to an Excel spreadsheet. I find it easier to analyse in Excel as you can apply all manner of tests on the data.

Craig
 
Hi Chorlton,

This is a way of normalizing for leverage.

You'll have a bigger sample than this, but this is OK for illustration.

Trader 1 has no leverage and gets the following monthly returns:

Month1: +10%, Month2: +6%, Month3: +3%, Month4: -1% giving an average return of 4.5% per month

Trader 2 uses 10:1 leverage and hence has an average return of 45% per month.

The question is who has the better performance; on the surface trader2 seems to be 10x better.

Use the following formula to get an annualised, volatility-adjusted performance metric:

(average monthly return) x 12
------------------------------------
stdv x sqrt(12)

Trader 1's performance metric is 54/16 = 3.3
Trader 2's performance metric is 540/160 = 3.3

i.e they have performed equally.

Hope this helps,
Joey
 
Hi Chorlton,

stdv is shorthand for standard deviation, which in turn is the square root of the variance of the sample. Standard deviation is also known as volatility - if you want to convert a monthly vol into an annual vol you multiply by the square root of 12.

Here's a long-winded way of computing the sample variance and then the standard deviation:

(x1 - average)^2 + (x2 - average)^2 + (x3 - average)^3 + (x4 - average)^2
---------------------------------------------------------------------------------------
number of observations - 1

= (10 - 4.5)(10 -4.5) + (6 - 4.5)(6 - 4.5) + (3 - 4.5)(3 - 4.5) + (-1 - 4.5)(-1 - 4.5)
-------------------------------------------------------------------------------------------
3

= 65/3 = 21.67

To get the monthly vol: square root of 21.67 = 4.66
Annual vol = (square root of 12) x 4.66 = 16.1

You may also subtract borrowing costs from the top of the performance metric if you wish.

Once you've got the performance metric, you can then optimize your system with respect to
that, rather than just pure returns, remembering to shift whatever parameter you're changing
to the left and right in case doing so makes your results drop off the edge of a cliff.

Joey
 
Top