Learn › Glossary › Algorithmic Trading

Algorithmic Trading

Executing trades by predefined rules rather than discretionary judgment — from a two-line moving-average system to institutional market-making. For retail investors, the point is consistency: an algorithm applies its rules every session without fear, greed, or forgetting to check the market. No-code platforms have removed the historical requirement to program.

Algorithmic trading means placing trades by a fixed set of rules instead of by judgment in the moment. A rule may be a single line, for example hold the fund while price is above its 200-day average, or as long as an institutional market-making system. For a retail trader the useful part is consistency. A program applies the same rule at the same time every session and does not skip a day because the market looked frightening or the person was busy.

DeployQuant is an algorithmic trading platform for US stocks and ETFs. The examples below come from its own backtests. Twelve strategy templates ran on 59 ETFs between 2021-01-04 and 2026-10-02, each with a $10,000 start. Headline runs charge no fees or slippage and use no margin, and orders fill on minute bars. The results are hypothetical and are not investment advice.

The three parts of every algorithm

An algorithm in this sense has three parts: a condition, an action and a size. The condition reads data, such as a price, an average or an indicator. The action is a buy, a sell or nothing. The size says how much of the account the action uses. The templates in the DeployQuant library show each part plainly.

The 200-day regime filter is invested while the close sits over its 200-day average and sits in cash under it. The condition is the close against the average, the action is switching between the fund and cash, and the size is the whole account less a small reserve. The buy-and-hold comparison uses the same 98% allocation at the first open, which keeps the two runs comparable.

RSI(2) snapback enters when the 2-day RSI drops under 10 and leaves once it climbs back over 70. The weekly 7% target enters at the first open of each week, leaves a +7% profit target resting, and closes out on Thursday afternoon if the trade is under water. Each of these can be written as a sentence, and each can be run by a program without anyone looking at the screen.

Rules with no judgment inside them can be tested against history. A rule that reads "buy if the chart looks strong" cannot be backtested until someone defines strong in numbers. That step is what turns a trading idea into an algorithm, and it is often the hardest part for a beginner.

From two lines to institutional systems

The term covers a wide range. At one end sits a two-line moving-average system that a person could run on paper. At the other end sit market-making systems that quote prices all day and manage inventory in fractions of a second. The shared feature is that the rules are written before the trade and the machine applies them.

The strategies on this site sit at the simple end by design. They decide once a day or once a week on daily data, and they hold a single fund. The golden cross, which stays long while the 50-day average sits over the 200-day average, made a median of 3 round trips across the 59 funds. RSI(2) snapback had a median of 166. Both are algorithmic trading in the same sense, though their demands on attention are very different.

Speed is not part of the definition. A rule that checks the market once a day is as algorithmic as one that checks every second. DeployQuant backtests on minute-resolution data, while Python strategies can also be run on 1-second bars, but the templates in the library were all tested with daily-decision logic.

What the rules see on real funds

A rule is only as useful as the behaviour of the fund it reads. Six funds in the data show how different that behaviour can be.

SPY returned 125.29% in total as a price series across the window, with annualized volatility of 16.41%. SPY finished above its 200-day average on 77.99% of sessions and crossed that line 30 times. QQQ returned 151.07% with a volatility of 22.39%, spent 75.18% of sessions over the average and crossed it 20 times. A trend rule on either fund spent most of its time invested.

TLT was different. It lost 40.49% over the window and stayed over its 200-day average on only 35.18% of sessions, with 95 crossings. A rule that follows the average would have held it rarely and traded often. IWM returned 55.8%, closed over the average on 63.29% of sessions, with 34 crossings. UVXY, a volatility fund, lost 99.94% and closed above its average on 4.18% of sessions.

TQQQ, a leveraged Nasdaq fund, returned 291.92% at 67.11% volatility, with a worst drawdown of -81.68%. An algorithm that reads TQQQ faces much larger swings than one that reads SPY, so the same rule can give very different results on each. The TQQQ page and the SPY page show the figures behind this.

Algorithmic trading does not remove that dependence on the fund. The backtest reports each result fund by fund, so the dependence can be read directly for any template.

