Essentials

How Trading Bots Work: From Candle Close to Filled Order

How trading bots work, step by step: new candle data, rule checks, orders sent to your broker, and position management. A plain guide for algo beginners.

9 de noviembre de 2026·4 min read
Circular diagram of a trading bot loop moving from candle data to rule checks, order placement, and position management

The Short Answer

A trading bot repeats one loop: it waits for new market data, checks your rules against that data, sends an order to your broker when the rules say so, and then manages the position until an exit rule fires. If you understand each step, you'll write clearer rules and spot problems early.

Diagram contrasting a closed candle the bot acts on with a still-forming candle it ignores

Step 1: A New Candle Arrives

Most bots think in candles. A candle sums up price over a fixed period with four values: open, high, low and close. A strategy on 1-hour candles gets a fresh data point every hour.

The detail that matters most is that most rule-based strategies act on the closed candle. A candle that is still forming can look like a buy signal halfway through and then stop being one by the close. If the bot only acts on closed candles, a signal stays put once it fires, and live behavior matches the backtest more closely. The cost is that you get in a little later.

Step 2: The Rules Are Checked

The bot compares the new data with your conditions. It also tracks its state: flat, long or short. The same signal can mean different things depending on that state. Here is a simple rule set in plain language:

  • Entry: if flat and the 20-period EMA crosses above the 50-period EMA, buy.
  • Exit: if long and RSI closes above 70, or price falls 2% below the entry, sell.
  • Filter: only take entries while price is above the 200-period EMA.

The thing that breaks rules is ambiguity. A bot can't evaluate "buy when it looks oversold". It can evaluate "buy when RSI closes below 30". On algomax you write rules like these in your own words, and the AI assistant turns them into a ready-to-run bot. Our guide on how to shows how to make them precise.

Step 3: An Order Goes to Your Broker

When a rule fires, the bot sends an order through your own connected broker keys on Binance, Alpaca or OANDA. algomax never holds your funds. The order type you choose changes what happens next. A market order fills right away at whatever price is available. A limit order waits for your price and might never fill. The trade-offs are covered in .

A few things can happen between the signal and the fill:

  • Slippage: the price you get is worse than the price you saw.
  • Fees: each fill costs a little.
  • Partial fills: only part of the order executes.
  • Rejections: the order is refused, for example because the balance is too low or the market is closed.

The signal is a decision; the fill is reality. Most of the difference between backtest and live results comes from the gap between the two.

Path from trading signal to order fill showing slippage, fees, partial fills and rejections along the way

Step 4: Manage, Exit, Report

Once a position is open, the bot checks every new candle against its exits: stop loss, take profit, trailing stop or an opposite signal. Risk controls apply on top of those exits. Notifications to Telegram or Discord tell you what happened. Then the loop starts over.

StageWhat the bot doesCommon beginner issue
DataReads the new closed candleActing on unfinished candles
RulesEvaluates conditions and stateVague or conflicting rules
OrderSends it through your brokerIgnoring slippage and fees
ManageWatches exits and risk limitsNo stop loss defined
Warning

A bot does exactly what its rules say, even during news spikes or very thin markets. It knows nothing about context you didn't put into the rules.

Why This Matters Before You Go Live

Each stage of the loop has its own test. A checks steps 1 and 2 against historical candles. A small live run checks step 3 with real fills. Ongoing monitoring checks step 4. Our explains how to tell a quiet market from a bot that has silently stopped working. Trading is risky at every stage, and no setup removes that risk.

Key Takeaways

  • A trading bot repeats one loop: data, rules, order, management.
  • Acting on closed candles keeps live signals consistent with backtests.
  • Precise, measurable rules matter more than clever ones.
  • Live fills include slippage, fees and rejections, so expect some drift from backtest results.

Frequently asked questions

How often does a trading bot check the market?

Usually once per candle, when a candle closes. A bot on 15-minute candles evaluates its rules every 15 minutes, while a daily strategy checks once a day.

Why do live bot results differ from the backtest?

Live orders are affected by slippage, fees, partial fills and rejected orders that a simple backtest may not fully capture. Acting on closed candles and including realistic costs in the backtest narrows the gap but never removes it.

Does the bot hold my money?

No. On algomax, bots place orders through your own broker account using API keys you connect, and algomax never custodies funds or pools money.

Do I need to write code to define the rules?

No. You describe entries, exits and filters in plain language, in your own language if you like, and the AI assistant turns that description into a ready-to-run bot you can backtest and deploy.

Keep reading

Essentials

Strategy Hopping: Why Chasing the Hottest Bot Backfires

Dropping a bot during a rough patch and switching to last month's winner feels like active management. More often it means you eat each strategy's worst phase and miss its recovery.

3 nov 2026·4 min read
Essentials

Trading Bot Health Check: Quiet Market or Silent Failure?

No alerts can mean your strategy is patiently waiting, or that something broke hours ago. Here is how to tell the difference fast, and how to set up a baseline so silence stops being a guessing game.

29 oct 2026·4 min read