Stock Algorithms: What Is Algorithmic Trading

One of the most common mistakes of trading is allowing your emotions to dictate your decisions. On the other hand, a clear set of rules allows a trader to stop reactive trading and start proactive trading with structure and exact procedures.

Algorithmic trading can help reduce human error in your day trading strategies. In fact, some programs can also execute trades for you. Algorithmic trading accounts for approximately between 50 to 70 percent of stock trading volume in the United States.

What is Algorithmic Trading?

Algorithmic trading, also known as algo trading, is a type of automated trading. A stock algorithm is a set of rules that executes a specific process. These algorithms filter through potential trades based on a pre-determined set of factors. Then, the system may also enter and exit a trade once a set of criteria is met if you authorize the program to place the trade.

Theoretically, this automated computer program can execute financial strategies and generate higher profits faster than a human trader.

Benefits of Stock Algorithmic Trading

The main advantage of algorithmic trading is that the trading process is automated and follows a strict procedure that minimizes human error if the algorithm is developed accurately and eliminates the danger of trading on emotion. The software or computer program filters through data to present optimal buying or selling conditions. These potential trades ensure that investors do not miss out on opportune trading opportunities.

Stock algorithms can find and execute orders faster than a human can do manually.  Furthermore, algorithmic trading often reduces commissions and fees from transaction costs, resulting in higher profits.

Dangers of Stock Algorithmic Trading

The most significant disadvantage of algorithmic trading is the weight and cost of a single mistake. If a trader uses an algorithm, the system may execute hundreds of transactions in a few minutes. However, if the algorithm is faulty, millions of dollars may be at stake before the stock algorithm is terminated.

The 2010 “Flash Crash” unfolded in 20 minutes where on Wall Street the New York Stock Exchange had witnessed its largest stock plunge in decades. Officials later traced the cause to a U.S. mutual fund that used automated algorithm trading which initiated a large sell order – the largest order of any investor so far that year. This one order sparked a flurry of buying and selling with some orders being executed as low as one penny.

Similarly, analysts suggest that a stock algorithm may have been partly responsible for the “flash crash” of the British pound of 2016. Overnight, the pound fell by 6 percent to $1.1378. Analysts at City Index believe that a Twitter-reading algorithm triggered a sell-off, which set off a wild cycle of selling by other technical algorithms.

Stock algorithms, left unchecked, can cause sudden and substantial transactions that can move markets and impact global economies.

How Does Algorithmic Trading Work?

Algorithmic trading is essentially a set of if/then situations. A series of rules filter out results that meet your criteria for a trade. For example, you may set your stock algorithm to find stocks where the 15-day moving average drops below the 60-day moving average. Your system may then execute a buy order of 150 shares if the preset conditions are fulfilled.

Some traders use Quantopian, an online service to program your rules in Python. Quantopian allows you to back-test your stock algorithm, or license other members’ algorithms, and then connect it to a real broker to send your trades. Alternatively, traders may use different programming languages, such as R, C++, C#, and Java, to write an algorithm. Subsequently, you would then use an Application Programming Interface (API), which enables your software to connect with a broker to send your trades.

Algorithmic Trading Strategies

Traders can customize their stock algorithms to incorporate technical indicators as well as personal preferences. Here are a few common types of stock algorithms and strategies.

Trend-following Stock Algorithm

The most common form stock algorithm incorporates clearly defined technical indicators and market patterns, such as moving averages and price level movements. The goal is to buy assets when prices break resistance levels and sell short assets that fall below pre-determined support levels. As a result, this strategy does not involve making predictions or price forecasts.

Many traders use the 50-day and 200-day moving averages for their trend crossover strategy. These moving averages are often used to anticipate bullish or bearish trends. For example, you may program your stock algorithm to enter a trade when the asset price closes above the moving average and exit the trade when the price closes below the moving average.

Momentum Stock Algorithm

A momentum algorithm seeks for when the market trend moves significantly in one direction with high volume. The trader is riding the trend or momentum. For example, a trader may set his software to monitor the five best performing shares in an index based on a 12-month performance. Alternatively, a trader may identify stocks trading with 10% of their 52 weeks high to detect a price momentum.

Mean Reversion Stock Algorithm

Mean reversion is the belief that what goes up must come down, such as the price of a stock will fall back to its long-time average price after periods of being oversold or overbought. As a result, a trading algorithm may monitor when an asset trades at the lower end of a trading range and then execute a buy order. Subsequently, when the asset approaches the moving average, the system would then execute a sell order.

Seasonality Stock Algorithm

Experienced investors know that the markets generally have better returns during the warm, summer months and at the end of the year. On the other hand, September usually has the lowest returns. A seasonality algorithm capitalizes on the time of the year.

A possible strategy is to buy and hold equities between October and April and then buy and hold bonds between May and September.

Volume-Weighted Average Price (VWAP) Stock Algorithm

The volume-weighted average price is a trading benchmark that gives the average cost of a security as it is traded throughout the day. In general, a rising VWAP indicates an uptrend, and a falling VWAP predicts a downtrend.

A VWAP stock algorithm monitors an asset’s price movement to execute an order when it gets close to the VWAP.

Percentage of Volume (POV) Stock Algorithm

Percentage of Volume is a volume-based algorithm. The system sends partial orders according to a pre-determined participation ratio and the market volume. An example of a POV stock algorithm would be when an order is executed at a defined market volume percentage with an increase or decrease of the participation ratio at a specific stock price.

Time Weighted Average Price (TWAP) Stock Algorithm

The time-weighted average price is a strategy that involves breaking up an order into smaller parts and executing the order across smaller time intervals. The purpose is to protect the market from volatility due to a large order. A trader executes this order as close to the average price in a period of time while reducing market impact.

Sentiment Stock Algorithm

Sentiment analysis is trading based on market sentiment or how the majority of traders in the market feel about a security.  Investors stay up-to-date on the news and purchase stocks attempting to predict the market’s reaction. The purpose of capitalizing on the news is to attempt to capture short term price changes.

For example, an investor may monitor news outlets, Twitter posts, and Google search trends. An example of a sentiment stock algorithm at work was the “flash crash” of the British pound in October 2016 where the Twitter-reading algorithm sparked a series of trades that resulted in the crash of the British pound.

Mathematical Stock Algorithm

Mathematical model algorithmic trading requires tested and proven numbers-based strategies. A popular model is the delta-neutral trading strategy. This technique consists of multiple positions with offsetting positive and negative “deltas” or ratios that compare the change in the price of an asset in relation to the price of its derivative. Your positive and negative deltas should have a total of 0.


Algorithmic trading with artificial intelligence can eliminate human errors and minimize the role of reactive emotions in trading. It is recommended first to read the top day trading books to learn about the stock market, trading, and investing before writing a program for your algorithmic trading strategy.

Once you have identified all the key components and if/then statements for your stock algorithm, you can then turn it into an integrated automated process to back-test the system’s ability, infrastructure, and profitability based on available historical data before it goes live on the real market. If the stock algorithm is sound, you can then allow access to real market data feeds to search for opportunities to place trades and hopefully generate high profits.

For more options trading secrets and day trading strategies, subscribe to Stealth Profits Trader. D.R. Barton, Jr. is a New York Times bestselling author and expert analyst for Fox Business and CNBC that can show you what you need to know about trading.

Leave a Reply

Your email address will not be published. Required fields are marked *