Algo & AI · Pillar guide

Algo trading, from idea to live.

Algorithmic trading is trading by exact rules a computer can follow. Here is how a strategy is built and tested, the main types, what regulators in India, the US and Nepal allow, and how to learn the skills on virtual coins first.

ALGO LIFECYCLE1Idea“Buy strength”2RulesIF EMA9 > EMA213BacktestPast bars + fees4PaperVirtual coins5LiveSmall, with limitsResults disagree? Fix the rules, test againEquity while testing
How it works

Five steps every algo goes through

Professional desks and beginners follow the same loop. Skipping a step, usually paper trading, is where most money is lost.

  1. 1IdeaA pattern you believe repeats: trends continue, stretched prices revert, breakouts run.
  2. 2RulesExact entry, exit, size and stop. If two people would read it differently, it is not a rule yet.
  3. 3BacktestRun the rules on past prices with fees and slippage. Look at drawdown, not just return.
  4. 4Paper tradeRun it forward on live prices with virtual money. Does it behave like the backtest?
  5. 5Live, smallReal money in small size, with a kill switch, a daily loss limit and a log.
Strategy types

The main families of algo strategies

Most retail strategies are trend, mean-reversion or breakout rules. You can test working examples of each in Pro Chart.

TrendTrend following

Buy when price is rising and keep riding it, e.g. a fast moving average crossing above a slow one. Wins big in trends, bleeds in sideways markets.

RevertMean reversion

Bet that a stretched price snaps back, e.g. buy below the lower Bollinger Band, sell at the middle. Works in ranges, hurts in strong trends.

BreakoutBreakout

Enter when price clears a recent high or low, like the classic 20-day Donchian rule. Many false breaks; the winners must pay for them.

MomentumMomentum

Rank stocks by recent strength and hold the strongest. Indicators like RSI, MACD or rate of change drive it.

ExecutionExecution algos

Not about direction at all: split one big order over time (TWAP) or with volume (VWAP) to get a fair average price.

SpeedMarket making & arbitrage

Quote both sides or exploit tiny price gaps. This is the high-frequency end, run by firms with exchange-side servers.

Rules by country

What regulators allow

India · SEBI

Allowed, through your broker

  • SEBI circular of 4 February 2025 on safer retail algo trading.
  • Algo orders carry an exchange algo ID; static IP and two-factor login for APIs.
  • White-box (disclosed logic) vs black-box (hidden) algos; black-box providers must be SEBI Research Analysts.
  • Reported mandatory for all brokers from 1 April 2026.

White box vs black box →

US · SEC & FINRA

Allowed, via broker APIs

  • Many brokers offer APIs for automated orders; normal market rules apply.
  • In 2026 the SEC approved FINRA changes replacing the $25,000 pattern-day-trader minimum with intraday margin rules, phased in by brokers.
  • Spoofing and layering are illegal whether a person or a program does it.
Nepal · SEBON

AI orders paused

  • On 26 August 2026, SEBON directed NEPSE to stop AI-based order entry on all TMS platforms until international practice and Nepal's needs are studied.
  • It also ordered an IT audit and penetration test of the TMS.
  • There is no published framework for retail trading bots on NEPSE. Ask SEBON or your broker before automating.

Sources: SEBI circular SEBI/HO/MIRSD/MIRSD-PoD/P/CIR/2025/0000013; FINRA Regulatory Notice 26-10; SEBON's directives to NEPSE as reported by ShareSansar and The Rising Nepal, 26–27 August 2026.

Skills

What you need to learn

Market basics

Order types, spreads, liquidity, trading hours, fees and taxes on your market.

Indicators & rules

Turning a hunch into an exact IF/THEN rule a computer cannot misread.

Backtesting honestly

Fees, slippage, out-of-sample tests, and spotting overfitting and look-ahead bias.

Risk & sizing

Stop-losses, position size from your risk per trade, max drawdown limits.

A scripting language

Pine Script for chart strategies, Python for data and research.

Discipline & logs

Journals, kill switches, and the patience to paper-trade before going live.

Reality check

Why most retail algos fail

Overfitting (rules tuned until the past looks perfect), ignoring fees and slippage, look-ahead bias (using data you would not have had), and no risk limits sink far more algos than bad ideas do. A backtest shows how rules behaved, never what they will do next. StockYatra's backtests show losing strategies as losing, so you learn this early and cheaply.

