Building Algorithmic Trading Systems: 2 Main Approaches, Testing, Tools
7 minutes for reading
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:
- What will be the frequency of trading and the likely trading volume?
- Will the system require risk management or portfolio construction module?
- 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.
2 - Algorithmic Trading Software. No coding skills
The second approach is algorithmic tools, such as Multicharts or R StocksTrader 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 Multicharts, or R StocksTrader 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 StocksTrader 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 StocksTrader 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.
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 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.
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 StocksTrader Strategy Builder (https://stockstrader.roboforex.com/ - free software), MultiCharts (license fee), TradeStation (license fee), Wealth-lab (license fee).
Code
Matlab, Python, R, C#
Data
- Social Sentiment Data (from Twitter and other social media, see ISentium, TickerTags)
- Crowd-Sourced Data (see Estimize)
- Behavioral Data (see Cabot Research)
- Satellite and aerial images (see Orbital Insight)
- Consumer behavioral data (see Brand Loyalties)
- Non-traditional online resources (see Knowsis)
- OTAS (Technical Data)
Other providers
TIM Group, Discern, Essentia, Kensho, RavenPack, SocialMediaAnalytics, Ayasdi, TheySay Analytics, Quid, Rage Frameworks, Dataminr.
Books (in English)
- Quantitative Trading: How to Build Your Own Algorithmic Trading Business - Ernest Chan
- Algorithmic Trading: Winning Strategies and Their Rationale - Ernest Chan
- Machine Trading: Deploying Computer Algorithms to Conquer the Markets - Ernest Chan
- Algorithmic Trading and DMA: An introduction to direct access trading strategies - Barry Johnson
- Trading and Exchanges: Market Microstructure for Practitioners - Larry Harris
Popular servers and financial journals that you can source ideas from (in English)
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.