• Workshop
  • Podcasts
  • Books
  • Trading Tips
  • Resources
  • About
KJ Trading Systems
  • Workshop
  • Podcasts
  • Books
  • Trading Tips
  • Resources
  • About

Going Live! Automated Stock & Futures Trading

Picture
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.​

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.  

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?
​

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?

Picture
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.  

Picture
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.
​​
Picture

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.
Picture
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.
Picture
Picture

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.
Picture
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.
Picture
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.
Picture
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!
Picture
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.

Picture
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.
Picture
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...
Picture
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!

​

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 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.

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.

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.

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.


Return To Articles
HTML Comment Box is loading comments...

Picture
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.



Home            Strategy Workshop            Books           Subscribe            Resources           Calculators           Articles           Best Of Blog           About



Data, information, and material (“content”) is provided for informational and educational purposes only. This material neither is, nor should be construed as an offer, solicitation, or recommendation to buy or sell any securities. Any investment decisions made by the user through the use of such content is solely based on the users independent analysis taking into consideration your financial circumstances, investment objectives, and risk tolerance. Neither KJ Trading LLC (KJ Trading) nor any of its content providers shall be liable for any errors or for any actions taken in reliance thereon. By accessing the KJ Trading site, a user agrees not to redistribute the content found therein unless specifically authorized to do so. 

Individual performance depends upon each student’s unique skills, time commitment, and effort. Students sharing their stories have not been compensated for their testimonials. Student stories have not been independently verified by KJ Trading. Results may not be typical and individual results will vary. 

​U.S. Government Required Disclaimer - Commodity Futures Trading Commission. Futures and options trading has large potential rewards, but also large potential risk. You must be aware of the risks and be willing to accept them in order to invest in the futures and options markets. Don't trade with money you can't afford to lose. This website is neither a solicitation nor an offer to Buy/Sell futures or options. No representation is being made that any account will or is likely to achieve profits or losses similar to those discussed on this website. The past performance of any trading system or methodology is not necessarily indicative of future results. 

CFTC RULE 4.41 - HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY, SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN. 

Testimonials appearing on this site are actually received via email submission or web survey comments. They are individual experiences, reflecting real life experiences of those who have used our products and/or services in some way or other. However, they are individual results and results do vary. We do not claim that they are typical results that consumers will generally achieve. The testimonials are not necessarily representative of all of those who will use our products and/or services. 
The testimonials displayed are given verbatim except for correction of grammatical or typing errors. Some have been shortened, meaning; not the whole message received by the testimony writer is displayed, when it seemed lengthy or the testimony in its entirety seemed irrelevant for the general public.

Email: kdavey at kjtradingsystems.com
(c) Copyright - KJ Trading Systems. All Rights Reserved Worldwide.
  • Workshop
  • Podcasts
  • Books
  • Trading Tips
  • Resources
  • About