Algorithmic Trading Strategies: Types and How to Test Them

Cover of the article “Algorithmic Trading Strategies: Types and How to Test Them”: Five classes of algorithms on a single scale, with those that can be backtested on the left and those that depend on exchange access on the right

How algorithmic trading strategies differ from execution algorithms

In traders’ conversations, the word “algorithm” merges two entirely different things. In its review of wholesale markets, the British regulator cites definitions from the European standard, and this is the most useful distinction I have encountered.

“Investment decision algorithms make automated trading decisions by determining which financial instrument should be purchased or sold. Order execution algorithms optimise order-execution processes by automatic generation and submission of orders or quotes, to one or several trading venues once the investment decision has been taken.”

The decision algorithm answers the question, “Should we enter or not?” The second algorithm receives a decision that has already been made, and its job is to spread the order over time so that it does not move the price against itself. An SEC report lists common families of the second type: VWAP, TWAP, implementation shortfall minimization, and trading a specified percentage of market volume.

The distinction has practical consequences. The hypothesis that “this setup provides an edge” can be tested on historical data. Execution quality cannot be tested on historical data at all: your order is not present in the order book, so neither is its effect on the price. If the basic structure of a trading algorithm is still unclear to you, start with the explanation of how an algorithm works and how it is tested; I will not repeat it here.

What types of algorithmic trading strategies are there?

The list is short, but each item is a profession in its own right:

  1. Execution algorithms. They split a large order so that the average execution price remains close to the market price. The edge comes from reducing costs, not from prediction.
  2. Passive market making. It places limit orders on both sides and earns from the spread and exchange rebates for providing passive liquidity.
  3. Arbitrage. It captures price discrepancies between related instruments and waits for convergence. The direction of the market does not matter here.
  4. Structural strategies. They exploit the structure of the market itself: differences in data-receipt speed, the characteristics of order types, and delays experienced by particular participants.
  5. Directional strategies. They open a short-term long or short position in anticipation of a price move and usually take liquidity from the order book.

High-frequency trading is sometimes named as a sixth category, but this is like comparing a profession with typing speed. HFT is an operating mode in which any of the classes above can exist.

What SEC and MiFID II regulators require before a trading algorithm is launched

The U.S. regulator’s report states the classification directly:

“The 2010 Equity Market Structure Concept Release described four broad types of short-term high frequency trading strategies: passive market-making, arbitrage, structural, and directional.”

The same report states explicitly that there is no statutory definition of HFT. Instead, it gives a set of five characteristics: extremely fast programs; colocation and individual data feeds; very short position-holding periods; a large number of orders canceled almost immediately after submission; and ending the day with a position close to zero. It also specifies that all five need not be present at the same time.

For the foreign exchange market, the Bank for International Settlements separates the same concepts: its materials contrast pure HFT with the algorithmic execution of large one-way trades. In other words, speed and purpose are different dimensions and should not be confused. The Bank of Russia describes the characteristics in similarly qualitative terms in its review of high-frequency trading; it provides no numerical market share there.

European rules also answer the question of what a regulator actually considers algorithm testing. It is not a backtest.

  1. 1

    Documented testing methodology

    Before launch and before any material update

  2. 2

    Venue compatibility testing

    The algorithm must not disrupt another party’s trading system

  3. 3

    Separate test environment

    Isolated from the live environment

  4. 4

    Deployment with strict limits

    Limits are set in advance, before the first live order

  5. 5

    Instant cancellation control

    Immediately cancels any or all unexecuted orders

  6. 6

    Annual validation

    Systems, algorithms, and strategies are reviewed once a year

The process in RTS 6, the technical standard under MiFID II: backtesting is only part of the first step

The British review adds a requirement that retail traders usually overlook: the algorithm must demonstrate that it “works effectively in stressed market conditions.” A test conducted on a calm segment of historical data does not satisfy this requirement.

Which classes can you test yourself, and which depend on infrastructure?

The boundary between classes of algorithmic strategies is determined by the source of the edge; code complexity has nothing to do with it. If the edge lies in the rule, it is visible in price history. If the edge lies in speed or position in the order queue, it is absent from price history because that history contains neither the queue nor your latency.

