What Is Algorithmic Trading? A Beginner's Guide

Algorithmic trading means handing your entry, exit and sizing rules to a program that executes them for you. Here is how that loop works, what it does and does not solve, and what the rules now require in India.

Written by Geet Ramchandani

Published 8 min read

Algorithmic trading is the use of a computer program to execute trading decisions according to rules you define in advance. Instead of watching a chart and deciding in the moment, you specify the conditions for entering a position, exiting it, and sizing it — and a program monitors the market and acts the instant those conditions are met.

The rules are yours. The discipline of following them is the machine's.

What problem does it actually solve?

Most retail traders do not lose money because their strategy is bad. They lose money because they do not follow it.

They widen a stop loss because the position "should" come back. They take a small profit early because they are nervous, then watch the trade run three times further without them. They skip the setup that would have worked and take the one that felt more exciting. Over a hundred trades, the gap between the strategy on paper and the strategy as executed is often the entire edge.

An algorithm closes that gap. It does not get bored on a quiet Tuesday, does not double down after a loss, and does not decide that this time is different. If the rule says exit at a 1.5% loss, it exits at a 1.5% loss.

How algorithmic trading works

Every algorithmic strategy, however sophisticated, is the same loop running over and over:

  1. Take in market data. Prices, volumes, and whatever else the strategy needs — for most retail strategies, candles at some interval, from one-minute to daily.
  2. Evaluate the rules. Does the entry condition hold right now? If a position is already open, has anything triggered an exit — target, stop loss, time limit, or a reversal signal?
  3. Decide the size. How many shares or lots, given the account's capital and the risk allowed on a single trade.
  4. Place the order. Send it to the broker through their API and record what came back.
  5. Track the position. Keep watching until an exit condition fires, then close it and go back to step one.

That loop runs continuously through the trading session. Everything else — the indicators, the machine learning, the options structures — is detail inside step two.

A worked example

Take one of the simplest strategies there is, a moving average crossover on NIFTY:

  • Entry: when the 20-period moving average crosses above the 50-period moving average on the 15-minute chart, buy.
  • Exit: when the 20-period crosses back below the 50-period, sell. Also exit at a 1% loss, or at 3:15 pm, whichever comes first.
  • Size: risk no more than 1% of capital on the trade.

Every fifteen minutes, the program recomputes both averages, checks whether a cross has occurred, and acts. No judgement, no discretion, no "let me see how it opens tomorrow."

This strategy is deliberately naive — published crossover rules are widely known and rarely profitable after costs. It is useful precisely because it shows how little a strategy needs in order to be automatable. The hard part was never the automation.

What algorithmic trading is not

It is not high-frequency trading. HFT is a narrow, capital-intensive corner of the field where firms co-locate servers at the exchange and compete over microseconds. Retail algorithmic trading generally works on minute or daily bars, where a few hundred milliseconds of latency is irrelevant. You are not competing with those firms, because you are not playing the game they are playing.

It is not a black box you buy and switch on. Anyone selling you a guaranteed-return algorithm is selling you something else. A strategy you do not understand is a strategy you cannot evaluate, cannot fix when the market regime changes, and cannot hold onto through the drawdown that every real strategy eventually has.

It is not set-and-forget. Strategies decay. An edge that worked in a trending market stops working in a choppy one. Automation frees you from executing, not from supervising.

The rules in India

Retail algorithmic trading in India is legal and specifically regulated. SEBI issued a circular on safer participation of retail investors in algorithmic trading on 4 February 2025, and after a phased rollout it has applied to all stock brokers since 1 April 2026.

The parts that matter if you are starting out:

  • Algos are registered, not anonymous. Algo strategies offered to retail clients through broker APIs must be registered with the exchange and carry a unique identifier. Orders generated by an algorithm are tagged with it, so every order can be traced back to the strategy that produced it.
  • Your broker is accountable for the API. Brokers are responsible for the algo access they provide, including how API keys are issued and how orders arriving through them are monitored.
  • There is a line between your own automation and a distributed product. Automating your own strategy in your own account sits differently from offering that strategy to other people, which brings its own registration and compliance obligations.

The practical consequence for a beginner is straightforward: use a broker whose algo offering is registered under the framework, and expect your strategy to be identifiable rather than invisible.

What you need to start

A broker with an API. Zerodha's Kite Connect and Dhan's trading APIs are two of the common choices in India. The API is what lets a program place orders in your account rather than you clicking a button.

