(Redirected from Backtesting Software)

An automated trading system (ATS), also referred to as algorithmic trading, is a computer program that creates orders and automatically submits them to a market center or exchange. Advances in computer and communications technology have led to electronic trading exchange system networks. Electronic trading exchange system networks use communications networks and computers to replicate traditional face-to-face exchange functions. The program will automatically generate orders based on predefined set of rules using a trading strategy which is often based on technical analysis but can also be based on input from other electronic sources.

Automated trading systems are often used with electronic trading in automated market centers, including electronic communication networks, "dark pools", and automated exchanges.[1] Automated trading systems and electronic trading platforms can execute repetitive tasks at speeds with orders of magnitude greater than any human equivalent. Traditional risk controls and safeguards that relied on human judgment are not appropriate for automated trading and this has caused issues such as the 2010 Flash Crash. New controls such as trading curbs or 'circuit breakers' have been put in place in some electronic markets to deal with automated trading systems.[2]

## Mechanism

The automated trading system determines whether an order should be submitted based on, for example, the current market price of an option and theoretical buy and sell prices. The theoretical buy and sell prices are derived from, among other things, the current market price of the security underlying the option. A look-up table stores a range of theoretical buy and sell prices for a given range of current market price of the underlying security. Accordingly, as the price of the underlying security changes, a new theoretical price may be indexed in the look-up table, thereby avoiding calculations that would otherwise slow automated trading decisions. [3] A distributed processing on-line automated trading system uses structured messages to represent each stage in the negotiation between a market maker (quoter) and a potential buyer or seller (requestor). [4]

• Minimizes Emotions

• Ability to Backtest

Backtesting applies trading rules to historical market data to determine the viability of the idea. When designing a system for automated trading, all rules need to be absolute, with no room for interpretation (the computer cannot make guesses). Traders can take these precise sets of rules and test them on historical data before risking money in live trading. Careful backtesting allows traders to evaluate and fine-tune a trading idea, and to determine the system's expectancy – i.e., the average amount that a trader can expect to win per unit of risk. [5]

• Preserves Discipline

Because the trade rules are established and trade execution is performed automatically, discipline is preserved even in volatile markets. Discipline is often lost due to emotional factors such as fear of taking a loss, or the desire to eke out a little more profit from a trade. Automated trading helps ensure that discipline is maintained because the trading plan will be followed exactly. In addition, "Pilot error" is minimized; for instance, an order to buy 100 shares will not be incorrectly entered as an order to sell 1,000 shares. [5]

• Achieves Consistency

• Improved Order Entry Speed

Since computers respond immediately to changing market conditions, automated systems are able to generate orders as soon as trade criteria are met. Getting in or out of a trade a few seconds earlier can make a big difference in the trade's outcome. As soon as a position is entered, all other orders are automatically generated, including protective stop losses and profit targets. Markets can move quickly, and it is demoralizing to have a trade reach the profit target or blow past a stop-loss level – before the orders can even be entered. An automated trading system prevents this from happening. [5]

Automated trading systems permit the user to trade multiple accounts or various strategies at one time. This has the potential to spread risk over various instruments while creating a hedge against losing positions. What would be incredibly challenging for a human to accomplish is efficiently executed by a computer in milliseconds. The computer is able to scan for trading opportunities across a range of markets, generate orders and monitor trades. [5]

Such a system is subject to uncertainties caused by the fact that a variable time is required for an order (buy or sell) message to be transmitted from the requestor to the quoter, or for a cancel (quote interrupt) message to be transmitted from the quoter to the requestor. Furthermore, it is possible that an equipment failure in the network, either in a communication link or even at the workstation of one of the traders, will prevent a small fraction of such order messages and cancel messages from reaching their intended destination within the relatively short time-frame typically associated with an on-line transaction system. [6]

• Mechanical Failures

• Monitoring

Although it would be great to turn on the computer and leave for the day, automated trading systems do require monitoring. This is due do the potential for mechanical failures, such as connectivity issues, power losses or computer crashes, and to system quirks. It is possible for an automated trading system to experience anomalies that could result in errant orders, missing orders, or duplicate orders. If the system is monitored, these events can be identified and resolved quickly. [5]

• Over-optimization

Traders who employ backtesting techniques can create systems that look great on paper and perform terribly in a live market. Over-optimization refers to excessive curve-fitting that produces a trading plan that is unreliable in live trading. It is possible, for example, to tweak a strategy to achieve exceptional results on the historical data on which it was tested. Traders sometimes incorrectly assume that a trading plan should have close to 100% profitable trades or should never experience a drawdown to be a viable plan. As such, parameters can be adjusted to create a "near perfect" plan that completely fails as soon as it is applied to a live market. [5]

## Strategies

The most common algorithmic trading strategies follow trends in moving averages, channel breakouts, price level movements and related technical indicators. These are the easiest and simplest strategies to implement through algorithmic trading because these strategies do not involve making any predictions or price forecasts. Trades are initiated based on the occurrence of desirable trends, which are easy and straightforward to implement through algorithms without getting into the complexity of predictive analysis. [7]