123

Edge in the rule

Edge in speed and access

  1. 1.Directional rules
  2. 2.Pairs arbitrage
  3. 3.Market making and HFT

Directional rules

Pairs arbitrage

Market making and HFT

On the left, the edge lies in the rule and is visible in price history; on the right, it lies in the infrastructure and is absent from price history

The scale of the infrastructure barrier is measured in milliseconds. Moscow Exchange publishes the minimum response times for its connection methods: 0.02 ms for colocation, 5 ms for a dedicated ConnectME line, 34 ms for points of presence, and 100 ms for the regular internet. Colocation is five thousand times faster than the internet, and no amount of code optimization can close that gap.

ClassTestable hypothesisMinimum dataMain simulation errorInfrastructure barrier
Directionalthe rule provides an edge after costsclosed bars for one instrumentoverfitting parameters to historical datalow
Arbitragethe pair diverges and then converges againsynchronized quotes for two instrumentsunsynchronized data and hidden carry costsmedium
Passive market makingthe spread covers adverse selectionorder book and time-and-sales datathe tester does not model the order queuehigh
Structuralthe data lead is persistentraw exchange data feedslatency is not incorporated into the test at allvery high
Execution algorithmsthe average price beats the benchmarkyour own ordersyour market impact is absent from historical datamedium

The conclusion for a retail trader is simple: test directional rules. Everything else can be studied to understand the market, but it should not be fed into a conventional tester or treated as a meaningful result.

Who this approach is suitable for
Suitable if
  • You have a directional rule based on closed bars, with the entry, exit, stop-loss order, and position size defined in advance
  • You use one instrument, one timeframe, and a holdout sample that is revealed last
  • You are comparing two versions of the rules on the same holdout sample
Not suitable if
  • You are testing passive market making: the tester contains neither an order queue nor adverse selection
  • You are testing arbitrage between related instruments: the discrepancy lasts for seconds, while a bar provides only four prices
  • You are testing structural strategies based on different data-receipt speeds: they cannot be reproduced without a presence at the exchange

How to formalize a directional hypothesis into unambiguous rules

The phrase “I buy a pullback in a trend” is not a strategy. It contains three undefined words, each of which becomes a parameter you will be tempted to tweak during testing. Section 3.9 of the British regulator’s review requires the following to be documented before testing: the theoretical framework, behavioral characteristics and key assumptions, the composition of the input data, and the calculation procedures.

The practical minimum for one rule looks like this. The entry is a logical expression based on values known when the bar closes. The exit has its own expression of the same kind; “when things look bad” is not a rule. The stop-loss order and position size are defined in advance, before the first run. The timeframe must also be stated explicitly, because the same rule on a different scale is a different strategy.

The components of a strategy’s rules are examined in detail in the article on what constitutes a testable trading strategy. The important point here is that the number of free parameters must be counted before the first run. Seven binary parameters produce one hundred and twenty-eight variants, which is already dangerous territory: the longer the search, the easier it is to find a rule that works only on that particular history.

Why arbitrage and market making cannot be reduced to an ordinary signal

A passive market maker places limit orders on both sides and earns from the spread. The SEC report identifies its main risk as adverse selection: a situation in which the price quickly moves against a posted quote. This risk does not exist in a conventional tester: your limit order is filled as soon as the price touches the level, and nobody gets there before you. In a real order book, there is a queue ahead of you, and your place in that queue determines whether your quote or someone else’s is filled.

Arbitrage fails for a different reason. A price discrepancy between related instruments lasts for seconds, while a test based on closed bars sees only four prices for each minute: the open, high, low, and close. Even if the discrepancy appears in the data, the test never asks whether you could have entered it in time.

This leads to a practical rule. An attractive equity curve produced by arbitrage or market-making logic in a conventional tester is an artifact of simplification. Such algorithmic strategies are tested in a live-like environment with real latency, and exchanges specifically provide test access that replicates a production connection. A retail trader usually does not have this environment.

How to choose the market, data, and horizon before the first test

