The phrase "AI trading bot" can sound mysterious, as if a clever machine simply knows where prices are going. In practice, almost every trading bot is a chain of fairly ordinary steps: collect data, turn it into a few measurements, decide whether a condition is met, apply some rules, and, in real systems, send an order. This guide walks through each link in that chain in plain language, and shows a tiny worked example you can follow with a calculator.

Nothing here is advice to trade. The aim is to help you recognise the moving parts, so you can ask better questions about any tool you meet.

The six-step chain at a glance

Here is the whole pipeline in one table. Each row feeds the next one.

StepWhat it means in plain wordsA simple exampleWhat can go wrong
1. DataThe raw numbers the system readsDaily closing pricesGaps, errors, or data that arrives late
2. FeaturesMeasurements calculated from the dataA 3-day average priceA measurement that looked useful only by chance
3. SignalA yes/no or a score built from features"Price is more than 1% above its average"Signals that flip on and off too often
4. RulesWhat to do when the signal appears, and how much"Use at most 10% of the account"Rules that ignore costs or bad days
5. OrdersInstructions sent to a broker (real systems only)"Buy 9 units at market"The price you get differs from the price you saw
6. LimitsHard stops that override everything else"Exit if price falls 3% below entry"Limits that are never tested, or switched off

The "AI" part, when there is one, usually lives in steps 2 and 3. A model might learn which features matter or combine them into a score. Everything around it, especially the rules and limits, is still written and chosen by people.

Step 1: Data, the raw material

Data is the information the system reads. For a beginner example, think of one closing price per day. Real systems might also read trading volume, news headlines or economic releases.

The quality of everything downstream depends on this step. If a price is missing, recorded twice, or arrives after the moment it was supposedly used, the rest of the chain is working with a distorted picture. That last problem has a name, look-ahead bias: accidentally using information that would not have been available at the time.

Step 2: Features, turning numbers into measurements

A feature is a measurement calculated from the data. A common one is a moving average, the average of the last few prices, recalculated each day as the window moves forward. Others include how much prices have moved recently, or how today's price compares with the recent range.

Features are where many systems quietly go wrong. If you test enough measurements on the same history, a few will look impressive purely by luck. A useful habit is to ask: would I expect this measurement to matter before I saw the results?

Step 3: Signals, from measurement to decision

A signal turns one or more features into a decision-ready answer. It can be a simple yes/no ("price is above its average") or a score from 0 to 1 produced by a model.

This is where people imagine the "intelligence" lives. Even a sophisticated model only produces an estimate based on patterns in past data. The U.S. Commodity Futures Trading Commission puts it bluntly in its advisory on AI trading bots: AI technology can't predict the future or sudden market changes. A signal is a hint, not a forecast you can rely on.

Step 4: Rules, deciding what to actually do

Rules translate a signal into an action. They answer questions like: How much do I buy? When do I sell? What if two signals disagree? A rule about how much to buy is called position sizing.

Rules are less exciting than signals, but they often matter more. Two systems with the same signal can produce very different results because one risks 2% of the account per idea and the other risks 50%.

Step 5: Orders, where real systems meet the market

In a real trading system, the final decision becomes an order, an instruction sent to a broker. The SEC's investor education site explains the two most common kinds. A market order asks to buy or sell immediately; it is meant to be executed, but it does not guarantee the price. A limit order sets a price or better, so it protects the price but may not be filled at all.

This is the point where a simulation and reality part ways. On a screen, you "buy at 105". In a live market, the price you actually receive can be different, and costs are subtracted.

Step 6: Limits, the brakes that override the engine

Limits are rules that win over every other rule. Examples include a maximum loss per position, a maximum loss per day, or a cap on how many trades can happen in an hour. A stop-loss is a limit that exits a position if the price falls to a set level.

Good limits are boring and strict. They exist for the days the signal is wrong, which will happen. A system without tested limits is like a car with a powerful engine and untested brakes.

A tiny worked example you can check by hand

All numbers below are illustrative, not market data. Imagine a paper account of 10,000 and these six daily closing prices:

DayClose3-day averagePrice vs averageSignal (more than 1% above?)
1100n/an/an/a
2101n/an/an/a
3103101.33+1.6%On
4102102.000.0%Off
5105103.33+1.6%On
6107104.67+2.2%On

Now apply the chain:

  1. Data: six closing prices.
  2. Feature: the 3-day average, for example on day 5: (103 + 102 + 105) ÷ 3 = 103.33.
  3. Signal: day 5's price is 1.6% above its average, so the signal is "on". Notice it was also on at day 3 and switched off at day 4. That flickering is common and costly.
  4. Rules: use at most 10% of the account. 10% of 10,000 is 1,000; at 105 per unit, that is 9 units (945).
  5. Order (real systems only): a market order for 9 units. If the actual fill came in at 105.20 instead of 105, the cost rises by 1.80 before any fees.
  6. Limit: exit if the price falls 3% below entry, at 105 × 0.97 = 101.85. The most this position can lose, before costs and assuming the exit price is reached, is about 28.35.

If the day-3 signal had also been acted on, the system would have bought and sold almost immediately, paying costs twice for no gain. This is why rules about how long to wait, and how often to trade, matter as much as the signal itself.

Where the limits of any bot really lie

Every step above carries assumptions. An investor alert from the SEC and FINRA on automated investment tools makes a point that applies here too: a tool may rely on assumptions that are wrong or that do not react to shifts in the market. A moving-average rule assumes trends persist. When the market switches to moving sideways, the same rule can produce a string of small losses.

That is why the most useful question about any ai trading bot is not "how smart is it?" but "what does it assume, and what happens when that assumption breaks?" If you want to see that break happen safely, the "When the market changes" lesson in the interactive lab lets you watch one rule move from a trending to a sideways synthetic market. Our guide on reading a strategy chart covers how to judge the results without reading too much into them.