Hello, welcome back to my blog about automated trading. Last week I
was talking about technologies. This week I am going to introduce you an trading algorithm.
For the source code example, please download repository and update to branch 9-algo_implementation-1, changeset c9c8928026ad.
Why I did this. Fundamental criteria should at least some confidence that company is not going to bancrupt. Price is important for me, because my budget is limited. I am using only cash account and I want to be able to buy reasonable volume. And finally I want buy stocks which are on low price now, expecting they willl return to the original price later. That's it.
That's it for today. Next week I will talk about prediction API. Thank you for reading!
For the source code example, please download repository and update to branch 9-algo_implementation-1, changeset c9c8928026ad.
Algo code
Looking for the implementation. The main classes to look at are Algo1 and Algo1TestApp. And you can run the Algo1TestApp and see the result of the backtest for the past year. On top of these I have made improved the whole framework. Next let's go throug the algorithm itself.
Algorithm works in the long term and can hold positions for weeks. Basics ideas are following. DoTraining method makes decisions of entry / exit every day and processEvent method simply just executes orders. I decided to buy stocks according these rules:
- Must follow the fundamental criteria (part with finviz filter)
- Price must be low enough (part with price check)
- Must be in discount (part with pattern check)
Why I did this. Fundamental criteria should at least some confidence that company is not going to bancrupt. Price is important for me, because my budget is limited. I am using only cash account and I want to be able to buy reasonable volume. And finally I want buy stocks which are on low price now, expecting they willl return to the original price later. That's it.
Real system example
I want to show you how looks my real system. I can definitely imagine prettier design, but functional wise it works great.
![]() |
| Trading platform screenshot |
This is screenshot from my trading platform. On the left side I wrote code. The only thing I need to do is implement 2 methods I described in the chapter Algo interface. Everything else is handled automatically by system. On the right side there is panel where you can manage the code revisions, backtests and deployme the code for the real trading. This is that simple.

No comments:
Post a Comment