Data quality is measurable. The MetaTrader 5 tester calculates History Quality as the proportion of valid one-minute bars and explicitly flags gaps in the historical data and bars with a volume of one trade at different prices as defective. The spread is taken from historical data; the tester has no spread model of its own. Therefore, every conclusion from a test is limited by the quality of the segment on which it was obtained.

The second question is the length of the historical record. A paper by four mathematicians in Notices of the American Mathematical Society gives an uncomfortable estimate: with five years of data, no more than forty-five independent model configurations can be tested; otherwise, the training-sample result will be excellent while the result on new data will be zero. With two years of history, as few as seven configurations are enough to reach the limit.

  1. Step 1

    Instrument and timeframe selected

    One instrument and one scale, with neither changed later

  2. Step 2

    Data quality checked

    Historical gaps and suspicious bars identified before testing

  3. Step 3

    Training period

    Parameters are fitted here and only here

  4. Step 4

    Holdout sample

    Not revealed until the parameters have been fixed

  5. Step 5

    Real-time forward test

    Fresh data that was not included in any previous segment

The split is fixed in advance; otherwise, the boundary between training and testing shifts to suit the result

Even mass-market terminals have a built-in forward period: the MetaTrader 5 tester can set aside one-half, one-third, or one-quarter of the period, specifically to prevent parameters from being overfitted to individual segments of historical data. The second testing environment is covered separately in the article on how to test an Expert Advisor in the MetaTrader tester.

How to compare two strategies on the same holdout sample

A common mistake looks harmless: the first trading algorithm is tested over one period, the second over another, and the results are compared. Such a comparison says nothing because the conditions, rather than just the rules, were different.

  1. 1

    One instrument and one timeframe

    Both algorithms are evaluated on exactly the same data

  2. 2

    Identical commissions and slippage

    Values are recorded before the run, not selected afterward

  3. 3

    One historical-data split

    Both use the same training and holdout boundaries

  4. 4

    Parameters fixed

    Fitting is completed before the holdout period is revealed

  5. 5

    Holdout revealed once

    A second run on the same data is no longer independent

  6. 6

    Decision recorded in advance

    The selection criterion is defined before the result is visible

Six steps after which you can defend the comparison result to yourself

The fifth step is violated most often. You look at the holdout result, adjust a parameter slightly, and look again—and the holdout sample is no longer held out. Formally, you are now fitting on the holdout set, and all protection against overfitting has disappeared. The professional alternative is called a rolling window, or walk-forward analysis: parameters are calibrated on one window, the result is measured on the next segment, and then the window advances.

You should also record what counts as a victory. If the criterion is not defined before the result is viewed, the algorithm with the most attractive curve will always be declared the winner.

How to account for commissions, slippage, and the execution model

What matters is not the setting itself, but its significance for your class. For a directional rule on a daily chart, commissions hurt the most. For a class that trades frequently, slippage and position in the queue hurt more: QuantConnect’s default brokerage profile uses a zero-slippage model, and an attractive curve with those settings means nothing.

A study of the U.S. market by NBER researchers shows how decisively this affects the outcome. Anomalies with one-sided monthly turnover below fifty percent still produce a statistically significant premium after costs. Those with higher turnover generally do not. Costs eliminate entire families of algorithms.

The article on backtesting an algorithm explains exactly where to set commissions, the slippage increment, and the tick mode in a specific terminal; there is no reason to repeat those settings here.

How to eliminate lookahead bias and parameter overfitting

Lookahead bias means using data that did not yet exist when the decision was made. TradingView’s documentation identifies common mechanisms: nonstandard chart types with prices that never existed in the market, recalculation after an order is executed, and requesting a higher timeframe without an offset. A related problem is repainting, where historical and real-time logic diverge; the article on non-repainting indicators explains how to detect it.

Overfitting works differently and cannot be cured in the code. Halbert White’s article in Econometrica puts it this way:

“Even when no exploitable forecasting relation exists, looking long enough and hard enough at a given set of data will often reveal one or more forecasting models that look good, but are in fact useless.”

A related conclusion comes from NBER researchers: when factors are tested on a large scale, the conventional t-statistic threshold of 2.0 is inadequate and should be raised to approximately 3.0. In practical tester terms, count how many variants you have tried and demand a larger margin of confidence from the result as the search grows longer.