The overnight gap is another feature a rule has to live with. On SPY the share of the log return earned overnight was 62.46% and the share earned during the session 37.54%. QQQ earned 64.64% overnight. A rule that decides at the open or the close cannot act on what happens in between, and a rule that rests an order during the day can.

How a signal is measured

A signal can be tested by counting how often it fired and what happened afterwards. The 14-day RSI on SPY dropped under 30 on 18 sessions. The median forward return over 5 days after those sessions was 3.74%, and over 20 days 2.86%. Any 5-day window on SPY had a median of 0.42% and any 20-day window 1.73%. The signal looks useful in that comparison, but 18 observations is a small sample.

The 2-day RSI fell below 10 on 146 SPY sessions. The median 5-day forward return was 0.89% and the 20-day figure 2.29%. The sample is larger and the tilt over baseline is smaller. For QQQ the 14-day RSI went under 30 on 15 sessions, and the median 5-day forward return of 3.69%, while the 2-day measure fired 144 times with a median of 0.8%.

This is the kind of evidence an algorithm needs behind it. A rule is not an edge because it sounds sensible. It is an edge to the extent that the measurement shows something and the sample is large enough to trust. The RSI mean reversion page applies the 14-day version, and its median CAGR across the universe was 2.98% with 25 funds out of 59 beating buy-and-hold.

What 12 simple algorithms earned

Across the 12 templates the median CAGR on the 59 funds ranged from 0% to 6.61%. The weekly 7% target led at 6.61%, followed by the monthly cycle at 5.46% and RSI(2) snapback at 4.74%. The golden cross had 2.05%, EMA 12/26 trend 2.76%, the 200-day regime filter 1.84% and the dip buyer 1.33%. Both the momentum breakout and the 3-month momentum rule sat at 0%.

Beating buy-and-hold happened on 34 of 59 funds for the weekly 7% target and for RSI(2) snapback. The golden cross managed 27, the 200-day filter 26, RSI mean reversion 25 and the monthly cycle 14. Median maximum drawdown went from 17.47% for RSI(2) snapback up to 36.63% for the monthly cycle.

For comparison, buy-and-hold on SPY compounded at 14.56% a year with a 23.99% maximum drawdown, while QQQ did 16.7% with 34.23%. Algorithmic trading in these tests did not beat an index fund held through a rising market. It produced different return and risk profiles that a person could choose among, and each profile is on its own page.

What the algorithm does in the order book

Deciding is one half of the job. The other half is sending an order and handling what happens next. The algorithm picks an order type (market, limit, stop or trailing stop) and a time in force (day or good-till-cancelled, for instance). It also has to handle a partial fill, a rejection and a day when the broker is unreachable.

The brokers DeployQuant supports differ here. Alpaca accepts limit, market, stop, stop-limit and trailing-stop orders with the time-in-force options cls, day, fok, gtc, ioc and opg. Webull accepts limit, market, stop and stop-limit orders, with day and gtc. Charles Schwab accepts limit, limit-on-close, market, market-on-close, stop, stop-limit and trailing-stop orders, with day, fok and gtc. A rule written for one broker may need changes for another. Details are on the Alpaca, Webull and Schwab guides.

DeployQuant's live safeguards deal with the execution half. Going live with real money requires the user to type a confirmation. Limit orders priced too far from the market are refused by price bands. Dollar caps apply per order and per position, and they never block an order that cuts exposure. A dry-run mode exercises the full order flow with nothing sent to the broker, and a single switch pauses one strategy. Accounting for positions and cash follows the broker's own fill reports.

Testing the rules before trading them

Backtesting runs the rules on historical data to see what would have happened. It is how an algorithm is checked before money is committed, and the backtesting entry covers it in detail. A backtest is evidence about the past. It is always in-sample for the history it used, and it does not say what will happen next.

The runs here use minute-resolution consolidated US market data and fill orders on minute bars. Trade-list prices are adjusted for splits and dividends and so sit below the quotes printed then. The headline run carries no costs. Each strategy page also has cost runs at 5 and 10 basis points.

