Hello, welcome back to my blog about automated trading. Last week I made research about he Microsoft stock, made visualizations of technical indicators and discovered that for daily trading (means no overnight holds) the day based technical indicators don't help. Then I discovered that for the growing days (close > open) the day low will happen most likely during morning. With this information I am going to build the intraday algorithm.
For the source code example, please download repository and update to branch 15-algo_implementation-3, changeset 36d12fbc5e16.
Setup:
For the source code example, please download repository and update to branch 15-algo_implementation-3, changeset 36d12fbc5e16.
Algo code
There is prepared class Algo3 and test applciation Algo3TestApp in the repository. This algorithm needs the intraday quotes which I am not allowed to publish. Therefore to run the app you will need to set up the your own historical provider or provide your own credentials for MbTrading account.
Algorithm works in the following way. In the training algo takes all daily historical data for the past year. From quote list only the days for which close > open (growing days) are considered. For every growing day algo uses open - low and high - open to calculate averages and standard deviations. This is the preparation for trading session.
Now during the trading session algo searches for the pattern which shows minimum within the morning and is within the expected range (average of open - low +- multiplier of standard deviation calculated in the training) for the growing day. Note that algo searches for some bounce from the minimum. If there is, then position is opened. Stop loss is set up to the identified minimum. Target price is set up as open plus average of high - open calculated during training. And finally every position has a time stop before end of the day as well. The time is chosen to be in as the avagere time for highs.
Results
With this algo I made 2 tests and then for comparism one test of algo from this post. Follows the set up for all tests and then separate inputs and results for each test.- Transaction cost is 10$ (means 20$ if you one time buy and sell within the day)
- Start date - 2015/11/30
- End date - 2016/05/30
Setup:
- Initical capital - 30.000$
- Risk - 200$ (this is max risk per trade)
- Max quantity - 400 (buy 400 stocks at max)
- End capital: 30.527$
- Percent change: 1.75
2) Increased capital and size to make comission less relevant
Setup:
Setup:
And what about you? Can you think about any profitable trading strategy?
That's it for today. Next week I will discuss the contract between me, broker and another financial service providers. Thank you for reading!
Setup:
- Initical capital - 50.000$
- Risk - 400$
- Max quantity - 800
- End capital: 52.276$
- Percent change: 4.55
Setup:
- Initial capital - 30.000$
- Other parameters are different, because it is fundamentally different algorithm I just let them as they are
- End capital: 39.033$
- Percent change: 30.11
Conclusion
Definitely both strategies have potential to improve. I already have possible ideas and will try them somewhen later. For the moment the long term strategy seems to be the better choice although there is the overnight risk and it is not that sexy. The return for long term strategy is multiple times higher. In addition it is scalable to the size which I can (as a retail guy) afford to pay in cash and 100% loose without going broke (for sure I will be pissed of). This gives me easy sleep and therefore I will go with it.
And what about you? Can you think about any profitable trading strategy?
That's it for today. Next week I will discuss the contract between me, broker and another financial service providers. Thank you for reading!



