Algorithmic trading basics: what algos actually do
Behind every twitchy price on your screen is code. What algorithmic trading really means; its three layers; the main kinds of algos; retail versus institutional; SEBI's rules; a simple momentum script, worked step by step; and how, in the US 'flash crash' of 6 May 2010, one execution algo selling $4.1 billion of futures at 9% of volume helped knock nearly 1,000 points off the Dow in minutes.
Facts reviewed Oct 2026
Watch Nifty on a busy morning. Prices tick 40 times a minute. The order book reshuffles all the time. Tiny price gaps open and close in milliseconds.
No human trades that fast. Roughly half or more of NSE’s cash-market turnover now comes from algorithms, and more in derivatives. They’re run by trading firms, market makers, brokers’ own desks, and a small but growing slice of retail traders with Python scripts.
Algorithmic trading isn’t exotic. At its core, it’s any trading where the decision, or the execution, or both, is handed to code, not clicked by a human. That covers a huge range. At one end is a simple “buy at 9:15” script. At the other is a firm with fibre-optic cables laid straight to the exchange’s servers.
The three layers of algo trading
Think of it as a stack:
- Signal generation: what to trade, and when. Rules based on price, volume, news, options data or any other input. This is what most people mean by “strategy”.
- Execution: how to place the order. Split it into smaller slices, to reduce price impact? Cross the spread, or wait at your own price? Spread it evenly over the next 30 minutes?
- Risk and monitoring: position limits, stop losses, margin checks and kill switches. It’s the boring layer that saves you.
A retail algo trader usually obsesses over layer 1, and does the bare minimum on the others. An institutional desk spends most of its money on layers 2 and 3. At their size, a good idea done badly is a bad idea.
The main categories
Not all algorithms look alike. Broadly:
- Execution algos: VWAP, TWAP, iceberg and POV, or percentage of volume. They make no trade decision. They just split a big “parent” order, to limit price impact. Mutual funds and foreign investors use them heavily.
- Market making: quote both a bid and an ask, and earn the spread. It needs very low latency, meaning very fast systems, and very tight risk controls. A handful of global trading firms dominate this in Indian F&O.
- Statistical arbitrage: pairs trading, index arbitrage, and trading the gap between cash and futures prices. Mostly market-neutral, at moderate speed.
- High-frequency trading, or HFT: thousands of orders a second, holding positions for milliseconds, from servers inside the exchange’s building. Retail can’t copy this.
- Systematic trend or momentum: rebalancing daily or weekly, based on price and volatility signals. This is open to retail. Many quant funds run at this pace.
- Options market making and volatility trading: selling premium by rule, and hedging with delta. A major part of Indian F&O flow.
Retail vs institutional: what’s actually different
Retail algo trading in India has exploded since brokers opened up their APIs. But the gap from institutional trading is enormous.
| Aspect | Retail algo | Institutional |
|---|---|---|
| Latency | 100 ms to 1 s, round trip | Under a millisecond, at the exchange |
| Data | 1-second snapshots at best | Every tick, plus order book depth |
| Capital | Lakhs to a few crore | Hundreds of crore and up |
| Strategy | Medium-frequency, end-of-day or swing | Ultra-high-frequency, plus advanced stat arb |
| Cost of a bug | Painful | Ruinous: Knight Capital lost about $460 million in 45 minutes in 2012 |
The lesson isn’t “give up”. It’s this: don’t try to beat HFT firms at their own game. There’s no path from a Python laptop to profitable microsecond trading. But there is a real path to running honest medium-frequency strategies, and Indian retail is doing it.
The Indian rules
SEBI has steadily formalised retail algo trading:
- Approved algos: historically, algos had to be approved by the exchange, and tagged on each order. This applied mainly to broker platforms.
- December 2021: a SEBI consultation paper proposed treating all API orders as algo orders. It sparked a big debate.
- February 2025: a SEBI circular set up the framework now in force. Retail investors can run algos through their broker’s API. Every algo order carries an exchange-issued tag. Algos above an orders-per-second threshold must be registered with the exchange. Brokers are responsible for the algos they offer.
- Timing: brokers could start from 1 October 2025. After a phased glide path, it became mandatory for all brokers from 1 April 2026.
In practice, say you place fewer than 10 orders a second through your broker’s API, for your own account, from your own registered static IP address. Then you’re in retail territory, and largely fine. Beyond that, you’re in registered algo territory, with more compliance.
A retail trader's script places about 25 orders a second through their broker's API, for their own account. Under SEBI's 2025 framework, what applies?
Below about 10 orders a second, a retail algo runs through the broker's API with an exchange-issued tag. At 25 a second, it's above the threshold, so the strategy must be registered with the exchange through the broker.
An Indian example: a simple momentum script
A retail strategy widely tested in Indian markets is 12-month price momentum on Nifty 100 stocks:
- Each month, rank all Nifty 100 stocks by their 12-month returns. Leave out the last month, to avoid short-term reversals.
- Buy the top 20, in equal weights.
- Sell previous holdings that are no longer in the top 20.
- Rebalance once a month, and hold otherwise.
Worked example: one rebalance. You have ₹10 lakh, and hold 20 stocks. This month, 4 have dropped out of the top 20.
- Target per stock: ₹10 lakh ÷ 20 = ₹50,000.
- Trades: sell 4 old holdings, and buy 4 new ones, about ₹2 lakh each way.
- Turnover this month: ₹2 lakh ÷ ₹10 lakh = 20%, one way.
- Cost: at about 0.2% per round trip, that’s about ₹400. Over a year of similar months, about ₹4,800, or 0.5% of the portfolio, before taxes.
This kind of strategy has published academic support around the world. It can be built in under 100 lines of Python, with data from NSE or a paid vendor. In many backtests, momentum in India has beaten the Nifty by a few percentage points a year. But it fell harder than the index in bad years.
Two honest caveats. First, past outperformance doesn’t guarantee future returns. Momentum has had long dead patches. Second, backtests always look better than live trading, because of slippage, taxes and the pressure of real money.
A real case: the flash crash, 2010
Even the “simplest” kind of algo, one that only executes an order, can shake a market.
- 6 May 2010, 2:32 pm, New York: a large trader started selling 75,000 E-mini S&P 500 futures contracts, worth about $4.1 billion, to hedge a stock position.
- The algo: a percentage-of-volume program, set to sell 9% of the previous minute’s volume, without regard to price or time.
- The feedback loop: fast traders bought the contracts at first, then sold them on to each other. Volume soared, so the algo sold faster.
- The crash: the Dow fell nearly 1,000 points in under half an hour. Some shares briefly traded for a penny. Most of the fall reversed within minutes.
- 30 September 2010: a joint report by the SEC and CFTC, the US market regulators, set out this chain of events.
Worked example: why a volume-based algo can speed up. These round figures are illustrative. The algo sells 9% of each minute’s volume.
- Calm minute: 10,000 contracts trade, so it sells 900.
- Panicky minute: fast traders pass contracts back and forth, and volume jumps to 40,000. Now it sells 3,600.
- The result: the busier the panic, the faster it sells, with no price limit to stop it.
The lessons:
- Execution rules matter as much as trading ideas.
- Volume isn’t the same as liquidity. Traders passing the same contracts around create volume, not real buyers.
- Every algo needs limits on price, as well as on size.
Going further: why markets added circuit breakers. After 2010, US markets added “limit up, limit down” bands for single stocks. Trading pauses if a price moves too far, too fast. India has long had price bands for single stocks, and market-wide circuit breakers for indices. These don’t stop an algo from making a mistake. They stop a mistake from feeding on itself at machine speed. That gives humans a moment to look, think and cancel.
What algo trading is NOT
- It isn’t a way to guarantee profit. Bad strategies fail faster in code, because you scale them.
- It isn’t magic. Every algo is a rule someone wrote down.
- It isn’t always fast. Some of the most profitable systematic strategies trade once a month.
- It isn’t free. Data, brokerage and time cost real money before your first order.
Common mistakes
- Focusing only on signals, and neglecting execution and risk.
- Trying to compete with HFT firms on speed.
- Ignoring SEBI’s rules on API orders and static IPs.
- Using an execution algo without a price limit.
- Ignoring costs in a monthly rebalance.
Practice 1: A momentum portfolio of ₹20 lakh holds 20 stocks equally. This month, 5 drop out of the top 20. How much do you sell and buy, and what's the one-way turnover?
- Per stock: ₹20 lakh ÷ 20 = ₹1 lakh.
- Trades: sell 5 old holdings, and buy 5 new ones: ₹5 lakh each way.
- Turnover: ₹5 lakh ÷ ₹20 lakh = 25%, one way.
Practice 2: An execution algo must sell 6,000 shares at 5% of the market's volume. The stock trades 8,000 shares a minute. How long will the sale take?
- Shares sold per minute: 5% × 8,000 = 400.
- Time: 6,000 ÷ 400 = 15 minutes, if volume stays steady.
Key takeaways
- Algo trading = any trade where code makes the decision, the execution, or both.
- Three layers: signal, execution, and risk and monitoring. Retail usually focuses only on the first.
- Categories range from VWAP execution, to HFT market making, to monthly momentum systems.
- Retail can’t compete with HFT on speed. Focus on medium-frequency strategies instead.
- SEBI’s February 2025 framework, mandatory for all brokers since 1 April 2026, formalised retail API algos, with a 10-orders-a-second threshold.
- In the 6 May 2010 flash crash, one execution algo selling at 9% of volume helped knock nearly 1,000 points off the Dow.
Go deeper
- SEBI: the 2025 retail algo trading framework circular.
- NSE: co-location and algo services.
- CNN Money: trading program sparked May “flash crash”, October 2010.