Tessera

How to Build an Algo Trading Strategy: From Idea to Rules to Running Bot

How to build an algo trading strategy: turn an idea into exact rules, backtest with costs, validate, paper trade, deploy with limits, then review and improve.

By Tessera Trades · Updated · 10 min read

To build an algo trading strategy, start with one market idea, write it as exact rules for entry, stop, target, size and session, then backtest those rules with realistic costs. Check the result on data the strategy never saw, paper trade it on live prices, and only then run it with small size and hard risk limits, reviewing every trade so the next version is better than the last.

Most people skip straight from idea to bot. The steps in between are where you find out whether there is anything worth automating. This guide walks through all eight steps with one worked example, a London opening range breakout, so you can see what each step looks like in practice.

Nothing here is a promise of profit. Backtests and paper results are not future results, and leveraged forex and CFD trading carries a high risk of loss. Your strategy, your settings and your risk are your responsibility.

The eight steps at a glance

StepWhat you doWhat you get out of it
1. IdeaDescribe a behaviour you think repeatsA hypothesis you can test
2. RulesTurn it into exact, unambiguous rulesSomething a computer can run
3. Backtest with costsRun the rules on history, net of spread, commission and slippageA first honest read
4. ValidateUnseen period, robustness checks, other marketsA sense of whether it is real or fitted
5. Paper or forward testRun it on live prices without moneyProof the live version matches the backtest
6. DeploySmall size, hard limits, monitoringA running bot you can stop
7. Journal and reviewCompare live trades with the backtestEvidence, not feelings
8. Next versionChange one thing, re-testA better strategy, or a clean exit

Step 1: Start with an idea you can explain

A good idea for algo trading for beginners is a simple behaviour you have seen many times, with a reason it might repeat. "Price often breaks out of the range set in the first half hour of the London session, because liquidity arrives at the open" is a usable idea. "Buy when it looks strong" is not.

Write the idea in one sentence, then add why it might work and when it might stop working. That second part matters later: if you know the idea depends on volatility at the open, you know to check how it behaves in quiet months.

Ideas usually come from your own trading, a chart pattern you trust, or a published concept. If you trade by hand today, systematic vs discretionary trading covers how to pull rules out of a playbook you already use.

Step 2: Turn the trading idea into rules

This is the step most people underestimate. To turn a trading idea into rules, every decision has to be answerable with yes or no from the chart, with no judgement left. If two people could read your rule and take different trades, it is not a rule yet.

Here is the London opening range breakout written as exact rules. It is a hypothetical example for illustration, not a recommendation.

PartRule
Market and timeframeEURUSD, 15-minute candles
Opening rangeHigh and low of the two candles from 08:00 to 08:30 London time
Entry (long)Price trades 1 pip above the range high before 11:00 London time
Entry (short)Price trades 1 pip below the range low before 11:00 London time
FilterSkip the day if the range is wider than 40 pips or narrower than 8 pips
Stop loss1 pip beyond the opposite side of the range
Target1.5R (1.5 times the distance to the stop)
Time exitClose any open trade at 16:00 London time
Trades per dayOne. No re-entry after a stop
SizeRisk 0.5% of the account per trade

Now the arithmetic for one day. Say the range high is 1.0850 and the low is 1.0830, a 20-pip range, which passes the filter. A long entry triggers at 1.0851. The stop goes 1 pip below the low at 1.0829, which is 22 pips away. The target is 1.5 × 22 = 33 pips, at 1.0884.

On a $10,000 account, 0.5% risk is $50. EURUSD moves about $10 per pip per standard lot, so 22 pips is $220 per lot. $50 ÷ $220 = 0.227 lots, rounded down to 0.22 lots. If the target hits, you make about 33 × $2.20 = $72.60 before costs.

Notice how many small decisions there were: the time zone, the buffer, the range filter, the cut-off time, re-entries. Each one changes results, and each one has to be decided before the backtest, not after.

Step 3: Backtest with costs

A backtest without costs is a sales brochure. For a short-term strategy like this one, costs can be most of the edge.

Keep the example going. Say your spread is 0.8 pips and commission is $7 per standard lot round trip. At 0.22 lots, commission is $1.54, about 0.7 pips. Add 0.5 pips of slippage on entry, since breakout entries tend to fill worse than the trigger price. That is 2.0 pips per trade in total, or 2.0 ÷ 22 = 0.09R.

If the backtest before costs shows an average of 0.15R per trade, after costs it is 0.06R. That is still positive, but most of the edge has gone, and a small rise in costs would remove the rest. This is why you look at expectancy net of costs, not gross. The guide to slippage in algo trading covers how to set realistic numbers.

Also decide how the backtest handles a candle where both stop and target are inside the range. A test that assumes the target hit first will look better than real life. The safe choice is to assume the stop hit first.

Then check the trade count. One trade a day at most, with some days filtered out, might give 150 trades a year. Fewer than about 100 trades tells you very little, as explained in how many trades a backtest needs.

Step 4: Validate before you trust it

A good-looking backtest is the start of the work, not the end. Validation asks one question: would this have worked on data you did not use to build it?

