Building Algorithmic Trading Systems: 2 Main Approaches, Testing, Tools

Building Algorithmic Trading Systems: 2 Main Approaches, Testing, Tools

Views: 599 views
Reading time: 6 min



The major components of an algorithmic trading system are research tools, performance, ease of development, resiliency, and testing, separation of concerns, familiarity, maintenance, source code availability, licensing costs, and maturity of libraries. Before deciding on the "best" tool, which to write an automated trading system with, it is necessary to define the requirements:

  1. What will be the frequency of trading and the likely trading volume?
  2. Will the system require risk management or portfolio construction module?
  3. Will the system require a high-performance backtester?

Traders, who require more custom-built and complex systems, might need to look at using C#, Matlab or Python, but I would say for the other 95% of day traders Algorithmic Trading Software will suffice.

1 - Compute in Python, Matlab, C#

In this case, programming skill is an important factor in creating an automated algorithmic trading strategy. Being knowledgeable in a programming language, such as Python or R, will enable you to create the end-to-end data storage, backtest engine and execution system yourself. It allows you to explore the higher frequency strategies as you will be in full control of your "technology stack". While this means that you can test your software and eliminate bugs, it also means more time spent on coding up infrastructure and less on implementing strategies, at least in the earlier part of your algotrading career.

The basic workflow is the following:

  • An algorithmic trading strategy feeds market data (historical or live) into a computer (backtest or automated execution) program.
  • The program then submits orders to a broker through an API and receives order status notifications back from the broker.

MATLAB and Python have been my favorite backtesting platforms. It has a very comprehensive and user-friendly interface for developing and debugging programs, and it has a wide array of toolboxes that cover almost every arcane mathematical or computational technique you will likely encounter in trading strategy development.

Import of historical data from Yahoo Finance to Python
Picture: import of historical data from Yahoo Finance to Python
The process of algorithmic trading
Picture: the process of algorithmic trading

2 - Algorithmic Trading Software. No coding skills

The second approach is algorithmic tools, such as Multicharts, StrategyQuant, or R Trader Strategy Builder (free and easy to use, cloud-based), and many more.

The days when algorithmic trading was implemented only by professionals are over. There is no need to spend hours learning C# when nearly all systems and strategies can be coded with StrategyQuant, Multicharts, or R Trader Strategy Builder. In our experience, some traders/programmers want to take the long route to the goal often under the guise of technical superiority, trust us, most of the advanced coding is not required for the average algorithmic trading strategy. Creating your APIs or customizing everything with MetaTrader can be very wasteful especially if you get bogged down with technical details instead of creating value.

All platforms have their positives and negatives, for us, R Trader Strategy Builder is an in-house proprietary based easy-to-use module, which enables retail traders to design, backtest, and deploy algorithmic trading strategies without any knowledge of programming languages.

R Trader trading platform has a simpler way for you to quit traditional point-and-click trading. Designed for experienced traders as well as newcomers, our simple-to-use interface allows you to automate your trading strategies in minutes. No coding and no fuss – you’ll be up and running in no time.

Backtesting. Strategy Wizard in R Trader Strategy Builder.
Picture: Backtesting. Strategy Wizard in R Trader Strategy Builder.

Testing and Evaluating of Trading Systems

Research is concerned with the evaluation of strategy performance over historical data. The process of evaluating a trading strategy over prior market data is known as backtesting.

Algorithmic trading stands apart from other types of investment classes because we can more reliably provide expectations about future performance from past performance. In simple terms, backtesting is carried out by exposing your particular strategy algorithm to a stream of historical price data, which leads to a set of trading signals. Each trade will have an associated profit or loss. The accumulation of this profit/loss throughout your strategy backtest will lead to total profit and loss.

What are the key reasons for backtesting an algorithmic strategy?

Filtration

our goal at the initial research stage is to filter out any strategy that did not meet certain criteria. Backtesting provides us with another filtration mechanism, as we can eliminate strategies that do not meet our performance needs.

Modeling

Backtesting allows us to (safely!) test new models of certain market conditions.

In-Sample and Out-of-Sample

