Living the dream – let the algorithms do the work
For the last few months I have been excitedly working on a number of automated trading systems, basically algorithms that allow a computer system to take my trades for me.
The idea is that I provide the computer software, provided by my broker, with an intricately woven code and the software automatically places deals for me on the stockmarket. Once it is working, the plan is that I will just be able to sit back and let the computer do the trading whilst I get on with living the dream (fingers crossed)!
The systems that I have been designing take trades in either direction, long or short depending on the criteria that I have fed into the program.
I have been trading successfully for several years now and the automated systems that I have been developing are designed to replicate as closely as possible the manual trades that I have been taking and the trading systems that I share on our Day Trading and Forex Trading courses.
Until today I have only tested my automated system on a demo account with IG, using the ProRealTime demo charting software. Using a combination of their backtesting system and live demo based trades I have gradually refined the system, pruned it, extended it and pruned it again until it began producing some useful results.
Based on the results that I have managed to achieve with the demo system my algorithms have produced trades facilitating a capital growth of 100%+ in three months (one high risk strategy even produced a gain of £250k in three months based on a starting balance of £10k!). Sound too good to be true? I thought so too until the system replicated the results time and again. I couldn’t believe my eyes at first but I checked and double checked the results and they did appear to be correct.
So with high hopes and with the first phase of testing complete the time has come to test the system in the live trading account with REAL money. I shall be starting the system with small position size until I am confident that it does what I want it to do. If and when the system proves to me that it is successful I shall be gradually increasing my position size.
The time has come to live the dream and let the algorithms do the work.
The first day of LIVE trading with the automated trading system
Today was the first day of live trading for my automated trading systems. The system that I have started with runs on the DAX 1 minute timeframe chart and takes lots of trades!
In the chart below you can see the day’s equity curve at the top and the price candlestick chart at the bottom.
The system made a good start, +75 points profit on its first day.
You will note that the chart starts at 10am. The DAX opens at 8am UK time and I had anticipated starting the trading system live from the outset of the trading day, however as I loaded the algorithm into the live trading system I had some conflicting data appearing on my charts which needed some investigation prior to launch.
I am running a demo version of the system alongside the live version so that I can compare performance. As I backtested my system on the live charts for the first time the results over the last three months differed wildly. Both the demo and the live systems were running with the same code, so this was a little concerning.
After some detective work the main differences seemed to come down to slippage on the entries and exits on the live system that were not evident on the demo system. This is annoying in two ways:
1) Slippage is annoying (slippage is when the broker basically fails to execute the trades at the order level, it produces the effect of an additional charge) and in my view unnecessary when the broker is effectively mirroring the market, as they appear to do.
2) Since the demo system is effectively supposed to be a mirror image of the live system, why can’t they apply the same results? Some may say that it is misleading. This is probably down to the software (ProRealTime), the demo system and live system running on different computer servers.
Anyway, despite the additional broker charges the results from the live backtesting were still overwhelmingly positive so at 10am I decided to put the system live.
By 10am the demo system was already well in credit for the day and it actually achieved 200 points profit by 2pm. Since the program is designed to shut down for the day once the system achieves 200 points (it takes the money and banks it) the demo system took the rest of the day off.
In the meantime my live system had achieved only 120 points by 2pm and therefore had not reached the cut off point. The profit on the live system then dwindled down to 75 points as the US trading system produced tricky trading conditions throughout the afternoon.
The good news is that comparing the trades that both systems took there are only differences on a small handful of trades. So I’m just going be vigilant and continue to compare results over the coming days.
Live system results: 75 points profit with a win rate of 58%.
Below are the morning and afternoon charts showing the equity curve at the top and the candlesticks and trades that my system took today.
Overall it was a mixed day. The system lost 10 points all in all but that doesn’t tell the whole story.
With a 75 point winning day yesterday and a 10 point red day today it leaves me green by 65 points over the two days.
We had a good start this morning, the system generated temporary profits of nearly 50 points by 10am. It then went on a losing streak for the next four hours and by 2.30 pm it was down by 120 points.
I have designed the system to have a break between 2.20pm and 3pm as this is often a tricky period for short term trading as the US markets open. Today when the US session started it sparked the DAX to life and the trading turned from choppy to a nicely swinging market.
At 120 points down the system started building a short position after a long uptrend move. We had six open positions at one stage and this trade would define the day. Either it would lose and the system would shut down for the day (I have placed a 150 point daily stop loss on the system) or we would be back in business.
We had a good winner – over 50 points on one trade.
From there the system made back nearly all of the ground that it lost in the morning session, finishing down just 10 points on the day.
Day 2 – System analysis
Overall the live automated system finished about 25 points down on the performance of the demo system running on exactly the same code. The system running on the demo account made a small profit today. This is a bit disappointing as today I can only put the difference down to slippage, a broker charge.
Fortunately I know that this system should be extremely profitable over a period of time as it is based on trades that I have taken manually over a several years.
Even with manual trading we suffer slippage, it is just part of the trading business at the moment. We line the pockets of our brokers. I’m ok with that as long as I am lining my own pockets at the same time!!
The slippage was mainly small but occurred on almost every transaction. It eats away at profits, especially in short term trading like this. My system makes an average of 100 transactions every day, so slippage hurts.
The good news is that we only need a small edge to be very profitable in trading. Even with a win rate of 54%, we can make some serious cash with this system.
I expect this system to average 30 points profit per day. 30 points per day over several months and years means good money. Based on the first two days with the system I am still seriously optimistic.
Day 3 – My automated system hits its stop loss
Day 3 started badly and ended badly for my system. It was a stop loss red day, down 156 points. This brought the three day P&L to -93 points.
Sometimes the market conditions do not suit my system (or any system involving trend following), this was one of those days. The market was choppy, had very few breakouts and had low volatility. We get days like this but thankfully most days provide more opportunities.
The results were so poor today that my system hit the 150 point stop loss by 11.40am and closed down for the day. The only consolation on a day like this was that the stop loss operated as intended on the system.
This system has daily take profits at 200 points currently and a stop loss at 150. Statistically over a period of time this is the correct mix. Bigger winning days than losers and a risk management system that produces excellent results over a longer period.
Looking at the backtesting system that I have running, if the stop loss didn’t exist then the system did perform better in the afternoon and made back some of the losses. However with any trading system we must stick to the rules and the stop loss is in place for a good reason (to make sure that if things go wrong then we can recover without too much capital loss).
I’m generally happy with the way the platform performed in terms of managing my system today. We still got plenty of slippage on trades but no more than on other days.
Every trading system and every trader has winning and losing periods, that is trading! Over a period of three months I’d expect this system to have roughly three green days for every one red day and for the green days to be bigger than the red ones and that is how it will grow my account.
Slight changes needed to the system
Having completed my analysis on the first three days I am going to make a slight change to the system overnight.
The slippage that I am getting is not too serious but it does occur on almost every trade. So it makes sense to alter the system so that it take fewer trades. I have found a way to reduce the number of trades taken by 15% and which only reduces the system profitability by 5%. So this change will improve the gain per trade and slightly de-risk the system. It should produce more consistent results in the long run.
Essentially the system will run with fewer open positions as it scales up on trades. It will take fewer trades at market extremes. I’ll make the change and see how it gets on over the next few days.
Day 4 – A mini recovery – Auto trading with IG and ProRealTime
After a blow out yesterday it was good to see my system making money this morning. In the first chart above you can see in the equity curve at the top of the chart that the system gradually accumulated gains all morning.
At one stage the system was up 155 points. The take profit level for the system is 200 points, so potential the system was only one set of trades away from shutting down for the day in a maximum profit situation.
It didn’t work out that way however as there was a news event at 1.30pm coming out of the US. News events can alter the trading climate in a market in a matter of minutes.
You will note in the two charts above that in the first one prices gradually wind their way upwards. This is a lovely looking chart for trades. Nice swings and an uptrend. The second chart looks completely different. It basically has no rhythm to it. There are lots and lots of zigzags as the market gradually winds its way downwards. These are horrible trading conditions and not ones that are favourable for my automated system.
Despite the horrors of the afternoon we finished the day positive today. Up 44 points. A creditable result.
In terms of how the live system worked, it actually performed better than the system that I have running on the demo. This is due to the slight changes that I made overnight having a positive effect. Good news. Largely the orders were taken and completed at the correct levels (near enough), so I am happy with how things went.
We are now down just 47 points overall. Hopefully we can make that back and some tomorrow.
Day 5 – Red day
Unfortunately we had another stop loss day today. The system was down 153 points by 12pm and since the maximum daily drawdown for the system is 150 points, it shut down for the day.
Essentially the trading climate was the same as yesterday afternoon. Choppy, no breakouts and trading contained within a very small range. This system capitalises on trend moves in the market and momentum. When there is no momentum then the system loses money.
All trading systems suffer from periods of drawdown and this is one of those periods for this system. Fortunately, historically, they haven’t lasted very long, a week at the maximum. Unfortunately this was the week that I set the system live and it co-incided with a drawdown period.
We end the first week of trading with our automated system down 200 points.
Running the backtest system once more we do get confirmation that the system works in the long run and that this week is just a blip. Here are the three month backtesting results for this system:
+3400 points over three months (34% based on starting capital of £10,000 and trading at £1 per point – nominal figures and only illustrative as I will be trading a different size account with different position size – but it gives us a clue as to what the system can do)!!
You can see above that the win rate for the system is 54% per trade, the average gain per trade is 9.89 points and average loss is 9.28. The average gain per trade is just about 1 point per trade. Highly profitable over the long run.
At the bottom of the above picture you can see the maximum drawdown over three months is 318 points and the maximum “runup” is 3886 points. This gives a clearer picture of what we are likely to see as time goes on.
As always we trading, the edge of any system is fairly small and we can expect winning and losing periods.
I remain happy with how the system has worked in terms of functionality over the first week. Obviously I would have loved to have made a winning start but this is the reason why we must start any new system with low position size. Once we start winning I will increase my size per trade.
I am taking a break now for the next week to spend some time with my family. I will shut the system down for this break but in future it will remain uninterrupted – in fact it will be paying for my winter holiday! 🙂
Thanks for reading and I look forward to reporting more progress with this automated trading system shortly.