For example, the following formula could be used for trend following strategy:
Consider a complete probability space (Ω, F, P). Let ${\displaystyle S_{r}}$ denote the stock price at time ${\displaystyle r}$ satisfying the equation
${\displaystyle dS_{r}=S_{r}[\mu (\alpha _{r})dr+\sigma dBr],}$ ${\displaystyle S_{t}=X,}$ ${\displaystyle t\leq r\leq T<\infty }$,
where ${\displaystyle \alpha _{r}\in \{1,2\}}$ is a two-state Markov-Chain, ${\displaystyle \mu (i)\equiv \mu _{i}}$ is the expected return rate in regime ${\displaystyle i=1,2,\sigma >0}$ is the constant volatility, ${\displaystyle B_{r}}$ is a standard Brownian motion, and ${\displaystyle t}$ and ${\displaystyle T}$ are the initial and terminal times, respectively. [8]

Volume weighted average price strategy breaks up a large order and releases dynamically determined smaller chunks of the order to the market using stock-specific historical volume profiles. The aim is to execute the order close to the Volume Weighted Average Price (VWAP).[7] It is common to evaluate the performance of traders by their ability to execute orders at prices better than the volume weighted average price (VWAP) over the trading horizon. [9]

VWAP is calculated using the following formula:
${\displaystyle P_{\mathrm {VWAP} }={\frac {\sum _{j}{P_{j}\cdot Q_{j}}}{\sum _{j}{Q_{j}}}}\,}$

where:

${\displaystyle P_{\mathrm {VWAP} }}$ is Volume Weighted Average Price;
${\displaystyle P_{j}}$ is price of trade ${\displaystyle j}$;
${\displaystyle Q_{j}}$ is quantity of trade ${\displaystyle j}$;
${\displaystyle j}$ is each individual trade that takes place over the defined period of time, excluding cross trades and basket cross trades. [10]

• Mean Reversion Strategy

Mean reversion strategy is based on the idea that the high and low prices of an asset are a temporary phenomenon that revert to their mean value (average value) periodically. Identifying and defining a price range and implementing an algorithm based on that allows trades to be placed automatically when the price of asset breaks in and out of its defined range.[7]

For example, a continuous mean-reverting time series can be represented by an Ornstein-Uhlenbeck process stochastic differential equation:
${\displaystyle dx_{t}=\theta (\mu -x_{t})dt+\sigma dW_{t}}$
where ${\displaystyle \theta }$ is the rate of reversion to the mean, ${\displaystyle \mu }$ is the mean value of the process, ${\displaystyle \sigma }$ is the variance of the process and ${\displaystyle W_{t}}$ is a Wiener process or Brownian motion. [11]

## Applications

Early form of Automated Trading System has been used by financial managers and brokers, software based on algorithm. These kind of software were used to automatically manage clients' portfolios. But first service to free market without any supervision from financial advisers and managers to serve clients directly was given in 2008 with the launch of Betterment by Jon Stein. Since then this system is getting improved with development in IT industry, now Automated Trading System is managing huge assets all around the globe.[12] As of 2014, more than 75 percent of the stock shares traded on United States exchanges (including the New York Stock Exchange and NASDAQ) originate from automated trading system orders.[13][14] ATSs can be based on a predefined set of rules which determine when to enter an order, when to exit a position and how much money to invest in each trading product. Trading strategies differ; some are designed to pick market tops and bottoms, others to follow a trend, and others involve complex strategies including randomizing orders to make them less visible in the marketplace. ATSs allow a trader to execute orders much quicker and manage their portfolio easily by automatically generating protective precautions.[15]

Backtesting of a trading system involves programmers running the program using historical market data in order to determine whether the underlying algorithm guiding the system may produce the expected results. Developers can create backtesting software to enable a trading system designer to develop and test their trading systems using historical market data to optimize the results obtained with the historical data. Although backtesting of automated trading systems cannot accurately determine future results, an automated trading system can be backtested using historical prices to see how the system theoretically would have performed if it had been active in a past market environment.[16][17]

Forward testing of an algorithm can also be achieved using simulated trading with real-time market data to help confirm the effectiveness of the trading strategy in the current market and may be used to reveal issues inherent in the computer code.

Live testing is the final stage of the development cycle. In this stage, live performance is compared against the backtested and walk forward results. Metrics compared include Percent Profitable, Profit Factor, Maximum Drawdown and Average Gain per Trade. The goal of an automated trading system is to meet or exceed the backtested performance with a high efficiency rating. [18]

Improved order entry speed allows a trader to enter or exit a position as soon as the trade criteria are satisfied. Furthermore, stop losses and profit targets can be automatically generated using an automated trading system.

## Market disruption and manipulation

Automated trading, or high-frequency trading, causes regulatory concerns as a contributor to market fragility.[19]

United States regulators have published releases[20][21] discussing several types of risk controls that could be used to limit the extent of such disruptions, including financial and regulatory controls to prevent the entry of erroneous orders as a result of computer malfunction or human error, the breaching of various regulatory requirements, and exceeding a credit or capital limit.

