Tutorials Get the App

Home · Learn · Algorithmic trading

What Is Algorithmic Trading? How Algorithms, Quant Models and AI Trade

Updated November 22, 2026 · By Moby

Algorithmic trading uses a precise set of rules, written as code, to decide when to buy or sell and how much. The rules can be simple, such as a moving-average cross, or statistical models built by quant teams. AI can help write, test and run those rules, but it does not make a rule profitable.

What algorithmic trading is

Algorithmic trading is a rule you could hand to a stranger, written tightly enough that software can follow it without asking what you meant. The rule says when to buy, when to sell, and how much. A moving-average cross is a small version. A statistical model built by a quant team is a large version. Both are algorithms if the steps are fixed before the trade.

The Wikipedia page on algorithmic trading is a background definition. It is not a track record and it is not a shopping list. This page uses that plain meaning, then looks at common shapes, at where AI fits, and at what a few small trades cost once fees are in the sum.

Automated trading is the wider word. A limit order you typed is automated, because software waits and sends it. It is not algorithmic unless a coded rule decided the price and the size. If you picked the numbers and the software only waited, you automated a human decision. If the code picked the numbers, you ran an algorithm. The line matters when a vendor says "the algorithm" and the only real rule is your finger.

How a trading algorithm decides

A useful algorithm has four lines even if the code is long. What data it may read. What condition counts as a signal. What size it may send. What ends the trade. If one line is missing, a person is still making that call in the moment, and the software is a keypad.

The data line is where quiet mistakes live. Price is real. Volume can be painted. An algorithm that treats volume as proof of demand will treat a fake tape as proof. That failure mode is the subject of Solana volume bots. A model does not know a print is fake unless you told it how to check, and many rules never check.

The size line should be cash you actually have. The worked example below uses only the cash in the example. It does not borrow, and it does not stack a second position on top of the same dollars. If a pitch needs borrowed money to make the percent look large, this page is not that pitch.

The exit line is the one people leave blank. An entry condition without an exit is a suggestion. Code that only knows how to get in will stay in until a person panics. Write both sides, or do not call it an algorithm.

Common shapes, including the ones with Moby pages

Names vary. The shapes repeat. A momentum rule buys after price has already moved and sells when the move stalls. The momentum agent page describes that shape. A mean-reversion rule bets that a stretch away from a recent average will fade. The mean-reversion agent page describes that one. They contradict each other. Both can be coded. Both can lose. The market does not owe you the regime your code expects.

An arbitrage rule looks for the same asset at two prices and tries to buy the cheap one and sell the rich one. The arbitrage agent page is that idea in agent form. The gap is often smaller than the two fees. If you cannot write the gap, the fees, and the time you have to act on one line, you do not have an arbitrage. You have a rumor of a price difference.

A grid places orders above and below a price and hopes the market chops. The grid trading agent page covers it. Grids look smooth in a range and accumulate inventory in a trend. That is not a bug in the code. It is the rule, followed faithfully, in the wrong weather.

More shapes sit on the agent strategies index. Read them as rule descriptions. None of them is a claim that the next month will resemble the chart in your head. An AI trading bot can host any of these rules. Hosting the rule is not the same as the rule having an edge.

Where AI and quant models fit

A quant model is an algorithm whose condition is a statistical estimate: a relationship fit on past data, with a size that follows from that estimate. AI can help in three clerical ways. It can draft the code from a sentence you wrote. It can point at a missing exit. It can summarize a log after the fact. Machine learning for trading is the longer version of how those models fail when they memorize one path.

AI does not make a rule profitable. A fluent explanation of a moving-average cross is still a moving-average cross. If the cross has no edge after fees, better prose will not create one. No AI can predict markets. The CFTC press release of January 25, 2024, Release 8854-24, says AI technology cannot predict the future. Treat a page that skips that sentence and jumps to a profit curve as a sales page.

There is a legal boundary around this too, and it is narrow. EU Directive 2014/65/EU Article 17 sets algorithmic-trading requirements for investment firms. Not legal advice. Those words are about firms, not a permission slip for a retail script. The retail questions are on is AI trading legal.

Worked example: three signals on $200 of cash

Assumed numbers for the math, not a quote and not a price call. Example, not a recommendation. The account uses only the cash in the example, $200, and it is flat between signals. Three signals arrive. The first finishes 4% higher, so the position would be worth $208 before fees. The second finishes 2% lower, so $196. The third finishes 1% higher, so $202. Nothing here says these moves will happen. They are the inputs to the fee arithmetic.

Each entry is a market swap large enough that 0.75% is $1.50, above the $0.90 minimum, so the entry fee is $1.50 each time. The exits are $1.56, $1.47, and $1.515, which is 0.75% of $208, $196, and $202. Limit, take-profit, stop-loss and DCA fills are 0.75%. is a different path. This example is the swap path, so the minimum could have bound on a smaller ticket. It does not bind at $200.

Nets, after those fees and before onchain fees: the 4% signal nets +$4.94 (an $8 gross gain minus $1.50 and $1.56). The 2% loss nets -$6.97 (a $4 gross loss plus $1.50 and $1.47). The 1% gain nets -$1.02 (a $2 gross gain minus $1.50 and $1.515). Add them: -$3.05. The gross moves added to +$6.00. The fees took the gross and more. Round trip cost is about 1.5% of the $200 each time, and three trips were enough to erase a handful of small wins.

