How to start algorithmic trading in India
The short answer
Algorithmic trading is a pipeline, not a script. You begin with a written hypothesis, assemble clean data, backtest it with realistic costs, paper-test it forward on live data, then wire it to a broker API for execution behind a risk and kill-switch layer with monitoring. Running alongside is the compliance gate: under SEBI's framework, retail API orders above a specified order-frequency threshold are treated as algo and must be tagged with an exchange-assigned algo ID through your broker. Coding is one link in that chain, and it is rarely the one that decides whether you make money.
Almost every search for "how to start algo trading" is really asking for the Python tutorial. The tutorial is a small, late part of the work. The uncomfortable truth, visible in the data on retail outcomes, is that most automated strategies fail before they place a single live order, and they fail in three specific places: the quality of the data, the honesty of the validation, and the accounting for cost. This guide walks the real end-to-end path, keeps the regulatory and risk layer in front where it belongs, and names the failure modes that quietly wreck the majority of attempts. If you want the market-level case for systematic trading in India, the companion landing page on algorithmic trading in India sets the scene; this article is the practitioner's build sheet.
The pipeline, end to end
An algorithmic trading system is a chain of stages, and the chain is only as strong as its weakest link. A brilliant execution layer cannot rescue a strategy built on a look-ahead bug, and a genuine edge can still bleed out through unmodelled costs or an unhandled disconnect. Read the pipeline left to right, but understand that each stage can veto everything downstream of it.
Stage one: a hypothesis you can actually test
A strategy is a falsifiable claim about the market, stated precisely enough that a computer can check it against history. "Momentum works" is not a hypothesis. "On the Nifty 50 index, a long position opened when the 20-day return is positive and closed when it turns negative, sized to a fixed risk, produces a positive expectancy after costs" is one, because every clause is measurable and the whole thing can be proven wrong. If your idea cannot be reduced to explicit entry, exit, and sizing rules, there is nothing to automate, because automation is exactly the act of writing those rules down without ambiguity.
The discipline here is to fix the rules before you see the results, not after. The moment you adjust the rule because the backtest looked poor, you have begun fitting the strategy to the very data you are meant to be testing it on, and the edge you measure afterwards is partly an illusion you built. Deciding what would make the idea sound, and what would kill it, in advance is the same judgement work that the method we teach is built around, and it is the part no library can do for you.
Stage two: data is where most edges quietly die
The single most under-appreciated fact in retail algo trading is that the data decides the result before the strategy does. Two data defects flatter almost every naive backtest.
Survivorship bias. Most freely available datasets contain only instruments that are still listed today. Every company that was delisted, merged away, or went to zero has been silently deleted from history. A strategy backtested on today's index members is quietly asking "how would this have done on the firms that survived," which is a question with a rosier answer than the one you need. An honest test uses point-in-time constituents and includes the names that later disappeared.
Look-ahead bias. A signal computed from a day's data cannot be acted on until the next tradable moment. In practice this means an indicator value on day N drives a position that opens on day N plus one, never the same bar. In a pandas backtest that is a one-line discipline, shifting the signal by one period before applying it. Omitting that shift lets the strategy trade on information it could not have had, and the resulting equity curve is fiction. Adjacent to it sit corporate-action errors: an unadjusted split or dividend produces a phantom overnight move that a careless strategy will happily and unrealistically capture.
Stage three: the backtest, and the overfitting trap
A backtest replays the strategy over historical data and reports what it would have done. Its danger is that it is trivially easy to make one look good and much harder to make one that means something. The core hazard is overfitting: tuning parameters so tightly to the historical sample that the strategy captures noise rather than a repeatable effect. If you try a hundred parameter combinations and keep the best, you have not found an edge, you have found the arrangement that best fits the random detail of one particular past. The tell is a strategy that is beautiful in-sample and falls apart the moment it meets data it was not fitted on.
The defences are structural, not clever. Hold out a segment of data the strategy never touches during design, and judge it only there. Use walk-forward testing, where you repeatedly fit on one window and test on the next unseen window, so the strategy is validated across many out-of-sample slices rather than one. Keep an honest count of how many variations you tried, because testing fifty ideas and reporting the best is a statistical certainty of finding a flatterer. And treat a strategy with dozens of tunable parameters with suspicion: the more knobs, the more room to fit noise. These traps, and how they present in Indian data specifically, are the subject of the companion article on backtesting mistakes retail traders make.
Stage four: costs turn many "winners" into losers
A backtest with no transaction costs is not a backtest, it is a daydream. Every real trade in India pays a stack of frictions, and for an active, high-turnover strategy that stack is often the difference between a positive and a negative expectancy. The components are not exotic, but they are cumulative, and they scale with how often you trade.
| Cost component | Roughly what it scales with | Effect on a high-turnover algo |
|---|---|---|
| Brokerage | Per order, flat or percentage | Multiplies directly with trade count |
| Securities transaction tax | Percentage of turnover | Heavier on frequent trading |
| Exchange and clearing fees | Percentage of turnover | Small per trade, large in aggregate |
| Stamp duty, SEBI and GST charges | Percentage or per order | Adds a further layer each round trip |
| Slippage | Order size versus liquidity | The hidden cost most backtests ignore |
The last row is the one that catches people. Slippage is the gap between the price your signal saw and the price your order actually filled at, and it does not appear in a naive backtest at all, because such a backtest assumes you transact at the historical price for free. In a fast or thin market the fill can be materially worse, and a strategy that trades often pays that toll on every leg. The practical rule is to build the full cost stack into the backtest from the first run, not to bolt it on later, because a strategy that only survives at zero cost was never viable. The mechanics of the Indian friction stack are broken down in the companion guide on the real cost of an Indian trade.
Stage five: paper and forward testing before capital
A strategy that has passed an honest in-sample backtest and an out-of-sample check has still only ever been evaluated against recorded history. It has never met the live market, and the live market introduces frictions no historical file contains: the feed arrives with latency, orders take time to route and fill, the price moves between the signal and the execution, and the system has to run unattended without you nursing it. Forward testing, also called paper trading, runs the full system on live data with simulated or tiny orders, so all of that surfaces while nothing is at risk.
Treat the forward-test phase as a dress rehearsal for the whole machine, not just the strategy. It is where you discover that your session token expires and the reconnect logic was never exercised, that the feed drops for ninety seconds during a volatile open, that a corporate action is handled differently live than in your file. Only after the system has run cleanly forward, with the execution and operational layers behaving, does graduating to real capital, and then in small size first, make sense. The progression from a rehearsed system to live money is exactly the terrain of the companion guide on moving from paper trading to live capital.
Stage six: execution, and the SEBI compliance gate
Execution is where your code meets a broker API to place, modify, and cancel real orders, and in India this is no longer a purely technical step. It is governed by SEBI's framework for safer participation of retail investors in algorithmic trading, set out in a circular dated 4 February 2025. This is the scoop that dates every generic "how to algo trade" article that omits it, and it changes what you are allowed to run and how.
The mechanics matter, so state them precisely. Retail orders placed through a broker API above a specified order-frequency threshold, reported in the implementation standards as of the order of ten orders per second per exchange per client, are treated as algo orders. Those orders must be registered and tagged to the exchange with a unique algo ID, so the exchange has an audit trail of automated activity. The broker acts as the principal for API-based algo access and must onboard and empanel any algo or API provider as its agent. API access itself is hardened: static IP whitelisting, client-specific and vendor-specific keys, and strong authentication such as two-factor, with open or freely connectable APIs curbed in favour of routes controlled by the broker. Finally, the framework draws a white-box versus black-box line, and it registers where the risk sits.
The white-box versus black-box distinction is the part that decides how much scrutiny falls on you. A white-box, or execution, algo is one whose logic is fully disclosed to the user, who can see the rules and reproduce them. If you write and understand your own strategy, you are running a white-box algo on your own account, and the burden is the tagging and the hardened API route. A black-box algo is one whose logic is proprietary and hidden from the user, and here the framework loads heavier expectations onto the provider, including registration expectations such as registration as a research analyst and periodic disclosure. In plain terms, opaque strategy sellers face a higher bar than a trader automating their own transparent rules.
| Dimension | White-box (execution) algo | Black-box (non-disclosed) algo |
|---|---|---|
| Logic visibility | Fully disclosed to the user; rules are seen and reproducible | Proprietary; internal logic hidden from the user |
| Typical operator | A trader automating their own transparent rules | A third party selling a strategy as a product |
| Registration weight | Lighter; the focus is tagging and a hardened API route | Heavier; registration expectations, including as a research analyst |
| Disclosure | You already know the logic you built | Periodic disclosure expectations on the provider |
Stage seven: the risk layer and the kill-switch
An automated system's great danger is its speed. A human trader who makes a mistake can usually stop after one bad order; an algorithm with a logic error, a stale feed, or a runaway loop can send many wrong orders before anyone notices, and in an unattended system nobody is watching in real time. The risk layer exists to bound that failure, and its sharpest instrument is the kill-switch: a set of pre-committed rules that halt the algo, and where required flatten open positions, the instant a limit is breached.
The limits are decided in writing before the account is live, and they trigger automatically, without discretion, because discretion in the moment is precisely what fails under stress. Sensible triggers include a maximum daily loss, a hard cap on position size or aggregate exposure, a data-feed disconnect, and an order-rejection or error storm that signals the system has lost its footing. The operational corollary is that live execution belongs on an always-on host, not a laptop that sleeps and drops connectivity, with reconnect logic for the feed, session and token management for the broker API, and monitoring of the handful of metrics that reveal the system's health: whether data is arriving, how many orders are open, current exposure, and the connection status. You do not talk yourself out of a kill-switch once it has fired. That pre-commitment is the whole point.
What the failure data is really telling you
It is worth grounding all of this in the outcomes. A SEBI study released in July 2025 found that 91 percent of individual traders in the equity-derivatives segment lost money in FY25, with aggregate net losses of about 1,05,603 crore rupees. That figure is not a verdict on automation specifically, and automation is not the cause of it. But it is the backdrop against which any "start algo trading" pitch has to be read, because it says plainly that the median outcome in fast, leveraged trading is a loss, and that adding a computer to a strategy without an edge, without honest validation, and without cost accounting simply loses money faster and more consistently. Automation is a force multiplier. It multiplies whatever is already there, including a negative expectancy.
The correct reading of the pipeline, then, is defensive. The reason to insist on clean data, out-of-sample validation, a full cost model, a forward test, a hardened compliant execution route, and an automatic kill-switch is not bureaucratic thoroughness. It is that each stage is a place where the majority quietly fail, and passing all of them is what separates a system with a chance from one of the statistics. If you want the structured version of that path, from the research layer through to production architecture and the deployment playbook, that is the terrain the curriculum sequencing below is built to cover, in order, so that the compliance and risk layers are learned as first-class stages rather than afterthoughts.
Build the pipeline in the right order
Bharath Shiksha is a 30-volume curriculum across 6 stages, from chart reading (Stage 1 at ₹14,999) through the systems and capital stages that cover research, backtesting, execution architecture, and the risk and compliance layer, up to the full bundle at ₹1,49,999. Every volume ships with a companion worksheet and a gate quiz, and a 7-day money-back guarantee.
Take the free diagnostic →Frequently asked questions
How do I start algorithmic trading in India?
+Start with a written strategy hypothesis, not with code. Then assemble clean historical data, backtest the idea honestly with realistic costs, forward-test it on paper on live data, and only then wire it to a broker API for execution behind a risk and kill-switch layer with monitoring. In parallel, meet the compliance gate: under the SEBI framework, retail API orders above a specified order-frequency threshold are treated as algo and must be tagged with an exchange-assigned algo ID through your broker. Coding is one link in that chain, and rarely the one that decides the outcome.
Do I need SEBI registration or exchange approval to run a retail algo in India?
+Under the SEBI circular dated 4 February 2025 on safer participation of retail investors in algorithmic trading, retail orders placed through a broker API above a specified order-frequency threshold are treated as algo orders and must be registered and tagged with the exchange through a unique algo ID. Your broker is the principal that onboards and empanels the algo or API provider as its agent. You do not personally register as an intermediary to automate your own account, but the algorithm and the API route are subject to broker onboarding and exchange approval. The framework was phased, with an extended go-live of 1 April 2026.
What is the difference between a white-box and a black-box algo under SEBI rules?
+A white-box or execution algo is one whose logic is fully disclosed to the user, who can see the decision rules and reproduce them. A black-box algo is one whose internal logic is proprietary and not disclosed to the user. Under the SEBI framework the distinction matters because opaque, non-disclosed strategy providers face heavier registration expectations, including registration as a research analyst, and periodic disclosure. If you write and understand your own rules, you are operating a white-box algo on your own account.
Why do most retail algorithmic trading attempts fail?
+Most retail algo effort fails on data quality, overfitting, and cost, not on the code. Free or survivorship-biased data flatters a backtest by hiding the names that were delisted. Testing many parameter combinations and keeping the best fits the strategy to noise, so it looks excellent in-sample and decays out-of-sample. And backtests run without brokerage, exchange fees, taxes, and slippage report a profit the live account never sees. A strategy that survives honest data, out-of-sample validation, and full costs is rare, and that survival, not the automation, is the hard part.
What is overfitting and how do I detect it before going live?
+Overfitting is when a strategy is tuned so tightly to the historical sample that it captures noise rather than a repeatable effect, so its measured edge does not persist. You detect it by holding out data the strategy never saw during design and comparing performance in-sample versus out-of-sample. A large gap, where the equity curve is smooth in-sample and ragged or negative out-of-sample, is the signature. Walk-forward testing, where you repeatedly fit on a window and test on the next unseen window, and counting how many parameter combinations you tried, both help expose it.
What is a kill-switch in an algo trading system and why do I need one?
+A kill-switch is a pre-committed rule that halts the algo and, where required, flattens open positions when a limit is breached: a maximum daily loss, a position or exposure cap, a data-feed disconnect, or an order-rejection storm. You need one because an automated system can send wrong orders far faster than a human can intervene, and a single unhandled bug or a stale feed can compound losses in seconds. The switch is defined in writing before the account goes live, it triggers automatically, and it is not overridden in the moment.
How much data and testing do I need before deploying real capital?
+Enough clean history to cover more than one market regime, including at least one meaningful drawdown, and data that includes names that were later delisted so the sample is not survivorship-biased. Beyond the in-sample backtest you need an out-of-sample test on data untouched during design, and then a forward or paper-trading phase on live data so execution, latency, and the difference between the signal price and the fill price are exposed before money is at risk. There is no fixed number of days, but a strategy that has only ever been fit, and never validated forward, is not ready.
What infrastructure do I need to run an algo, and does a laptop work?
+A laptop is fine for research and backtesting but not for live execution, because it sleeps, drops connectivity, and updates itself mid-session. Live algos run on an always-on host with a stable connection, session and token management for the broker API, reconnect logic for the streaming feed, monitoring of the key operational metrics, and alerting. Under the SEBI framework the API route is also hardened, with static IP whitelisting, client-specific and vendor-specific keys, and strong authentication such as two-factor, so the infrastructure has to satisfy the broker's onboarding requirements too.
How is a retail API order classified as algo, and what is the order-frequency threshold?
+Under the implementation standards for the SEBI framework, an order route is treated as algo when its order rate exceeds a specified threshold set by the exchanges, reported as ten orders per second per exchange per client. Below that threshold an API is treated as ordinary automated access; above it, the orders must be tagged as algo with a unique exchange-assigned algo ID through the broker so the exchange has an audit trail. The threshold is set by the exchanges and can be revised, so the current figure should be confirmed with the exchange or the broker.
Where the facts come from
- SEBI, safer participation of retail investors in algorithmic trading. Circular dated 4 February 2025 establishing the retail algo framework: broker as principal, algo or API provider as agent, unique algo ID tagging of API orders above the specified frequency threshold, hardened API access, and the white-box versus black-box distinction. sebi.gov.in
- SEBI, extension of the implementation timeline. Circular dated September 2025 extending the timeline for implementing the 4 February 2025 retail algo circular; the go-live was reported as moving to 1 April 2026 after a phased schedule through 2025. Confirm the current effective date directly. sebi.gov.in
- Order-frequency threshold. The implementation standards for the framework set the threshold above which an API route is treated as algo, reported as of the order of ten orders per second per exchange per client. The threshold is set by the exchanges and can be revised, so verify it with the exchange or your broker.
- SEBI study on individual trader outcomes, July 2025. Found that 91 percent of individual traders in the equity-derivatives segment lost money in FY25, with aggregate net losses of about 1,05,603 crore rupees. Cited here as the outcome backdrop for retail participation, not as a claim about any strategy.
Related guides
- Algorithmic trading in India: the market-level overview and why systematic beats discretionary for most
- Backtesting trading strategies in India: the integrity checklist
- Pandas backtesting for Indian equities: lagging signals, costs, and survivorship
- Six backtesting mistakes that silently destroy Indian retail strategies
- Building your first trading system in India, step by step