This has a separate implication for the map of strategy classes. A directional rule is more likely to suffer from overfitting because it has many parameters and testing them is cheap. Arbitrage and market making are more likely to suffer from lookahead bias because their results depend on the order of events within a bar, and price history simply does not contain that sequence.

Risks and limitations

  • Historical performance does not carry over to the live market automatically: costs consume part of the edge, while another part disappears when the market regime changes.
  • Past results do not guarantee future results, and no tester changes that.
  • Infrastructure-dependent strategy classes are technically inaccessible to retail traders, and no tester setting can bypass that barrier.
  • The classification in this article is based on regulatory documents and is not the only possible one: the SEC report has no separate categories for mean reversion and statistical arbitrage.
  • Trading involves the risk of losing capital; position size is calculated before entry, and the mechanics are explained in the article on risk per trade.

Disclaimer. This is not personalized investment advice. Markets are volatile, and trading involves the risk of losing capital. Past results do not guarantee future results.

Sources

Frequently asked questions

How should a beginner start algorithmic trading?

Start with one directional rule for one instrument and one timeframe. The rule must give an unambiguous yes-or-no answer on a closed bar and have a predefined exit and position size. Then divide the history into a training period and a holdout sample, fit the parameters only on the first, and reveal the second only once. Do not begin with market making, arbitrage, or high-frequency strategies: they cannot be tested honestly without access to exchange infrastructure.

Which algorithmic trading strategies are the most profitable?

There is no such answer, and any specific answer to this question should be treated as advertising. Profitability depends on the market, market regime, costs, and execution quality, not on the name of the class. A more useful question is which class you can honestly test with the resources available to you. For a retail trader, that means directional rules, because their edge lies in the rules themselves rather than in the speed of access to the venue.

How does algorithmic trading differ from a trading robot?

Algorithmic trading is an approach in which a program, rather than a person, generates decisions and orders. A trading robot, or Expert Advisor, is a specific program that executes predefined rules. A robot is therefore a tool used in algorithmic trading, not a synonym for it. The distinction matters when testing: you test the strategy as a set of rules, not the robot as code, and separately verify that the code executes those rules without errors.

How much data is needed to test an algorithmic strategy?

It depends not on the calendar but on the number of variants tested. The estimate given in an article in Notices of the American Mathematical Society is as follows. With five years of data, you cannot test more than forty-five independent configurations; otherwise, an excellent training result can coexist with a result of zero on new data. With two years of history, the limit falls to seven configurations. The authors specifically note that the length of the historical record is a necessary but not sufficient condition.

Does algorithmic trading require expensive exchange access?

Not for directional strategies based on closed bars: a regular brokerage account and terminal are sufficient. For anything that makes money from speed, yes, and the difference is measurable. Moscow Exchange lists the minimum response times for its connection methods: 0.02 ms with colocation versus 100 ms over the regular internet. If an idea depends on that gap, it cannot be tested or operated without placing equipment at the exchange.

What you will learn
  • A map of algorithm classes: execution, market making, arbitrage, structural, and directional
  • How to tell which classes a retail trader can test independently and which depend on access speed
  • A protocol for comparing two algorithms on the same holdout sample
  • A list of simulation errors that prevent an attractive backtest from being reproduced in live trading
Apply in 30 min
intermediate

Was this material useful?

Feedback is not available for this language version yet.

Comments

Source comments are not translated and are never replaced with Russian text.

Subject-matter contributor
Max Vitkovsky
Market analyst

Analyses cryptocurrency market structure, levels and on-chain context, with attention to risk and invalidation conditions.

TradingView chart with Buy and Sell signals from the Midas indicator
Midas multi-indicator for TradingViewOne of the most advanced indicators for trading
  • Non-repainting signals
  • Interactive technical analysis
  • 7 strategies to choose from
Midas multi-indicator for TradingViewSignal, stop, and 3 targets - directly on the chart
  • Signal locks at candle close
  • Stop and 3 targets build automatically
  • The trade plan is visible before entry