SignalGrossEntry feeExit feeNet
+4%+$8.00$1.50$1.56+$4.94
-2%-$4.00$1.50$1.47-$6.97
+1%+$2.00$1.50$1.515-$1.02
Total+$6.00$4.50$4.545-$3.05

This is why a backtest that reports the gross and hides the fee is not a test. Two wins and one loss felt fine in the story. The cash finished down. Swaps and agent market trades pay 0.75% with a $0.90 minimum per swap. Limit, take-profit, stop-loss and trailing orders pay a flat 0.75% with no minimum. Onchain fees apply too. A 0.75% swap fee (minimum $0.90 per swap), plus onchain fees. Fees on your agent's trades earn up to 10% cashback in USDC. It is not a discount on the swap fee.

How to test before the code trades

Write the rule in one sentence, including the exit and the size. Put fees in the test at 0.75% each way, or the $0.90 minimum when the ticket is small. Hold out a stretch of data the rule was not tuned on. If you only have a chart you stared at until it looked good, you do not have a test.

A browser rehearsal is the backtest demo. The traps, including a rule that quietly saw the future bar, are on backtesting with AI. If you want the orders on paper before they are real, use crypto paper trading. If you want to see the shape of the code, build a trading bot in Python is the coding page. Code that runs is still not code that has an edge.

You set your agent's per-trade and daily spending limits and market-cap range; Moby blocks red-rated tokens. Limits are only as tight as you set them. Sells and exits skip the market-cap and safety checks, and tokens with no safety rating are not blocked. Turn on Ask before every trade and your AI asks you first. Moby does not hold or approve trades. Rate limits protect against runaway loops and scale with the fees your agent pays; you set the spend limits. An algorithm in a loop can send orders faster than you can read them. The rate limit is a seatbelt. The spending cap is the actual budget. Set both before you connect anything that can click.

Running a coded rule with an agent

One agent per user, with its own wallet. Agents trade Solana tokens only. The agent cannot withdraw, transfer or send funds. Moby does not run a schedule for your agent; the schedule lives in your AI client. Your resting orders (limit, take profit, stop loss, trailing stop, DCA) keep working on Moby even when your app is closed. AI Trading and copy trading currently need an access pass in the app. Supported hosts: Codex, Claude Code (CLI), Gemini CLI (with a paid Gemini API key or enterprise access) and Grok CLI. ChatGPT: works on Business, Enterprise and Edu workspaces that allow custom MCP servers (web). The agent can help you write and watch the rule. It cannot supply the edge. Agentic trading is the connection if you still want one after you have priced a round trip. Download Moby for the app. If the sentence you hand the agent is vaguer than the four lines at the top of this page, do not let it trade. Ask it to rewrite the sentence until the exit is obvious.

How to read a week of signals

Count round trips, not opinions. Sum the fees in dollars. Sum the gross moves. If the gross is positive and the net is negative, you do not have a mystery. You have the worked example. If the gross is negative too, the rule and the fees are both against you, and no amount of cleaner code fixes the condition.

Then ask one qualitative question. Did the week match the regime the rule expects? A mean-reversion rule in a runaway trend will buy every dip and finish with inventory. A momentum rule in a chop will buy every false start. Firing correctly in the wrong regime is still a loss. Turn the rule off, or narrow the hours it is allowed to run. Do not "fix" it by doubling size so the next win covers the hole. That is how a small algorithm becomes a large loss.

Keep the cash constraint visible. The example used $200 and was flat between signals, so one loss could not borrow against the next idea. If your real log shows two positions open on the same cash, you have left the example and you have left the rule you wrote. Close one, or rewrite the size line until it fits the wallet you actually have.

Frequently asked questions

What is algorithmic trading?

Algorithmic trading uses a precise set of rules, written as code, to decide when to buy or sell and how much. The rule can be a moving-average cross or a statistical model. Software then follows those steps. A vague hunch you still click by hand is not an algorithm.

Is a limit order algorithmic trading?

A limit order is automated, because software sends it when price arrives. It is algorithmic only if code chose the price and the size. If you chose both and the software only waited, you automated your own decision. The wider idea is on the automated trading page.

What strategies do trading algorithms use?

Common shapes are momentum, mean reversion, arbitrage, and grids. Each has a Moby strategy page linked above. They assume different markets, and they can all lose when the market does not match the assumption. A name is not an edge.

Can AI make a trading algorithm profitable?

No. AI can draft code, point out a missing exit, and summarize a log. It does not create an edge, and no AI can predict markets. A clear write-up of a weak rule is still a weak rule. Fees can erase small gross wins, as the example shows.

Why did three winning-looking signals finish down?

In the example the gross moves summed to +$6.00 and the nets summed to -$3.05. Two of the three signals were up, but the round trip cost about 1.5% of $200 each time. The middle loss was large enough, after fees, to sink the total.

Is algorithmic trading legal?

Using a rule in your own account is generally legal when the trades themselves follow market rules. EU Directive 2014/65/EU Article 17 sets algorithmic-trading requirements for investment firms. Not legal advice. Read the legal page before you trade anyone else's money.

How do I test an algorithm before it trades?

Put fees in the test, hold out data you did not tune on, and paper trade until the exits make sense. A chart you stared at until it looked good is not a test. The backtest demo and the paper trading page are the two rehearsals. Then go live small.