Tuesday, October 16, 2018

More Progress on Programming the Trading Model

Now this is a nice equity curve! This was produced by the computer making daily decisions for each day this year so far, using the full version of my model but without stops. The idea is it tracks what happens to $1000 compounded (without commissions or any slippage etc. - former is not important latter might be). The blue line is the NASDAQ 100 index also rebased to 1000 as the beginning of January. The computer is also printing out a list of instructions one for each day like this:

5082    7637.43018       1.00000       0.00000  D buy. Stay long
5083    7490.00000       0.00000       0.00000  K sell. Go short
5084    7399.00977       0.00000       0.00000  K sell. Stay short
5085    7352.81982       0.00000       0.00000  K sell. Stay short
5086    7371.62012       0.00000       0.00000  K sell. Stay short
5087    7044.50000       0.00000       0.00000  D sell. Stay short
5088    6964.02978       0.00000       1.00000 R buy not confirmed by pdD D sell. Stay short
5089    7157.20996       1.00000       1.00000 R Buy outside BB confirmed by pdD
5090    7068.67041       1.00000       1.00000 R Buy outside BB confirmed by pdD
5091      NA       1.00000       1.00000 R Buy outside BB confirmed by pdD

These are the most recent decisions, including today's decision to stay long. The "NA" indicates that we don't yet know the index value for today...

It also produces some performance statistics:

Alpha       1.76456 Beta      -0.21425  ror       1.68344 Sharpe       5.47108

That means 176% p.a. of alpha... This is based on compounding the daily alpha over the year. Beta to the market is slightly negative and so compound rate of return for the year is a little less than alpha. I don't expect that high rates of return in other years. Conditions are ideal this year and probably the model is a bit overfitted. One of the reasons for doing this programming is to make it easier to test the model on larger samples.

Next I will add some refinements like using futures prices instead of index prices for performance results. Oh yes, and adding stops!

P.S.
When I ran the algorithm on the S&P 500, I found at least one bug which also needs ironing out.


No comments: