An algorithm is a trading rule a computer follows exactly. What retail algorithmic trading is, the strategy families, the steps from an idea to a live strategy, one rule written three ways with a real year of results, the tools at each skill level, and what research says about profits.
November 15, 2026
18
min to read
The short answer
Algorithmic trading means a program follows exact rules to decide when to buy and sell, and usually places the orders too. To start, write one simple rule, backtest it with costs, test it on data it hasn’t seen and on paper, then run it small and watch it. An algorithm makes a rule consistent, not profitable.
Algorithmic trading means letting a program make trading decisions from rules you wrote, and usually place the orders as well. The SEC’s staff open their 2020 report to Congress on algorithmic trading with the computer-science meaning of the word: an algorithm is “a finite, deterministic, and effective problem-solving method suitable for implementation as a computer program.” In trading, the problem is the one every trader solves by hand: what to buy or sell, when, how much and at what price.
The rules can be simple. “Buy when the price closes above its 50-day average, sell when it closes below” is an algorithm. So is “split this order into 20 pieces over an hour,” which is how a large fund buys without pushing the price up; that kind is called an execution algorithm. This guide is about the first kind, strategy algorithms that decide when to be in the market. You will also see the term automated trading, which stresses the second half of the job: the computer sends the orders, so the rule keeps working while you sleep. Most retail tools do both. In copy trading, by contrast, the orders are automatic but the decisions are another trader’s. Fixed-rule algorithms are one corner of AI trading as a whole; the others use a model’s live judgment instead of code written in advance.
The algorithms in the news are high-frequency trading, or HFT. The SEC report notes that for more than ten years most activity in US stock markets has come from professional traders running short-term strategies that send a high number of orders every day. It lists five traits typical of HFT firms:
None of that is open to you, and none of it is needed. A retail algorithm competes on something else. It follows a tested rule every single time, usually on hourly or daily price bars, holding for hours or weeks, without getting tired, greedy or scared. You give up speed and gain consistency.
Most rules belong to one of six families. The first four suit a beginner’s tools. The last two are mostly a contest of speed and capital.
| Family | The idea | What it needs | Where it struggles |
|---|---|---|---|
| Trend following | Own a market while it rises and step aside when it turns, using a moving average or a price channel | Markets that trend for weeks, and patience through many small losses | Sideways, choppy markets, where it buys and sells for small losses again and again |
| Mean reversion | Buy after a sharp drop and sell after a sharp rise, expecting a return toward the average (RSI, Bollinger Bands) | Markets that move within a range, and a stop for the drops that keep going | Strong trends, where oversold gets more oversold |
| Breakout | Enter when the price leaves a recent range, such as a new 20-day high | Quiet stretches followed by bigger moves, and quick exits when a breakout fails | False breakouts that turn straight back |
| Momentum rotation | Hold the strongest few markets of a basket and rotate on a schedule | A basket of markets and regular rebalancing | Sharp turns, when last month’s leaders become this month’s laggards |
| Arbitrage | Buy and sell the same or linked assets in two places to capture a price gap | Speed, money on several venues and very low costs | Gaps that close in a fraction of a second, mostly to professionals |
| Market making | Post buy and sell orders around the price and earn the spread between them | Low latency, fee rebates and control of the inventory you build up | Fast moves, when your orders fill on the wrong side |
Trend and momentum are among the most studied effects in finance. Tobias Moskowitz, Yao Hua Ooi and Lasse Pedersen found “time series momentum,” the tendency of a market’s returns over the past 1 to 12 months to persist, in each of the 58 liquid futures markets they studied: stock indices, currencies, commodities and bonds (Journal of Financial Economics, 2012). Narasimhan Jegadeesh and Sheridan Titman showed that buying stocks that had risen and selling those that had fallen earned significant returns over the following 3 to 12 months (Journal of Finance, 1993). Two cautions travel with those results: they are averages over long histories, and published patterns tend to weaken once many people trade them, as the steps below explain. Our guide to quantitative trading tests a published crypto momentum signal on Hyperliquid data.
If you trade on Hyperliquid, our guide to six automated setups traders use covers specific ones in more depth.
Eight steps, in this order. Each one catches a mistake the others miss.
Write one sentence on why it should work and who is on the other side of the trade. “Prices that break out of a long range tend to keep going for a while” is an idea; “the chart looks bullish” is not.
The market, the timeframe, the entry, the exit, the stop, the position size and the moment each order goes in. A computer does exactly what you wrote, including the parts you meant differently. The prompt below helps.
Use the same venue and timeframe you plan to trade. Crypto exchanges publish candles through free APIs; Hyperliquid’s needs no key. For stocks, use prices adjusted for splits, and a list of companies that includes the ones later delisted.
Run the rule over the past, charge fees and slippage on every fill, and compare the result with buying and holding. Our guide on how to backtest a trading strategy covers the method and its traps.
Run the unchanged rule on a later period or on other markets. Then run it on live prices with simulated money, which is called paper trading. A paper test can’t peek at the future, because the future hasn’t happened yet. Our guide to paper trading crypto lays out a 30-day plan.
Use the smallest size the venue accepts that still lets every trade go through, and compare each real fill with the price the backtest assumed.
Read the trades and the logs every day at first. Decide how you will switch it off if it misbehaves before it ever does.
Write down what ends it, such as a drawdown well past the worst one in testing, or a losing run the backtest never showed. Patterns fade: R. David McLean and Jeffrey Pontiff found that portfolios built on 97 published stock-return predictors earned 26% less out of sample and 58% less after the research was published (Journal of Finance, 2016).
Here is my trading idea: [describe it in a sentence or two]. Rewrite it as rules a computer could follow with no judgment calls: the market, the timeframe, the entry condition, the exit condition, the stop, the position size, and the moment each order is placed (for example, at the next bar’s open). List every piece of data each rule reads, and flag any rule that would need information that isn’t available at the moment of the trade.
Here is a classic trend rule written three ways. All three say exactly the same thing.
At each daily close, if Bitcoin closed above its average close of the last 50 days, own it until the next close. If it closed below, hold cash.
With the pandas library and a file of daily prices:
import pandas as pd
# daily prices, oldest first
df = pd.read_csv("btc_daily.csv")
close = df["close"]
# the 50-day average of the closes
avg = close.rolling(50).mean()
# True on days that close above it
above = close > avg
# act a day later: no peeking
on = above.shift(1, fill_value=False)
# each day's move, close to close
move = close.pct_change().fillna(0)
# earn the move only while in
rule = move.where(on, 0.0)
print((1 + rule).prod() - 1)
The line that matters most is the shift. It makes the program act on the day after each signal, the way you would have to in real life. Run on the Bitcoin prices used below, this prints about 0.17, a 17% gain before costs.
Ethy knows indicator names such as SMA, the simple moving average, so the sentence can be this short:
We ran it on daily prices of Bitcoin’s perpetual futures contract on Hyperliquid, from November 28, 2025, the first day with a 50-day average in our data, to November 13, 2026. Every buy and every sell paid 0.1% to stand in for fees and slippage. Funding, the periodic payment between buyers and sellers of perpetual futures, is left out.
Delete the shift line and use the signal directly, and the program earns each day’s move whenever that same day closed above its average. In real life you only know that once the day is over, after the move has happened. The program is buying at yesterday’s close with today’s close already in hand. This is called look-ahead bias, and it is an easy bug to write and a hard one to see, because the result looks better, not broken.
On Bitcoin, the version with the bug shows +82.1% instead of +14.9%, from the same signals arriving one day early. Here is the same comparison on ten markets from the same data, every one with more than seven months of daily prices:
| Market | The rule, written correctly | The rule with the bug | Buy and hold |
|---|---|---|---|
| Bitcoin | +14.9% | +82.1% | −24.8% |
| Ether | +24.2% | +72.0% | −36.3% |
| Solana | −15.3% | +104.1% | −43.1% |
| HYPE | +48.3% | +442.6% | +104.9% |
| NVIDIA (xyz:NVDA) | −15.2% | +77.0% | −13.9% |
| Tesla (xyz:TSLA) | −29.7% | +67.6% | −14.2% |
| XYZ100 index (xyz:XYZ100) | −4.9% | +54.7% | +9.4% |
| Gold (xyz:GOLD) | −6.8% | +16.2% | −22.8% |
| S&P 500 (xyz:SP500) | −8.7% | +11.2% | +2.4% |
| WTI crude oil (xyz:CL) | 0.0% | +132.3% | +32.6% |
Each test starts on the first day the market has 50 daily closes in the data (November 28, 2025 for Bitcoin, Ether, Solana and HYPE; December 1, 2025 for XYZ100; December 31, 2025 for NVIDIA; January 1, 2026 for Tesla; February 9, 2026 for gold; February 24, 2026 for crude oil; May 6, 2026 for the S&P 500) and ends on November 13, 2026, with 0.1% charged on every buy and every sell. XYZ100 is trade.xyz’s XYZ U.S. 100 Index, which is not the Nasdaq-100.
With the bug, the rule “made money” on all ten markets, as much as +442.6% on HYPE. Written correctly, it made money on three and beat buying and holding on four. Same rule, same data, one line of code. When a backtest looks too smooth, check for this before anything else. Our backtesting guide lists the other ways a test can flatter a rule.
Pick by how much you want to build yourself. Each of these can run a rule like the one above on the markets it covers; they differ in what you write, where the rule runs and what they assume for you. Details as of November 15, 2026, from each tool’s own site.
| You write | Tool | What it does well | Watch out for |
|---|---|---|---|
| Python | backtrader | A long-standing open-source framework for backtesting and trading, with live connections to Interactive Brokers and Oanda | No new release on PyPI since version 1.9.78.123 in April 2023 |
| Python | vectorbt | Runs on pandas and NumPy, fast enough to test many thousands of variants in seconds | Speed invites testing too many variants; the paid PRO edition adds leverage, limit orders and parallel runs |
| Python or C# | QuantConnect LEAN | An open-source engine under the Apache 2.0 license for backtesting and live trading, which you can run on your own machine | QuantConnect’s free cloud plan includes unlimited backtesting but not live trading |
| Nothing: a visual editor or AI | Composer | Stock and ETF strategies built with AI or a no-code editor, backtested, then traded and rebalanced automatically | It is also your broker (Composer Securities); plans of $0, $10 a month and $32 a month billed yearly |
| Nothing: if-then rules | Coinrule | Rules such as “if RSI is under 30, buy” across 25-plus crypto exchanges, blockchains and stock brokers, with a demo mode on virtual funds | Paid plans from $29.99 to $449.99 a month |
| Nothing, or Pine Script | TradingView strategy tester | Built-in and community strategies on its charts, or your own in Pine Script, its language | Strategies simulate trades; to trade for real, alerts must reach a broker or service, for example by webhook |
| Plain English | Ethy | Describe the rule; it backtests the exact version that would run, then runs it live or on paper | Hyperliquid perps, plus spot tokens only; no cross-market or news triggers; backtests leave out funding |
For more tools, see our comparison of the best AI trading bots.
Ethy is an AI trading agent. You describe a rule the way you would to a person, and Ethy turns it into rules you can preview, backtests the exact version that would run, and can optimize its settings, ranking them on one stretch of data and checking each on a stretch it held back. Then you run it live, or in paper mode on live prices with no money moving.
Ethy is software for research and analysis. It doesn’t give investment advice.
Four things cost money or time:
Look-ahead bias, shown above, comes first. The others, briefly, with where to read more:
For a few people, sometimes. For most individual traders, the evidence says no, and putting a rule into code doesn’t change that by itself. Three large studies of individual traders:
Read together: algorithms are where the professional profits are, and the firms that earn them have speed, scale, data and costs that a beginner’s script doesn’t. Patterns that become known get traded away, as McLean and Pontiff found. What an algorithm reliably gives you is narrower, and still worth having: a rule that runs the same way every time, stops that fire without hesitation, and the chance to test an idea before it costs you money.
Yes. Composer builds stock and ETF strategies with AI or a visual editor and trades them; Coinrule builds if-then rules for crypto exchanges and some stock brokers; TradingView runs built-in strategies on its charts; and Ethy turns a rule you describe in plain English into a backtested automation. You still need exact rules: a no-code tool removes the syntax, not the thinking.
Nothing to begin: writing rules, backtesting and paper trading are free on several tools. For live trading, venues set minimum order sizes, and costs weigh more on a small account that trades often. Start with an amount you can afford to lose entirely, and add more only after the live results look like the ones you tested.
For most retail traders, Python, because of its libraries (pandas for data, backtrader and vectorbt for testing) and the number of examples online. QuantConnect’s LEAN engine runs Python or C#, and TradingView uses its own language, Pine Script. Languages chosen for raw speed matter to high-frequency firms, not to rules that trade on hourly or daily bars.
No. High-frequency trading is one kind of algorithmic trading: professional firms with very fast systems, servers next to the exchange and positions held for very short periods. A retail algorithm usually trades on hourly or daily bars and holds for hours to weeks. It can’t compete on speed, and it doesn’t need to.
Long enough to see a fair number of trades and more than one kind of market, so you can compare the fills and results with the backtest. For a rule on daily bars that can take months; for one on hourly bars, weeks. If paper results differ a lot from the backtest, find out why before you put money in.
Yes, on Hyperliquid perps, plus spot tokens: describe the rule, backtest it, then run it live or in paper mode on Ethy’s servers. The free plan includes 500 credits once, two live and two paper automations that run for 30 days, and backtests on the shortest window of each timeframe. Paid plans cost $15 a month (Core), $59 (Pro) and $179 (Max).
Trading involves risk, including the loss of your money. Ethy AI is a research and trading tool and does not give investment advice or recommendations. Backtests are simulations on historical data and do not predict future results.
Deploy your AI trading agent in one click.