Practise it on StockYatra, free.

Learn the skills behind algo trading on virtual coins, with live NEPSE, NSE and US prices. Every rule is visible and every backtest is honest, losing trades included.

  • 41 prebuilt strategies with their rules in plain words
  • No-code rule builder and a Pine Script editor
  • Market, Limit and Stop orders, long and short, 24/7 practice
Read more

Related articles

What Is Algorithmic Trading? A Plain-English Guide for 2026

Algo trading is simply trading by written rules that a computer follows. Here is how an idea becomes an algorithm, the main kinds, who uses them, the rules where you live, and a safe way to learn.

Algo Trading in India 2026: SEBI Rules for Retail Traders, Explained

Since 1 April 2026 every retail algo order in India runs through SEBI's framework. What changed, what it means for your own code and third-party algos, and the questions to ask your broker.

Is Algo Trading Allowed in Nepal? NEPSE, TMS and SEBON in 2026

Nepal has no framework for retail algo trading, no official TMS trading API, and in August 2026 SEBON told NEPSE to stop AI-based orders in TMS. Here is what that means and what you can safely do instead.

How to Backtest a Trading Strategy (and Not Fool Yourself)

A backtest can show you how rules behaved in the past, or it can tell you a comforting story. Here is how to do it honestly, with a worked example where the in-sample winner did not stay on top.

Classic Algo Trading Strategies Explained: Trend, Mean Reversion, Breakout and More

Most trading algorithms are variations on a few classic ideas. Here is how each one works, the market it likes and the market that hurts it, and which Pro Chart strategies let you test it.

Algo Trading vs Manual Trading: Which Fits You?

Algorithms never panic but cannot read the news; humans adapt but get tired and emotional. A fair comparison, and why most beginners do best with a hybrid: written rules, decided by hand.

Python for Trading: Write Your First Backtest in 30 Lines

A 30-line pandas backtest of a moving-average crossover, explained step by step: loading prices, building the signal, avoiding look-ahead bias, adding fees and reading the result honestly.

Questions

Algo trading FAQ

What is algo trading?

Algorithmic (algo) trading means trading with a computer program that follows exact written rules: when to buy, when to sell, how much, and when to stop. The rules can be simple, like a moving-average crossover, or complex statistical models.

Is algo trading legal in India?

Yes, through SEBI's framework. Under SEBI's circular of 4 February 2025, retail algos run through your broker's API with an exchange-issued algo ID, a static IP and two-factor login; black-box algo providers must be SEBI-registered Research Analysts. Reports say the framework became mandatory for all brokers from 1 April 2026. Check your broker's current notices.

Is algo trading allowed in Nepal?

Not for AI-driven orders at the moment. On 26 August 2026 SEBON directed NEPSE to stop AI-based order entry on all TMS platforms until international practice and Nepal's needs are studied, and ordered IT audits of the TMS. There is no published framework for retail trading bots on NEPSE, so check with SEBON and your broker before automating anything.

Is algo trading legal in the US?

Yes. Many brokers offer APIs for automated orders, and the same market rules apply as for manual trades. In 2026 the SEC approved FINRA changes that replace the old $25,000 pattern-day-trader minimum with intraday margin rules; brokers are phasing them in, so check yours.

Do I need to code to do algo trading?

Not to learn it. StockYatra's no-code builder lets you write rules like “EMA 9 crosses above EMA 21” and backtest them. Learning Pine Script or Python later lets you build more.

Does algo trading guarantee profits?

No. A program follows its rules exactly, including losing ones. Most simple strategies lose in some market conditions, and fees and slippage eat small edges. Anyone promising guaranteed returns from an algo is a red flag.

How can I practise algo trading for free?

In the StockYatra app: 41 prebuilt strategies in Pro Chart, a no-code rule builder, a Pine Script editor and honest backtests, all on virtual coins with live Nepal, India and US prices.

StockYatra is an education app with virtual coins, not a broker, adviser or research analyst. Rules summarised here are for learning and change over time; check your regulator's and broker's current notices before acting. Nothing here is a recommendation to buy or sell any security or to use any trading product.