How Do Trading Bots Work?
A step-by-step look at how a trading bot goes from a market signal to a placed order — indicators, decision logic, risk sizing, and execution.
A trading bot's job breaks down into four sequential steps that repeat continuously: read the market, decide, size the position, and execute. Understanding this pipeline makes it much easier to evaluate any bot, regardless of the specific strategy it uses.
Step 1 — Reading the market
The bot pulls in price data — typically open, high, low, close values for each bar on its chosen timeframe — and computes any indicators its strategy depends on: moving averages, RSI, Bollinger Bands, ATR, or custom calculations like a Donchian channel high/low.
Step 2 — Generating a decision
The bot compares current indicator values against its rules to determine whether a trade signal exists: a crossover has just occurred, an oversold threshold has just been crossed, price has just broken out of a range. Most well-built bots require the signal to occur on a freshly closed bar, not mid-formation, to avoid acting on incomplete data.
Step 3 — Sizing the position
Before placing a trade, the bot calculates position size — almost always based on a fixed percentage of account equity at risk, combined with the distance to its stop loss. A bot risking 1% of a $10,000 account with a 50-pip stop loss will trade a different position size than the same bot on a $50,000 account, or with a 100-pip stop.
Step 4 — Execution and management
The bot sends the order to the broker with a stop loss and take profit attached, then continues monitoring: some bots manage open trades actively (trailing stops, partial closes), while others simply let the stop loss or take profit resolve the trade. Throughout, the bot typically checks it hasn't exceeded a maximum number of concurrent open positions before adding a new one.