A strategy defined precisely enough to be code. This is where most people stop, and it is a useful filter. "Buy on the dip" is not a strategy. "Buy when price is 2% below the 20-day moving average and RSI(14) is under 30, exit at a 4% gain, a 2% loss, or after ten sessions" is a strategy — because every term in it is unambiguous.

A way to test it against history. Before risking money, run the rules over past data and see what would have happened. This is backtesting, and doing it badly is worse than not doing it, because a flattering backtest gives you false confidence.

Paper trading. Run the strategy live against real prices with imaginary money. This catches the problems a backtest cannot: orders that do not fill, the API failing at the wrong moment, and the gap between the price your backtest assumed and the price you actually get.

Where it goes wrong

Four failure modes account for most of the disappointment, and all four are worth knowing before you write a line of code.

Overfitting. Tune enough parameters against historical data and you will find a combination that performed beautifully. You have not found an edge; you have found a description of the past. The more parameters you optimise, the more certain this becomes.

Look-ahead bias. Using information in a backtest that would not have been available at that moment. Deciding at 9:20 am based on the day's closing price is the obvious version. The subtle versions — a data source that quietly revises past values, an indicator computed over the full dataset — are the ones that catch people.

Slippage and costs. A backtest that assumes you buy at the exact signal price will overstate returns. In reality there is a spread, the price moves between signal and fill, and every trade carries brokerage, exchange transaction charges, STT, stamp duty, GST and SEBI turnover fees. Rates change, so check your broker's current schedule — but the direction never does. A strategy that trades frequently and earns a thin margin per trade can be profitable on paper and loss-making in an account.

Regime change. A trend-following strategy makes money in trends and bleeds in ranges. Nothing is broken when that happens; you are simply in the market the strategy is bad at. Knowing which regime your strategy needs is part of knowing the strategy.

Key takeaways

  • Algorithmic trading is executing a predefined rule set by program rather than by hand. The edge has to come from the rules; automation only guarantees they are followed.
  • Every strategy is the same loop: read data, evaluate rules, size the position, place the order, manage the exit.
  • It is not high-frequency trading, and retail strategies are not competing on latency.
  • In India the activity is regulated. SEBI's February 2025 framework has applied to all brokers since 1 April 2026, and retail algos routed through broker APIs are registered and tagged.
  • The common failures are overfitting, look-ahead bias, underestimated costs and regime change — three of which a careful backtest will expose, and one of which it will not.

Sources

Frequently asked questions

Is algorithmic trading legal in India?
Yes. Algorithmic trading by retail investors is legal and explicitly regulated. SEBI's circular of 4 February 2025 set out a framework for retail participation, and since 1 April 2026 it applies to all stock brokers. Algo strategies offered through broker APIs must be registered with the exchange and carry a unique identifier, so each order can be traced back to the strategy that generated it.
How much money do I need to start algo trading?
There is no regulatory minimum, but the practical floor is set by margins and costs. Trading a single index futures or options position requires exchange-mandated margin, and fixed per-order costs eat proportionally more of a small account. A strategy that trades frequently on a small account can lose to costs alone even when its signals are right.
Do I need to know how to code?
Not necessarily. Writing your own strategy in Python against a broker API gives the most control and requires programming. Platforms that let you define entry, exit, sizing and risk rules through a builder produce the same kind of strategy without code. Either way you need to understand the logic well enough to know why it loses money when it does.
Is algorithmic trading the same as high-frequency trading?
No. High-frequency trading is one narrow, latency-sensitive corner of algorithmic trading, run by firms with co-located servers competing over microseconds. Most retail algorithmic trading operates on minute or daily bars, where being a few hundred milliseconds slower changes very little.
Can an algorithm guarantee profits?
No. An algorithm removes hesitation and inconsistency from executing a strategy; it does not make the strategy correct. If the underlying edge does not exist, automating it only produces losses faster and more reliably.

Want to try this yourself?

TradeCraft lets you build a strategy, backtest it against historical data, and deploy it on paper before risking a rupee — using your own broker account.

About the author

Geet Ramchandani

Founder & Engineer, TradeCraft

Geet is the founder of TradeCraft, a platform built for retail traders to automate their strategies and mirror trades across broker accounts. With 5+ years of experience trading the markets and hands-on experience with algorithmic trading, he writes about trading systems, execution, backtesting, risk, and what it takes to build them in the real world.