Monday, September 5, 2016

Rating based algo

Hello, welcome back to my blog about automated trading. Last time I summarized the experience after 2 months of trading with real money. This week I am going to present the trading strategy based on previously discussed company rating.

For the full source code, please download repository and update to branch 20-algo_implementation-4, changeset c4d0c7ebdae5.

Theory behind

This strategy works on the very simple principle. The total available budget is split into N equal dolar amount and each of this portion is expected to be invested in one stock (later discussed how this is selected). Then the stop loss and take profit limits are set up simply when the price moves by 50% (risk reward is 1:1 in this case). Once any stock is sold then the money will be reinvested in another company as soon as there is budget for it. Theory is that if the company selection is good, then I should be getting more wins than losses and therefore be in the profit over the long period of time.

Regarding the stock selection. I ordered them by this rating. Then buy first N from that list.

Coding and results

Algo implementation implemented as RatingAlgo1 and test application as RatingAlgo1TestApp. Please feel free to run it and expect it will take some time to complete, because the whole process is downloading more than 7000 pages.

Here is the test set up:
  • Start date - September 5, 2015
  • End date - September 5, 2016
  • Initial capital - $30.000
  • Transaction cost - $10
  • Risk per trade - $1.000 (determines size of order for each stock)
And I got the result +20.5% (this means approx. $36000 at the end). This is not that bad for the first blind shoot. I haven't try any analysis, parameter optimization or whatever funky improvement. Also please note that there is survivorship and fundamental bias (I don't have data to get rid of them. If you can tell me how to get rid of these, then please...).

So what I will do next. I will improve my platform to be able run backtests with this strategy more efficiently. I will also set up this alorithm for the forward test. This way I will get more accurate result over the time.

That's it for today. Next time I am going to focus on the previously discussed intraday trading algorithm. I want to improve it and make sure that at least one trade is opened every day.

If you have any question or just want me to look for any topic, please let feel free to contact me at radek.hecl@gmail.com. My promise is to give the honest answer without BS.

Thank you for reading!

No comments:

Post a Comment