Monday, September 26, 2016

Intraday trading algorithm - 2

Hello, welcome back to my blog about automated trading. This time I am going to see if there is some way how to extend algorithm from this post.

For the source code, please download repository and update to branch 21-algo_implementation-5, changeset b4eb575aecd0. For this time as example depends on intrady quotes which I can't give to you. So you will need to either fill in your own credentials to mbTrading data provider or make your own implementation of the historical data. Otherwise you can just get an inspiration from the code.

Algorithm

The whole idea behind this algorithm is to take the one from the previous post and extend it for multiple symbols. Theory behind is that more trades will be done. And as there are stocks which are cheaper than Microsoft, then bigger volume can be purchared and therefore more profit can be gained.

Implementation is under class DayTradeAlgo2 and test application is DayTradeAlgo2TestApp. Remember to put your credentials in, otherwise it won't run. Just note I have renamed the old implementation to DayTradeAlgo1 with related test application.

Results

I have set up 3 back tests. All of them have same parameters.
  • Start date - March 27, 2016
  • End date - September 26, 2016
  • Initial capital - $30.000
  • Transaction cost - $10
First is with previous intrady algorthm (1), second with current algorithm (2) and third with long term algorithm (3). Now following the charts with results.

(1) old day trade algo - final result $30.238

(2) new day trade algo - final result $32.363

(3) long term algo - final result $35.678

To make conclusion. I personally prefer to stay away from day trading. And results from the backtests giving me stronger confidence. I can see that new version of day trading algorithm might peform better. When I was playing with this a little more, then the discovery was that wrong stock selection will lead to the big loses as well. Even when day trading. So be carefull. The best seems to choose stocks which follows some regular patterns. This opens a question. How to decide whether stock is following regular patterns or not? Will return to this question sometime later.

That's it for today. Next time I am going to revisit the risk model for long term algorithm. Thank you for reading!

No comments:

Post a Comment