The use of high-frequency trading (HFT) strategies has grown substantially over the past several years and drives a significant portion of activity on U.S. markets. Although many HFT strategies are legitimate, some are not and may be used for manipulative trading. Given the scale of the potential impact that these practices may have, the surveillance of abusive algorithms remains a high priority for regulators. The Financial Industry Regulatory Authority (FINRA) has reminded firms using HFT strategies and other trading algorithms of their obligation to be vigilant when testing these strategies pre- and post-launch to ensure that the strategies do not result in abusive trading.

FINRA continues to be concerned about the use of so-called "momentum ignition strategies" where a market participant attempts to induce others to trade at artificially high or low prices. Examples of this activity include layering and spoofing strategies where a market participant places a nonbona fide order on one side of the market (typically, but not always, above the offer or below the bid) in an attempt to bait other market participants to react to the non-bona fide order and trade with another order on the other side of the market.

Other examples of problematic HFT or algorithmic activity include order entry strategies related to placing orders near the open or close of regular trading hours that involve distorting disseminated market imbalance indicators through the entry of non-bona fide orders and/or aggressive trading activity near the open or close.

FINRA also continues to focus concern on the entry of problematic HFT and algorithmic activity through sponsored participants who initiate their activity from outside of the United States. In this regard, FINRA reminds firms of their surveillance and control obligations under the SEC's Market Access Rule and Notice to Members 04-66,[22] as well as potential issues related to treating such accounts as customer accounts, anti-money laundering and margin levels, as highlighted in Regulatory Notice 10-18 [23] and the SEC's Office of Compliance Inspections and Examination's National Exam Risk Alert dated September 29, 2011.[24]

FINRA conducts surveillance to identify cross-market, cross-product manipulation of the price of underlying equity securities, typically through abusive trading algorithms, and strategies used to close out pre-existing option positions at favorable prices or establish new option positions at advantageous prices.

### Notable examples

Examples of recent substantial market disruptions include the following:

• On May 6, 2010, the Dow Jones Industrial Average declined about 1,000 points (about 9 percent) and recovered those losses within minutes. It was the second-largest point swing (1,010.14 points) and the largest one-day point decline (998.5 points) on an intraday basis in the Average's history. This market disruption became known as the Flash Crash and resulted in U.S. regulators issuing new regulations to control market access achieved through automated trading.[25]
• On August 1, 2012, between 9:30 a.m. and 10:00 a.m. EDT, Knight Capital Group lost four times its 2011 net income.[26] Knight's CEO Thomas Joyce stated, on the day after the market disruption, that the firm had "all hands on deck" to fix a bug in one of Knight's trading algorithms that submitted erroneous orders to exchanges for nearly 150 different stocks. Trading volumes soared in so many issues, that the SPDR S&P 500 ETF (SYMBOL: SPY), which is generally the most heavily traded U.S. security, became the 52nd-most traded stock on that day, according to Eric Hunsader, CEO of market data service Nanex. Knight shares closed down 62 percent as a result of the trading error and Knight Capital nearly collapsed. Knight ultimately reached an agreement to merge with Getco, a Chicago-based high-speed trading firm.[27][28]

## References

1. ^ Lemke, Thomas; Lins, Gerald. "2:25-2:29". Soft Dollars and Other Trading Activities (2013-2014 ed.). Thomson West. ISBN 978-0-314-63065-0.
2. ^ "Concept Release on Risk Controls and System Safeguards for Automated Trading Environments" (PDF). Commodity Futures Trading Commission. September 9, 2013. Retrieved December 22, 2014.
3. ^ Marynowski, John M., et al. "Automated trading system in an electronic trading exchange." U.S. Patent No. 7,251,629. 31 Jul. 2007.
4. ^ Hartheimer, Richard, et al. "Financial exchange system having automated recovery/rollback of unacknowledged orders." U.S. Patent No. 5,305,200. 19 Apr. 1994.
5. Folger, Jean. "Automated Trading Systems: The Pros and Cons". Retrieved 11/04/2018. Check date values in: |accessdate= (help)
6. ^ Hartheimer, Richard, et al. "Financial exchange system having automated recovery/rollback of unacknowledged orders." U.S. Patent No. 5,305,200. 19 Apr. 1994.
7. ^ a b c Seth, Shobhit. "Basics of algorithmic trading: Concepts and examples". Retrieved 11/04/2018. Check date values in: |accessdate= (help)
8. ^ Dai, Min; Yang, Zhou; Zhang, Qing; Zhu, Qiji. "Optimal Trend Following Trading Rules∗".
9. ^ Madhavan, Ananth. "VWAP Strategies".
10. ^ Volume-weighted average price https://en.wikipedia.org/wiki/Volume-weighted_average_price. Missing or empty |title= (help)
11. ^ "Basics of Statistical Mean Reversion Testing". Quantstart.
12. ^ Muller, Christopher (July 14, 2018). "Robo-Advisor: Future to Financial Management?". Algonest. Retrieved June 24, 2018.
13. ^
14. ^ "A day in the quiet life of a NYSE floor trader". 29 May 2013.
15. ^ Folger, Jean. "The Pros And Cons Of Automated Trading Systems". investopedia. Retrieved 21 September 2017.
16. ^