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
- Consistency. The rules are applied the same way every time, including on the days you feel bad.
- Speed. A rule that depends on a price crossing a level can be acted on within the session rather than when you next look at the screen.
- Testability. A written rule can be tested on history, and the test can be inspected and repeated.
- Scale. One person can run several strategies across several instruments.
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.
- Cash and futures: the futures price and the spot price converge at expiry. A position that is long one and short the other can capture the difference, but the return is small, the margin is large, and the trade is not riskless if the hedge is imperfect.
- Cross-exchange: the same security or contract on two venues at different prices. In India, the two main exchanges are highly correlated and the opportunity is small and fast; the costs and the operational risk usually exceed it.
- ETF versus NAV: an ETF trading at a discount to its underlying basket. Capturing it requires creating or redeeming units, which most retail investors cannot do.
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.
- Brokerage and taxes apply to every trade. A high-turnover strategy needs a larger gross edge to survive them.
- Bid-ask spread is a cost on every market order. Illiquid instruments have wide spreads.
- Slippage is the difference between the price you expected and the price you got. It grows with size and with volatility.
- Order type matters: a market order guarantees a fill but not a price; a limit order guarantees a price but not a fill. A backtest that assumes a fill at the close, or at the exact stop level, is assuming something the market does not promise.
The Indian context
- Broker APIs. Most Indian brokers offer an API for order placement, positions and market data. The API key is as sensitive as a password; a key that can place orders should never be shared.
- SEBI’s framework. SEBI has a regulatory framework for algorithmic trading that requires brokers to approve and, for certain categories, register algorithms, and sets expectations for API-based access. The rules have changed over time, so check the current circular and your broker’s API terms before building.
- Market hours and expiry. Equity derivatives trade on exchange schedules, with expiry days and settlement rules that a strategy must handle. A rule that ignores expiry will eventually hold a position into settlement.
- Data. Reliable historical and live data is the first cost. Free data is often delayed, incomplete or adjusted inconsistently.
Testing and risk controls
Before a strategy trades real money:
- Write the rule unambiguously. Every entry, exit, size and exception, in a form another person could implement.
- Backtest with costs and out-of-sample data. Hold back a period, test once, and expect live results to be worse.
- Paper trade. Run it live with no money and compare the fills to the backtest assumptions.
- Start small. The first live size should be the size at which being wrong is survivable, not the size the backtest says is optimal.
- 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.
- 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.


