← Algo & Backtesting

The Algo strategy builder, step by step

Most traders can describe their strategy in one sentence and still spend an evening turning it into something a machine will run. The Algo builder is laid out in the same order as that sentence, so each step answers one question and nothing is left implicit.

A strategy is a sentence

Every strategy you build in Algo reads the same way: when some condition is true on the instruments you are watching, fire these legs, manage them under these stop and target rules, and exit when another condition is true or the clock says so.

The builder is that sentence split into numbered steps. You fill them top to bottom, and the same saved recipe is what the backtest replays and what a paper or live run executes. There is no separate “backtest version” of a strategy to keep in sync.

The mistake people make is starting with the legs. The legs are the easy part. The steps before them — what you watch and when you act — are what make two short straddles behave completely differently.

The eight steps

StepWhat you decide
1 · StrategyName, the underlying symbol, an optional template, single-leg or multi-leg, and a short description others can read.
2 · Instruments to watchThe series your conditions can read — spot, an option strike, futures, a straddle, a strangle or a custom combination — each with an alias and a candle size.
3A / 3B · Entry and exit conditionsWhen to fire and when to close, built row by row. See entry and exit conditions.
3C / 3D · Holding periodIntraday by default, or BTST/STBT, a positional hold, and overnight protection for short legs. See BTST and positional.
4 · LegsOne row per order: side, CE/PE or future, how the strike and expiry are picked, quantity in lots, and each leg’s own stop, target and trail.
4B · AdjustmentsRules that roll or re-centre a live position instead of closing it.
5 · Strategy riskStops, targets, trailing and profit lock on the whole basket’s MTM.
6 · ExecutionHow orders go out: leg order, failure policy, order types, product, which days it runs.
7 · SummaryA plain-language readback of everything you set.
8 · SaveSave the recipe, or export/import it as JSON.
The Strategy Builder with a saved NIFTY 09:20 short straddle loaded: the step bar across the top, Step 1 Strategy and Step 2 Instruments open.
The Strategy Builder with a saved NIFTY 09:20 short straddle loaded: the step bar across the top, Step 1 Strategy and Step 2 Instruments open.

Six templates to start from

Step 1 has a Template dropdown. Picking one fills in the legs and timing so you are editing a working strategy rather than a blank page. Every field stays editable.

To make either one actually re-centre when spot moves, add a spot re-centre rule in Step 4B — see adjustment rules.

Templates are starting points, not recommendations. Check the strikes, quantity and stops against your own plan before you run anything.

Single-leg or multi-leg

The Strategy Kind field decides how the strategy treats its legs.

Multi Leg (basket) is the default: a fixed set of legs that enter together and are managed as one position. Straddles, condors, spreads and calendars are all baskets.

Single Leg holds exactly one option or future, and its direction comes from the signal rather than from the row. A long-entry signal buys it, a short-entry signal sells it, and the matching exit signal squares it off. This is the shape for a directional system that flips between long and short on the same instrument.

A worked example: from sentence to steps

Say your idea is: “On NIFTY, after 09:30 IST, if the ATM straddle is trading below its VWAP, sell it with a 30% stop per leg, and close everything if the combined loss reaches ₹6,000.”

  1. Step 1: name it, symbol NIFTY, template Short Straddle.
  2. Step 2: add a straddle watch with an alias you will recognise.
  3. Step 3A: two rows joined with AND — a time row (after 09:30) and the straddle below its VWAP.
  4. Step 4: the template’s two SELL legs are already there with 30% stops.
  5. Step 5: a combined stop of ₹6,000 on basket MTM.
  6. Step 7: read the summary. If it does not say what you meant, the strategy will not do what you meant.

Each clause of the sentence landed in exactly one step. That is the test of a well-built strategy.

Summary, saving and the common mistakes

Step 7 rebuilds a full readback from the form each time you refresh it. Read it before you save — it is the fastest way to catch a stop typed in points that you meant as a percentage, or an exit time earlier than your entry.

Step 8 saves the recipe. A saved strategy is then assigned to a broker account (and optionally grouped into a portfolio) to run. Export JSON downloads the whole configuration as a file and Import JSON loads one back, which is how you keep versions or share a setup.

Two mistakes come up repeatedly. First, leaving every step at its default and assuming the defaults are neutral — they are choices too. Second, judging a strategy only on profit: read the backtest’s drawdown and margin as well, as explained in how to read an options backtest.

Step 7 Strategy Summary for the same straddle: entry and exit, timing, combined risk, execution and the legs table on one card.
Step 7 Strategy Summary for the same straddle: entry and exit, timing, combined risk, execution and the legs table on one card.

Where to find it

  1. Open Algo & Backtest and start a new strategy.
  2. Fill Step 1 and pick a template, or leave it on Custom.
  3. Work down the steps, opening each one as you need it.
  4. Refresh the Step 7 summary, then save in Step 8.

Common questions

Can I build an options trading algorithm without coding?

Yes. The Algo builder is a form: you pick instruments, conditions, legs and risk rules from dropdowns and number fields, and the engine compiles them. An expression box is available for advanced users but is never required.

Is the backtested strategy the same one that runs live?

Yes. A strategy is saved once and the same recipe is used for the backtest, paper forward tests and live runs.

What templates does the Algo builder include?

Short Straddle, Iron Condor, BTST, STBT, Rolling Straddle and Rolling Strangle, plus Custom for a blank start. Each one only pre-fills the form.

What is the difference between single-leg and multi-leg strategies?

A multi-leg strategy is a fixed basket of legs managed together. A single-leg strategy holds one option or future whose buy or sell direction is set by the incoming signal.

How do I share a strategy with someone?

Use Export JSON in Step 8 to download the configuration, and Import JSON on the other side to load it.

More on Algo & Backtesting

More in Algo & Backtesting · App: Algo & Backtest · Definitions: glossary · All: every article