Algorithmic Trading Approaches

The main families of automated strategy, what each one needs to work, how execution and costs decide the result, and why a backtest is not a promise.

Algorithmic Trading Approaches coming soon. Follow us on YouTube in the meantime.

Algorithmic trading means letting a set of written rules, executed by software, decide when to buy and sell. The rules can be simple or complex, but the defining feature is that the decision is mechanical: if the condition is true, the order is placed, without a human deciding in the moment.

Automation is not a strategy. It is a way of executing one. A bad strategy automated becomes a bad strategy executed faster and more consistently, which usually means losing money faster and more consistently. This lesson sets out the main families of approach, what each needs, and where the practical failures come from.

Why automate at all

The costs are real too: a bug can place the wrong order, an API can fail at the wrong moment, and a backtest can be much better than live trading. Automation moves the work from execution to design, testing and monitoring.

The main families

Trend following

The idea: when a price starts moving in one direction, it tends to continue for a while.

A typical rule buys when a fast moving average crosses above a slow one, or when price makes a new N-day high, and exits on the reverse. It works in markets that trend and loses in markets that range, where the repeated false starts produce a series of small losses.

What it needs: a long history that includes both trending and ranging periods, a way to size positions by volatility, and the patience to sit through drawdowns.

Mean reversion

The idea: a price that has moved far from its recent average tends to move back toward it.

A typical rule buys when price is a certain number of standard deviations below a moving average, or when an oscillator is at an extreme, and exits when it returns to the mean. It works in ranging markets and fails when a move is the start of a trend, because the position is on the wrong side of it.

What it needs: a definition of “far” that is tested, a stop for the case where the mean has moved, and attention to the fat tails: the losses on the exceptions are larger than the gains on the rule.

Momentum

Momentum is related to trend following but usually applied across a universe: rank stocks by their return over the past several months, buy the strongest, and rebalance periodically. It is a relative strategy rather than a timing strategy.

What it needs: a survivorship-free universe, a rebalancing rule, transaction-cost modelling and a plan for the turnover.

Breakout

The idea: a price that breaks above a well-defined range or high tends to continue.

A typical rule buys when price closes above the highest high of the last N days, with a stop below the range. It is a special case of trend following, and it shares the same weakness: many breakouts fail, and the winners have to pay for them.

Arbitrage

Arbitrage tries to profit from the same asset trading at different prices.

Arbitrage is not free money. It is a low-return, high-operational-risk activity that requires speed and capital.

Statistical arbitrage and pairs

The idea: two related securities diverge, and the relationship reasserts.

A typical pairs trade goes long the underperformer and short the overperformer when the spread is unusually wide, and exits when it narrows. The hard parts are choosing pairs that are genuinely related, estimating the relationship over time, and surviving the period when the relationship breaks.

This is an advanced family. It needs statistics (stationarity, cointegration), careful out-of-sample testing, and a risk model for the case where the spread keeps widening.

Market making

A market maker posts both a bid and an offer and earns the spread, while trying to keep inventory small. It is a liquidity-providing business, not a directional bet.

What it needs: low latency, exchange connectivity, inventory and risk limits, and a way to hedge. It is not a retail activity in any meaningful sense, though the same logic appears in some high-turnover strategies.

Grid and martingale

A grid places buy and sell orders at fixed intervals around a price, and a martingale increases the size after a loss. Both can look excellent in a ranging market and both have a failure mode that is catastrophic: the grid accumulates a large position as price moves one way, and the martingale’s size grows geometrically until the account cannot fund the next step.

These are worth knowing because they are heavily marketed. They are not risk management; they are a way of deferring the loss.

Scalping and high frequency

Scalping takes many small profits over short holding periods. It depends on execution quality, latency and costs. For a retail participant using a broker API over the public internet, the latency and the cost per trade usually make it uncompetitive. High-frequency trading is a technology business with a substantial infrastructure cost.

Event driven

Rules around earnings, index rebalancing, corporate actions or policy announcements. The edge, if any, is in reacting to information correctly and quickly. The risk is that the event is already priced, or that the reaction is the opposite of the expectation.

Machine learning

Models that learn relationships from data. They can capture non-linear patterns that a hand-written rule misses, and they can also fit noise with great precision. The failure modes are the same as any backtest, amplified: too many features, too little data, and a model that performs well in-sample and poorly live.

Execution is part of the strategy

A strategy’s return is what is left after costs, and costs are decided by execution.

The Indian context

Testing and risk controls

Before a strategy trades real money:

  1. Write the rule unambiguously. Every entry, exit, size and exception, in a form another person could implement.
  2. Backtest with costs and out-of-sample data. Hold back a period, test once, and expect live results to be worse.
  3. Paper trade. Run it live with no money and compare the fills to the backtest assumptions.
  4. Start small. The first live size should be the size at which being wrong is survivable, not the size the backtest says is optimal.
  5. Put hard limits in the software. Maximum position, maximum daily loss, maximum orders per minute, and a kill switch. A strategy without a loss limit is a strategy that can lose the account in a bad session.
  6. Monitor. An automated system that nobody watches is an outage waiting to happen. Log every order, alert on failures, and reconcile positions daily.

The honest summary

The families above are different ways of expressing a view about price behaviour. None of them guarantees a return, and the ones that look most consistent in a backtest are often the most fitted to the past. The edge, if there is one, is small, and costs and execution decide whether it survives.

Our lessons on technical analysis and risk management and position sizing cover the inputs and the sizing. Trading strategies sets out how to write the plan that the software will execute.