Every decision is stored with the prices and indicator values the strategy saw at that moment, which lets a trade be traced to its reason. A person can then paper trade the strategy on the live data feed, which needs no broker, before using a brokerage account.

Writing the rules without writing code

Algorithmic trading used to mean programming. That requirement is gone for simple rules. The no-code trading entry describes building strategies from visual blocks or plain-language descriptions, with the same triggers, conditions and actions as a coded version.

DeployQuant offers three routes. The AI builder turns a plain-English description into rules a person can read and edit. Visual blocks read like sentences, for example WHEN the market opens, IF RSI(14) < 30, THEN buy. Python is offered in the industry-standard algorithm format, and each strategy can be flipped between a Blocks view and a Code view whenever the user likes. The question of whether coding is needed is answered at automating without code.

A trading bot is the running software that carries out the rules. The term overlaps with algorithmic trading, though a bot usually refers to the program and the algorithm to the logic inside it.

What algorithmic trading does not do

An algorithm does not predict the market. The strategies here use rules on past prices, and the results depend on the window. This window is 5.74 years and includes the 2022 decline, when SPY fell 18.16% in the calendar year and QQQ fell 32.39%. A different window would give different medians.

An algorithm also does not remove risk. TQQQ's buy-and-hold drawdown was -81.68% in this window, and a rule that holds it carries that risk unless the rule exits. A bad rule gets applied with the same fidelity as a good one.

The data window deserves its own mention. Every figure on this entry comes from 2021-01-04 to 2026-10-02, a stretch with one large decline for stocks and bonds and a strong recovery. The first year, 2021, returned 30.46% on SPY and the last partial year, 2026, stood at 13.77%. An algorithm tested over a calmer or a more violent stretch would show a different record, so the window should always be quoted next to the result.

Last, the results leave out taxes and the effects of real trading, such as partial fills and limit orders that never execute. Tax treatment of frequent trades varies, so a reader should check with a tax professional or broker. Live trading can lose money, including the money put in.

Frequently asked questions

What is algorithmic trading in simple terms?

It is trading by predefined rules. The rule says when to buy, when to sell and how much, and a program carries it out without discretionary judgment. The rule can be a single line, such as hold the fund while price is above its 200-day average.

Is algorithmic trading only for professionals?

No. Platforms allow retail users to build rules from visual blocks, plain English or Python, backtest them, and run them in a brokerage account. Brokers supported are Webull, Charles Schwab and Alpaca, and paper trading needs none.

Does algorithmic trading make money?

It depends on the rules, the fund and the window. In DeployQuant's tests the median CAGR of the 12 templates on 59 ETFs ranged from 0% to 6.61%, while SPY buy-and-hold reached 14.56% a year. Results are hypothetical.

Do I need to code to do algorithmic trading?

Not for simple rules. Blocks read as sentences and the AI builder writes a strategy from a description. Python is there for people who want it, and the [no-code answer](/learn/answers/automate-trading-without-coding/) goes into more detail.

How is an algorithm tested before real use?

It is backtested on historical data and then paper traded on live data. A backtest is in-sample to its history, so it is evidence about the past and not a forecast. Cost runs at 5 and 10 basis points show how fees would shift the result.

What is the difference between an algorithm and a trading bot?

The algorithm is the set of rules, and the bot is the software that runs them and places orders. A bot with a poor rule is a poor strategy applied consistently, as the [trading bot](/learn/glossary/trading-bot/) entry says.

Run a strategy that uses this yourself, free →

Build it from blocks (or type it in English), backtest it on 5.7 years of minute data in seconds, tweak any parameter, then paper trade it on live data. No card, no broker needed to start.

Related terms

No-Code TradingBuilding and deploying automated strategies through visual blocks or p…Trading BotSoftware that watches markets and places orders automatically accordin…BacktestingSimulating a strategy's rules against historical market data to estima…

Backtests are hypothetical, computed by DeployQuant's engine on minute-resolution consolidated US market data (2021-01-04 to 2026-10-02, $10,000 starting capital, no margin, no fees or slippage in the headline run; buy-and-hold puts 98% of the account in at the first open, as the templates do) and do not guarantee future results. Nothing on this page is investment advice. Live trading involves risk of loss.