When testing an idea on historical data, it is good to reserve a period of historical data for testing purposes. The initial historical data, on which the idea is tested and optimized, is referred to as the in-sample data. The data set that has been reserved is known as out-of-sample data. This setup is an important part of the evaluation process because it provides a way to test the idea on data that has not been a component in the optimization model. As a result, the idea will not have been influenced in any way by the out-of-sample data, and traders will be able to determine how well the system might perform on new data, i.e., in real-life trading.

Optimization of an algorithmic trading strategy

Although strategy optimization is fraught with biases, backtesting allows us to increase the performance of a strategy by modifying values of the parameters associated with that strategy and recalculating its performance. Overfitting (curve-fitting) is a serious problem in all areas related to data mining, and you must be careful about using proper validation and test sets. For that reason, there could be implemented a variety of methods, such as retest with different settings, Monte-Carlo simulations, Walk-Forward-Matrix, Walk-Forward-Optimization, Multiple of Out-Of-Sample periods.

Forward Performance Testing

Demo trading or paper trading provides traders with another set of out-of-sample data, on which to evaluate a system. Forward performance testing is a simulation of actual trading and involves following the system's logic in a live market. An important aspect of forward performance testing is to follow the system's logic exactly; otherwise, it becomes difficult, if not impossible, to accurately evaluate this step of the process. Many brokers, as well as RoboMarkets, offer a simulated trading account where trades can be placed and the corresponding profit and loss calculated. Using a demo trading account can create a semi-realistic environment, on which to practice trading and further assess the system.

Picture: backtesting. A chart in Python.
Picture: backtesting. A chart in Python.
Backtesting. Historical trades in R Trader Strategy Builder.
Picture: backtesting. Historical trades in R Trader Strategy Builder.

Last but not least, I would like to discuss the tools that will be helpful in this sphere.

Tools

Research and Automated trading software

Excel, R Trader Strategy Builder (https://rtrader.umstel.com - free software), StrategyQuant (license fee), MultiCharts (license fee), TradeStation (license fee), Wealth-lab (license fee).

Code

Matlab, Python, R, C#

Data

  1. Social Sentiment Data (from Twitter and other social media, see ISentium, TickerTags)
  2. Crowd-Sourced Data (see Estimize)
  3. Behavioral Data (see Cabot Research)
  4. Satellite and aerial images (see Orbital Insight)
  5. Consumer behavioral data (see Brand Loyalties)
  6. Non-traditional online resources (see Knowsis)
  7. OTAS (Technical Data)

Other providers

TIM Group, Discern, Essentia, Kensho, RavenPack, SocialMediaAnalytics, Ayasdi, TheySay Analytics, Quid, Rage Frameworks, Dataminr.

Books (in English)

  1. Quantitative Trading: How to Build Your Own Algorithmic Trading Business - Ernest Chan
  2. Algorithmic Trading: Winning Strategies and Their Rationale - Ernest Chan
  3. Machine Trading: Deploying Computer Algorithms to Conquer the Markets - Ernest Chan
  4. Algorithmic Trading and DMA: An introduction to direct access trading strategies - Barry Johnson
  5. Trading and Exchanges: Market Microstructure for Practitioners - Larry Harris

1. arXiv http://arxiv.org/archive/q-fin
2. SSRN https://www.ssrn.com/en/
3. Journal of Investment Strategies https://www.risk.net/journal-of-investment-strategies
4. Journal of Computational Finance https://www.risk.net/journal-of-computational-finance
5. Mathematical Finance https://onlinelibrary.wiley.com/journal/14679965

Summary

As we can see, there are different approaches to the creation of algorithmic trading strategies. You can choose any that suits your knowledge level and opportunities. Also, backtesting and further development, after which only we can switch to practice.

If you have any questions, I will be happy to answer them in the comments below.

Open Trading Account




Comments

Previous article

A Week On The Market (01/13 - 01/19): Statistics and Central Banks' Decisions

The new week of January looks quite usual. We have the statistics, politics, as well as a few monetary decisions. It seems that global economies and capital markets are working full-scale after the Christmas and New Year holidays.

Next article

3 Stocks to Buy in 2020: Delta Air Lines, HP, Morgan Stanley

The 12-year cycle of the growth of the US economy is going on. This is the longest period to be without a crisis. The beginning of 2020 keeps cheering investors up, the stocks keep renewing all-time highs. The ones who bought them earlier grow happier.