The checks that matter most:

  • Unseen period. Hold back the most recent part of the data, build on the rest, then test once on the held-out part. See out-of-sample testing.
  • Stability over time. Compare the first half with the second half, and look at the last 12 months on their own.
  • Concentration. Remove the best handful of trades. If the result collapses, the strategy relied on luck.
  • Cost fragility. Double the costs. A strategy that only works at perfect fills will not work live.
  • Monte Carlo. Reshuffle the trade sequence to see the range of drawdowns you might face. See Monte Carlo backtesting.
  • Other markets. Run the same rules on GBPUSD or other liquid pairs. A real behaviour usually shows up in more than one place.

If you tested many versions to get here, be wary. Every extra variant you try raises the chance that the best one is fitted to noise. The overfitting guide and the backtest validation checklist go further, and how to stress test a trading strategy covers pushing it harder.

If you plan to trade it on a prop firm account, also test it against the firm's rules. A strategy can be profitable and still breach a daily loss limit; passing a prop firm challenge with an algo shows how.

Step 5: Paper or forward test

Paper trading checks something a backtest cannot: that the live version of your strategy takes the same trades as the tested version. It catches time zone mistakes, data differences, and rules that behave differently on a forming candle.

Run the strategy on live prices with no money at risk, and compare each paper trade with what the backtest would have done on the same day. You are not trying to prove profit over a few weeks; that would need far more trades. You are checking the plumbing. How long to paper trade a strategy covers how many trades and weeks to aim for.

Step 6: Deploy with hard limits

When you build an automated trading strategy that will place real orders, the limits around it matter as much as the strategy.

Set, at minimum:

  • Risk per trade, kept small to start (the example uses 0.5%).
  • A maximum position size, so a sizing bug cannot place a huge order.
  • A daily loss limit that stops trading for the day.
  • A cap on open trades and trades per day.
  • Trading hours, so the bot is idle when you expect it to be.
  • A way to pause or stop it instantly.

Start on a demo account or with the smallest live size you can. Your first live weeks are a test of execution, not of the edge. Live results will differ from the backtest; backtest vs live explains the usual reasons.

Step 7: Journal and review

Every closed trade should go into a journal with the strategy version that took it. Then compare live results against what the backtest led you to expect. Is the win rate in range? Are average losses bigger than tested, which points to slippage? Are there trades the backtest would not have taken?

Review on a schedule, for example every 30 trades, not after every loss. Reacting to single trades is how traders talk themselves out of a working strategy or into a broken one. A trading journal built for algo traders makes this easier.

Step 8: Build the next version

Use what you found to make one change at a time, then repeat steps 3 to 5 for the new version. In the example, you might find that trades taken after 10:00 London time do much worse. Test a 10:00 cut-off as version 2, check it on the unseen period, and keep the old version's results so you can compare.

Change one thing per version. If you change three things and results improve, you will not know which change helped, and you will have tested three ideas against the same data.

Build and test it in Strategy Lab

Tessera's Strategy Lab is built for steps 1 to 4, without code. You can describe the London breakout in your own words to TES, the AI strategy coach, or build it in the recipe composer, which has a Session first-candle ORB starter pack, session filters for London, New York and the other sessions, and a plain-English "If/Then" readout so you can check the rules read the way you meant. If you need more control, custom rules give you 21 indicators.

Every backtest includes commission, slippage, spread and swap, and you choose how a candle that hits both stop and target is handled, including stop-first. Validation runs automatically: the last 30% is held out as an unseen period with a verdict, alongside first half versus second half, the last 12 months, concentration, cost fragility and a multiple-testing warning. The robustness report adds a Monte Carlo of 1,000 simulated years, a cost stress, a "nudge the prices" test and an other-markets test.

For steps 5 to 7, Launchpad runs Strategy Lab strategies on paper with live prices, in Copilot mode where you approve each signal, or in Autopilot inside your limits, on cTrader or Liquid Brokers. Closed trades flow into the trade log, and what you learn becomes the next version. Strategy Lab is on every plan, including Free; Launchpad needs a paid plan. See pricing.

For a side-by-side look at the tools for steps 2 to 4, see the best no-code backtesting software and the best AI trading strategy builders.

Frequently asked questions

How do I build an algo trading strategy as a beginner?
Start with one simple idea you can explain, such as an opening range breakout, and write it as exact rules for entry, stop, target, size and trading hours. Backtest it with realistic costs, check it on data it never saw, then paper trade it before risking money. Keep the first version simple so you can tell what is working.
How do I create an algo trading strategy without coding?
Use a no-code builder that lets you set entries, filters, exits and sizing from menus or plain English, then backtests the result. The rules still need to be exact, so write them down first. Our guide to creating a trading bot without coding compares the options.
How long does it take to build an automated trading strategy?
Writing rules and running a first backtest can take an afternoon. Validating it properly and paper trading long enough to confirm the live version matches the backtest usually takes several weeks. Rushing the later steps is the most common reason a bot behaves differently from its test.
What makes a good algo trading strategy?
Clear rules, a positive expectancy after costs, enough trades to judge it, and results that hold up on unseen data, across time periods and ideally on more than one market. It should also have drawdowns you can sit through, because you will have to.
Is building a trading bot worth it?
It can be, but many retail traders lose money and a bot does not change that on its own. A bot's main value is running tested rules consistently. Read is algo trading profitable for what the evidence says before you commit money.

Ready to find what's costing your algo strategy?

Get started and see how Tessera connects your strategy's trades, market-condition reports and rule simulator in one workflow.