Going live with an automated strategy is one of the coolest, but also scariest things you can do in trading. Here you are letting a computer trade with your hard earned money. Theoretically, the computer makes ALL the buying and selling decisions except for rollover trades. Many people simply can’t do it – the stress and pressure of trading decisions being made outside of their control is just too much to bear.
The flipside though, is that automated trading can be extremely liberating. Turning control over to a computer – as long as you trust its decisions – frees you up to do other tasks (like developing more and more strategies!). Adding automated strategies to a portfolio can be fun and exciting, as well as hopefully ultimately profitable.
Of course, it is assumed that you have a properly tested and vetted strategy ready to go, and an example of which is shown in Figure 1. But once you are ready to go, then what? What pitfalls should you look out for? What kind of “tricks of the trade” are available?
In this article, I’ll discuss some of the basics, and provide a few handy tools for you to use in your automation. This article is far from complete coverage of automation (the perils of unattended trading, and the use of virtual private servers are aspects of automated trading deserving of their own articles, for example). I’ll use the TradeStation platform for all examples and coding, but the concepts apply to all trading software platforms.
When you tested your strategy, you likely used a continuous contract of some sort for your market data. In TradeStation, the back adjusted continuous contract (my favorite type) is denoted with a prefix “@”. So, for example the Crude Oil continuous contract is @CL.
Unfortunately, you cannot trade the live symbol, “@CL” since TradeStation needs to know which contract month you would want to trade. Thankfully, they provide continuous monthly contracts, such as “@CLV14” for October, 2014 and “@CLX14” for November, 2014. Each is identical to @CL when it is the front contract.
So, for actual trading use the symbols such as @CLX14, depending on the current contract month.
Since you tested your strategy with the @CL symbol, which always trades the lead contract, you want to make sure your live trading matches up with it. If the current month is November, you don’t want to trade the December contract, since then you are introducing the Nov-Dec spread dynamics into your trading, which is not what you tested. Always trade only what you tested!
So, how do you monitor that you are trading the correct contract? It obviously can get hairy when multiple strategies, multiple instruments, and multiple charts are involved. To assist me with this, I created a simple paint bar indicator which you can find at the end of the article.
All you have to do is have the contract you want to trade (@CLV14) as data1, and the perpetual continuous contract (@CL) as data2 in your chart. Remember the order is important, since you can only trade data1. The indicator monitors for any difference between these two data streams. As long as October “V” is the current month, the indicator will not plot anything. But, when the contract rolls to November “X”, the paint bar will paint a green bar in the data1 portion of the chart, as shown in Figure 2. That is your signal to roll the position.
Another critical part to successful automated trading is making sure that the strategy position and the real life position match. TradeStation provides a decent way to monitor this, as shown in Figure 3. But, in staring at the charts all day, I found it easy to forget to check the Trade Manager window. So, I created another paint bar indicator, included at the end of the article. It monitors the strategy position and the real world position, and draws a big red bar when there is a mismatch. An example of this is shown in Figure 4.
Unfortunately, this “position mismatch” indicator is a little too good, and gives false alarms quite often. I actually like that aspect, as it keeps me constantly checking positions, but it is left to the reader to improve upon the accuracy of the indicator. The good thing about the version given at the end of the article is that it does not seem to miss position mismatches – better to have a few false alarms than a major miss!
These indicators are especially useful when you have to rollover. They will tell you when to roll, and will ensure you do it correctly. I’ll show that below with an example.
On September 17th, the CL strategy was long 1 contract of October Crude Oil, @CLV14. At the close of September 17, TradeStation rolled the October contract to November. I was alerted to that fact by the green bar, shown in Figure 5. Remember, the green bar shows a mismatch in continuous contracts. So, that was my cue to roll.
Normally, I would use the exchange supplied spread to roll a position, in this case I would sell the October-November spread. That would make me flat in October, and long in November. The exchange supplied spreads are the safest and usually cheapest way to roll. Unfortunately, the TradeStation 9.x platform does not support this, so you have to “leg” in and out of the position in order to roll.
So, my first step is to exit my October long. After I do that, my chart was as shown in Figure 6. The big red bar told me there was a mismatch in position.
The next step is to change the data1 stream to @CLX14. This will eliminate the green bar (which was hidden behind the red bar), but the red bar persists, as shown in Figure 7.
That is telling me I need to do something in November, namely buy. I did that in Figure 7, and I was filled in Figure 8. But you will notice the red bar persists. Now, I simply turn the indicator off and then back on, and end up with Figure 9. No red bar, no green bar. Everything is good!
Of course, there is a lot more to automated trading than just synching up continuous contracts and monitoring live vs. strategy positions. But, these are two critical aspects that many people never fully get a handle on. Properly managing positions and contract rollovers can be critical to your success. As you trade 5, 10, or 50 or more strategies, you’ll be thankful you have these tools to help you monitor your rollovers and your positions.
If you would like to learn more about building trading systems be sure to get a copy of my latest book, Building Winning Algorithmic Trading Systems.
— Kevin J. Davey of KJ Trading Systems
Kevin Davey is a professional trader and a top performing systems developer. Kevin is the author of “Building Algorithmic Trading Systems: A Trader's Journey From Data Mining to Monte Carlo Simulation to Live Trading” (Wiley Trading, 2014.) . He generated triple digit annual returns 148 percent, 107 percent, and 112 percent in three consecutive World Cup of Futures Trading Championships® using algorithmic trading systems. His web site, www.kjtradingsystems.com, provides trading mentoring, trading signals, and free trading videos and articles. He writes extensively in industry publications such as Futures Magazine and Active Trader and was featured as a “Market Master” in the book The Universal Principles of Successful Trading by Brent Penfold (Wiley, 2010). Active in social media, Kevin has over 15,000 Twitter followers. An aerospace engineer and MBA by background, he has been an independent trader for over 20 years. Kevin continues to trade full time and develop algorithmic trading strategies.
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.