Register
Glossary

What Is a Trading Algorithm?

A trading algorithm is a set of exact rules that decides when to buy or sell, how much and when to exit, carried out by software instead of by hand. If a rule can be written so precisely that a computer follows it the same way every time, it can be an algorithm; if it needs a judgement call in the moment, it is not one yet.

QuantPower Research · Updated 16 Nov 2026 · 7 min read

In Indian markets the word usually means a rule-based strategy on index options or futures, such as "sell the at-the-money straddle at 9:20 am and exit at 3:15 pm", running on a trader's own broker account. Since 1 April 2026, every algo order from a retail trader goes through a broker under SEBI's framework for retail algorithmic trading, which sets how such rules are registered, identified and controlled.

What a trading algorithm contains

Every algorithm, simple or complex, answers the same six questions. If any answer is missing, the software cannot act.

PartQuestion it answersExample
InstrumentWhat does it trade?Nifty weekly options
EntryWhen does it open a position?At 9:20 am, sell the at-the-money call and put
SizeHow much?1 lot of 65 units
ExitWhen does it close?A stop 30% above each leg's entry price, or 3:15 pm
Risk limitWhat stops it for the day?A combined loss of ₹8,000
DaysWhen does it run?Every trading day, or chosen weekdays

A rule such as "exit if the market looks weak" is not yet an algorithm. "Exit if Nifty closes a 15-minute candle below its 20-period EMA" is, because a computer can check it without asking anyone.

How an algorithm runs

Once the rules are written, the software does four things in a loop:

  1. Reads prices. It watches live quotes or closed candles from the broker's feed.
  2. Checks conditions. At each tick or candle close, it tests the entry and exit rules.
  3. Sends orders. When a condition is met, it places the order through the broker's API.
  4. Records and repeats. It logs the fill, updates the position and keeps watching the stops and the exit time.

Because the same steps repeat on every trade, a correct rule is applied consistently, and a wrong rule repeats its mistake every time. That is why testing comes before real money.

A worked example

A Nifty short straddle algorithm sells the 25,000 call at ₹280.50 and the 25,000 put at ₹227.10 at 9:20 am, with Nifty at 25,000. It places a stop on each leg 30% above its entry price and exits whatever is left at 3:15 pm.

  • Premium collected: (₹280.50 + ₹227.10) × 65 = ₹32,994.
  • Stop prices: the call's stop is ₹364.65 and the put's ₹295.23.
  • If the call's stop is hit: that leg loses (₹364.65 − ₹280.50) × 65 = ₹5,469.75, before charges. The put keeps running until its own stop or 3:15 pm.
  • If the put's stop is hit: that leg loses (₹295.23 − ₹227.10) × 65 = ₹4,428.45.
  • Orders a day: four (two entries and two exits), so at ₹20 an order the brokerage alone is ₹80 a day, before STT and exchange charges.

The rules run identically every day, whatever the trader feels about the market. Whether they make or lose money over time is a separate question that only testing can begin to answer.

A short history

Algorithmic trading began with institutions. In 2008 SEBI allowed direct market access, which let institutional clients send orders to the exchange through a broker's systems, and exchanges then offered co-location beside their own servers.1 In 2012 SEBI issued its first broad guidelines on algorithmic trading, with risk controls at the exchange and the broker.1

For retail traders, automation came later and less formally, through broker APIs and third-party platforms. SEBI's circular of 4 February 2025 on safer participation of retail investors in algorithmic trading set the current framework: brokers are responsible for algo orders, exchanges empanel algo providers, approved strategies carry an exchange Algo ID, and API access is tied to a registered static IP.2 After two postponements, the framework applied to every broker from 1 April 2026.2

Trading algorithms under SEBI's rules

  • Orders go through a registered broker, and algo orders carry an exchange-assigned Algo ID.
  • White-box algos disclose their logic to the user. Black-box algos keep it hidden, and their providers need SEBI registration as research analysts.
  • Order rate: a trader whose own code sends more than 10 orders a second must register the algo through the broker.
  • Static IP: API orders must come from an IP address registered with the broker.

Our guide to SEBI's algo trading rules covers the framework in detail.

Algorithms without code

Most retail algorithms today are built without programming. A no-code builder turns a rule like the straddle above into settings: the legs, how each strike is picked, the entry time, the stops and the exit time. The trader still has to think in exact rules; the builder only removes the typing.

Coding still has a place. Custom calculations, unusual data or very specific order handling can need a script. Many traders start with a builder and move to code only when a rule cannot be expressed any other way.

Common mistakes when writing an algorithm

  • Leaving a rule open. "Exit near the close" needs a time; "a big move" needs a number of points or a per cent.
  • Forgetting the exit time. An intraday algo without one can carry a position into the close, where the broker squares it off at whatever price is left.
  • Testing without costs. Brokerage, STT and slippage come off every order. A rule that makes a few rupees a trade before costs often loses after them.
  • No daily limit. Each strategy's own stop can look reasonable while the combined loss across several strategies does not.
  • Changing rules mid-test. Editing a rule after every bad day turns a test of the rules into a test of your mood.

A good habit is to write the rules down in plain sentences first, read them back as if you were the computer, and ask at every step: what exactly happens now?

Trading algorithms in QuantPower

In QuantPower an algorithm is called an algo, and it lives under Algos:3

  • Option bots hold legs with rules for entry, exit, target and stop-loss. A template such as Short Straddle or Iron Condor loads as an open sample, and every rule stays visible and editable, so each algo is white box.
  • Rule legs pick their strike fresh at each entry: at the money, a number of strikes in or out of the money, by premium or by a Greek such as delta.
  • Signal algos watch a condition on price or indicators and either notify you or place the order themselves once armed.
  • Switching on is your choice, either live on your own broker account or in Forward test with test money. Once on, an algo runs by its rules with no further tap.
  • Above every algo sit the account's safety controls: Smart Exit squares off and stops the algos at an account-level target or stop, the daily loss limit refuses new orders once reached, and the kill switch stops a segment until its next session.

Orders leave from the 2 static IPs, a primary and a backup, that every QuantPower account gets free, registered with your broker.

Why traders use algorithms

  • Consistency: the same rules every time, without hesitation or second thoughts.
  • Speed: an order goes out the moment a condition is met.
  • Testing: exact rules can be backtested on past data and then run in Forward test before real money.
  • Attention: the algo watches stops and exit times while you do other work.

Algorithms also bring risks. A wrong setting repeats on every trade, a broker session can expire, and fast markets can fill exits far from the planned price. Our guide to algorithmic trading risks covers them.

Frequently asked questions

Is algo trading legal in India?

Yes, through SEBI-registered brokers and within SEBI's framework for retail algorithmic trading, which applies to every broker from 1 April 2026.

Do I need to know programming?

No. No-code builders let you set the rules as fields and choices. Programming helps only if you need logic that a builder cannot express.

Is a trading algorithm the same as a trading bot?

A bot is the software that runs an algorithm. The algorithm is the rules; the bot carries them out on your account.

What makes an algo white box?

Its rules are visible to the person using it: the entry, the exit, the stops and the size. A black-box algo hides its logic, and SEBI requires its provider to be registered as a research analyst.

References

  1. SEBI, broad guidelines on algorithmic trading, March 2012, following direct market access in 2008 (sebi.gov.in)
  2. SEBI, circular on safer participation of retail investors in algorithmic trading, 4 February 2025, and the glide-path circular of 30 September 2025 (sebi.gov.in)
  3. QuantPower: algo rules and safety controls, from the app's product notes, checked 12 November 2026
Trading involves substantial risk. Examples on this page are hypothetical and are not investment advice.