Going Live! Automated Stock & Futures Trading
UPDATED - JANUARY 2023
What Is Automated Trading?
Everyone knows what trading stocks, futures or forex is. You buy an instrument (say a stock) at one price, and hope to later sell it later at a higher price. Or, you sell it first (called "selling short") and hope to buy it back later at a lower price.
Either way, you want to buy low and sell high.
The neat part about this is that you do not have to stare at a screen all day, manually buying and selling. That is what most people do, but you do not have to. With a good internet connection, and a few other pieces described below, you can enter the world of automated trading or computerized trading.
Either way, you want to buy low and sell high.
The neat part about this is that you do not have to stare at a screen all day, manually buying and selling. That is what most people do, but you do not have to. With a good internet connection, and a few other pieces described below, you can enter the world of automated trading or computerized trading.
Computerized Trading
Computerized trading, on the surface, is pretty simple. You let the computer make the trading decisions for you, and then execute the trades. Sounds easy, right? Well, the are some important steps you have to take first. These steps will be a bit different, depending on what you want to trade. As a start, let's look at trading stocks automatically, and trading futures on auto pilot.
Automatic Stock Trading
The first step to trading stocks is to have rules to buy and sell. That is the hard part, for sure.
Part of this step is having the correct data to analyze. This can be tricky with stocks, especially with splits, dividends, etc. You need to make sure the data you test with is consistent with how you are testing.
Part of this step is having the correct data to analyze. This can be tricky with stocks, especially with splits, dividends, etc. You need to make sure the data you test with is consistent with how you are testing.
Automatic Futures Trading
Just like with stocks, futures trading first starts with buy and sell rules. And just like stocks, futures data has some important nuances, especially since futures contracts have a limited lifespan. For instance, do you know what continuous contracts are for futures, and how to properly test with them?
Before you do any kind of automatic futures trading, you should understand how to properly test with futures contracts. And, you should understand the basics of algo trading (I've created a great guide right here).
For this article, I'll assume you know what and how to test. Let's say you've done all the upfront work (like creating entries, putting in exits such as profit targets and stop losses, etc.), and you are ready to go live with a futures trading strategy. And you want to automate it. What do you do next?
Before you do any kind of automatic futures trading, you should understand how to properly test with futures contracts. And, you should understand the basics of algo trading (I've created a great guide right here).
For this article, I'll assume you know what and how to test. Let's say you've done all the upfront work (like creating entries, putting in exits such as profit targets and stop losses, etc.), and you are ready to go live with a futures trading strategy. And you want to automate it. What do you do next?
Automated Trading System
Going live with an automated trading 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?
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. Why Tradestation? Simply put, it is the best platform out there - in my opinion and the opinion of my many readers.
In Tradestation, the steps to automate a trading system are pretty simple.
In Tradestation, the steps to automate a trading system are pretty simple.
There are basically 6 things to check to take a strategy and automate it! Not too hard!!!
And then, once you automate, there are really only a couple of quick checks to see if your strategy is running correctly.
And then, once you automate, there are really only a couple of quick checks to see if your strategy is running correctly.
Automated Trading System
As I mentioned with futures, it is CRITICAL that you test and trade with the right data. Because of the limited lifespan of futures contracts (they always seem to be expiring, especially in the energy markets, where they expire monthly. So, it is important to first know some basics of continuous futures contracts.
Tradestation Continuous Futures Contracts
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 “@CLV19” for October, 2019 and “@CLX19” for November, 2019. Each is identical to @CL when it is the front contract.
So, for actual trading use the symbols such as @CLX19, depending on the current contract month.
Are You Trading The Right Contract?
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 (@CLZ19) 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 December “Z” is the current month, the indicator will not plot anything. But, when the contract rolls to January “F”, 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.
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 “@CLV19” for October, 2019 and “@CLX19” for November, 2019. Each is identical to @CL when it is the front contract.
So, for actual trading use the symbols such as @CLX19, depending on the current contract month.
Are You Trading The Right Contract?
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 (@CLZ19) 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 December “Z” is the current month, the indicator will not plot anything. But, when the contract rolls to January “F”, 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.
The Match Game
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.
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!
Rollover Time!
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. This example is from a few years ago, but it is still valid today.
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 and 10.x platforms do 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.
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!
One warning: I did not discuss the issue earlier, but be careful if you use Market On Close MOC orders. Your automation will likely get really messed up! And this approach might have to be modified if you use techniques like equity curve trading.
Conclusion
Of course, there is a lot more to automated trading than just syncing 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'd like to download the indicators in Tradestation format, just click on the link below, unzip the ELD file and then double click it to install into Tradestation.
Conclusion
Of course, there is a lot more to automated trading than just syncing 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'd like to download the indicators in Tradestation format, just click on the link below, unzip the ELD file and then double click it to install into Tradestation.
Bonus Indicator
Here is one more tool that you will find REALLY useful. It is a simple indicator that shows you at a glance what your position should be: +1 for long, 0 for flat and -1 for short. It even accounts for the number of contracts!
The result you see is always the STRATEGY position, not the real world account value. But, in any event it is nice to see at a glance what a particular strategy is doing.
Here is one more tool that you will find REALLY useful. It is a simple indicator that shows you at a glance what your position should be: +1 for long, 0 for flat and -1 for short. It even accounts for the number of contracts!
The result you see is always the STRATEGY position, not the real world account value. But, in any event it is nice to see at a glance what a particular strategy is doing.
It is occasionally quirky, and sometimes disappears, but turning the indicator off and on again will make it reappear. Pretty neat!
You can download it below...
You can download it below...
Free Algo Strategy!
Do you want to see what a real life trading algo looks like? Hop over to my homepage and sign up to receive a free algo for the mini &P. In the past 5 years of hypothetical performance, it has returned over $50K in profits per contract!
Do you want to see what a real life trading algo looks like? Hop over to my homepage and sign up to receive a free algo for the mini &P. In the past 5 years of hypothetical performance, it has returned over $50K in profits per contract!
More About Automated Futures Trading Systems For Maximum Profits
Automated futures trading systems are a great way to maximize profits for experienced and beginner traders alike. With the right processes in place, an automated trading system can help you make faster, smarter trades with less effort and risk.
Learn more about the benefits of automated futures trading systems and how you can become a better trader today!
Learn more about the benefits of automated futures trading systems and how you can become a better trader today!
Learn About Automated Trading Systems
Automated trading systems allow experienced and beginner traders alike to make smarter, faster trading decisions with less effort and risk. Automated trading systems rely on simpleor complex algorithms that analyze large amounts of various data from the market to predict the best strategy for each trade.
Utilizing these systems can help traders gain a better understanding of the markets and maximize their profits.
Utilizing these systems can help traders gain a better understanding of the markets and maximize their profits.
Calculate Risk vs Reward & Create a Trading Plan
Setting realistic expectations and creating a trading plan are essential with automated futures trading systems. You'll need to define how much you’re willing to risk each time, consider factors such as stop losses and other consider factors, examine the costs to trade, create rules for gaining and closing positions, and review your strategy regularly.
With a good plan in place you can make the most of each automated system that you use.
With a good plan in place you can make the most of each automated system that you use.
Select the Right Platform and Software
Before committing to a particular platform or a software, it is important to understand its capabilities and limitations. Ensure that you have chosen the right platform and software for your trading system. Consider factors such as functionality, trading fees, customer support, and access to market data when making your selection. Don’t forget to read the terms of service carefully before you commit so that you know what type of help is provided in each case.
Backtest Your Trading System to Ensure Profitability
This is CRITICAL!
Backtesting your trading system is essential before you begin trading. It allows you to test out strategies with historical data to see if they would have been profitable in the past and make adjustments accordingly. This helps you better understand how market conditions could affect the performance of your trading system and gives you an objective view on whether it is likely to generate profits in the future under similar conditions.
Backtesting your trading system is essential before you begin trading. It allows you to test out strategies with historical data to see if they would have been profitable in the past and make adjustments accordingly. This helps you better understand how market conditions could affect the performance of your trading system and gives you an objective view on whether it is likely to generate profits in the future under similar conditions.
Monitor and Manage Your Positions on an Ongoing Basis
Automated trading systems help take the emotion out of trading. However, it’s important to remember that they are only part of a successful trading strategy. It’s still important to monitor and manage your positions on an ongoing basis. This includes setting up alerts for when positions move too quickly or if there is unexpected news in the markets that could affect your strategies.
This can help you adjust or close positions quickly if needed and maximize profits.
This can help you adjust or close positions quickly if needed and maximize profits.
HTML Comment Box is loading comments...

About The Author: Kevin Davey is an award winning private futures, forex and commodities trader. He has been trading for over 25 years. Three consecutive years, Kevin achieved over 100% annual returns in a real time, real money, year long trading contest, finishing in first or second place each of those years.
Kevin is the author of 5 best selling trading books. Kevin provides a wealth of trading information at his website: https://www.kjtradingsystems.com
Copyright, Kevin Davey and KJ Trading Systems. All Rights Reserved. Reprint of above article is permitted, as long as the About The Author information is included.
Kevin is the author of 5 best selling trading books. Kevin provides a wealth of trading information at his website: https://www.kjtradingsystems.com
Copyright, Kevin Davey and KJ Trading Systems. All Rights Reserved. Reprint of above article is permitted, as long as the About The Author information is included.