How a Trading Bot Places Orders Safely

By Catherine Ward — Partner, Secondaries & Liquidity Solutions · Published September 10, 2026 · 8 min read

A trading bot works in three steps: it reads market data, applies fixed rules to decide what it should hold, and sends orders to a broker to close the gap between what it holds and what the rules want. The part that separates a careful bot from a reckless one is the middle of that pipeline, where it checks whether an order should be sent at all. This guide walks through each step and the safety checks that sit between a signal and a real trade.

If you want the broader picture first, start with what a trading bot is. This post is about the plumbing: what happens in the seconds and hours between "the rules say buy" and "the broker confirms a fill".

Step 1: The signal

Every rule-based bot starts with a signal. A signal is the output of the strategy's rules at a point in time. For a monthly strategy it might be "hold these five stocks at these weights". For a daily strategy it might be "move everything from a growth fund into a bond fund".

A signal is not an order. It describes a target, not an action. If the target says "60% in fund A" and the account already holds 60% in fund A, nothing needs to happen. If it holds 40%, the bot needs to buy the difference.

Signals are usually computed after the market closes, using that day's closing prices. That timing matters because the closing price is final. A signal built on a price in the middle of the day could flip an hour later, while a signal built on the close stays put until the next close.

Step 2: Turning a target into orders

Once the bot has a target, it compares it with the current account. This step is often called reconciliation. The bot reads current positions and cash from the broker, works out the value of each holding, and calculates how many shares to buy or sell for each one.

A simple example, for illustration only:

  • Account value: $10,000
  • Target: 50% fund A, 50% fund B
  • Current holdings: $7,000 in fund A, $3,000 in fund B
  • Orders needed: sell about $2,000 of fund A, buy about $2,000 of fund B

Two details make this harder than the arithmetic suggests. First, sells should usually go before buys, so the cash from the sale is available. Second, the bot needs to round to whole shares (or fractions, if the broker allows them) and leave a small cash buffer so a price move between calculation and execution does not cause a rejected order.

Step 3: The pre-trade safety checks

This is the part most people never see, and it is where badly built bots cause damage. A well-designed bot asks a series of questions before it sends anything. In AlgolaneBots, every order run checks the following.

Check Question it answers What goes wrong without it
Subscription Is the customer allowed to trade real money right now? Orders sent from an account that has lapsed or never opted in
Consent Has the customer agreed to let the bot trade this account? Trades the customer never authorised
Signal age Was this signal computed recently enough to still be valid? Acting on a stale signal from days ago after an outage
9:28am New York cutoff Is there still time to place the order before the open? Orders arriving late and filling at unpredictable prices mid-session
Tradeable fund Can each fund still be bought and sold at this broker? Rejected orders, or half-finished rebalances
Split-like price gap Does a price jump look like a stock split rather than a real move? Selling or buying many times too many shares
Unique order ID Has this exact order already been sent? A network retry placing the same trade twice

Why signal age and cutoffs matter

Imagine a server goes down on Monday night and comes back on Wednesday. Without a signal-age check, the bot might wake up and send Monday's orders into Wednesday's market, where conditions may have changed completely. A careful bot refuses to act on old signals and waits for a fresh one.

The 9:28am New York cutoff does a similar job. US stock markets open at 9:30am Eastern time. Orders submitted before the open can join the opening auction. Orders that slip past the cutoff are held back rather than sent into a moving market at a time nobody planned for.

Why split detection matters

When a company splits its stock 4-for-1, the share price drops to roughly a quarter overnight, but nothing real has happened to the investment. A bot that does not know about the split sees what looks like a 75% crash. Depending on its rules, it might sell everything or try to buy four times as many shares. Checking for price gaps that look like a split, and pausing until the data is confirmed, avoids that mistake.

Why unique order IDs matter

Networks fail. A bot sends an order, the connection drops, and it never hears back. Did the order arrive? If the bot simply resends, it might buy twice. The fix is to attach a unique ID to every order. If the broker already received an order with that ID, it rejects the duplicate. In AlgolaneBots, every order has its own ID for this reason, so a retry cannot trade twice.

Step 4: Sending the order to a broker

A bot does not hold your money. It sends instructions to a broker, and the broker executes them. How that connection works depends on the market.

US stocks and funds through Alpaca

For the four US strategies, AlgolaneBots customers connect an Alpaca account (paper or live). They sign in on Alpaca's own page using OAuth, the same kind of "sign in with" flow used by many apps. AlgolaneBots never sees the Alpaca password. The permission granted lets it place trades and read positions. It cannot move or withdraw money. Real-money orders also require the customer's own AlgolaneBots password and an active subscription. More detail is in automated trading with Alpaca.

Gold through an MT5 Expert Advisor

Gold Breakout works differently. It runs through an Expert Advisor (a small program) inside the customer's own MetaTrader 5 terminal. The customer downloads the advisor, allows it to make web requests to the site, and pastes a one-time token to link it. The advisor then asks for signals and places trades with the customer's own MT5 broker. During the free trial it works on demo accounts only. The MT5 route is not offered in India or in sanctioned countries.

Step 5: Order types and fills

Once an order reaches the broker, its type decides how it fills.

  • Market order: fill as soon as possible at the best available price. Fast and nearly certain to fill, but the exact price is unknown in advance.
  • Limit order: fill only at a set price or better. Price is controlled, but the order may not fill at all.
  • Market-on-open style orders: placed before the open to fill at or near the opening price.
  • Stop orders: become market orders once the price touches a level. Used for stop-losses, including the trailing stop-loss that Gold Breakout uses.

The gap between the price you expected and the price you got is called slippage. On top of slippage there are costs: commissions, spreads and fees. Any honest test of a bot should include both. AlgolaneBots's paper account fills at the next real market open and takes 0.05% off every fill, adjusted for splits, so paper results are not flattered by perfect, free fills. We covered why this matters in paper trading slippage and costs.

Step 6: After the fill

The job is not done when the order fills. A well-built bot:

  1. Reads back the actual fills and positions from the broker, rather than assuming the orders worked.
  2. Records what happened, including partial fills and rejections.
  3. Flags anything that does not match the target, so a human can look at it.
  4. Waits for the next scheduled signal instead of trading again on the same one.

That last point is easy to overlook. A bot that re-runs its logic every few minutes on the same signal can churn an account, paying costs each time for no reason.

The kill switch

Every automated system needs an off button that works immediately and covers everything. In AlgolaneBots, the kill switch stops every broker order and tells MT5 to close its trades. It is a deliberate, blunt tool. You would use it if something looked wrong, if you wanted to step away, or if you simply changed your mind. Read why every trading bot needs a kill switch for the reasoning behind it, and see the safety overview for how it fits with the other checks.

What to ask about any bot's order process

Whether you use AlgolaneBots or anything else, these questions tell you a lot about how carefully a bot handles orders:

  • Does it hold your money, or only send instructions to a broker you control?
  • Can it withdraw funds, or only trade?
  • What happens if it misses a day? Does it act on old signals?
  • How does it avoid sending the same order twice?
  • How does it handle stock splits and delisted funds?
  • Is there a single switch that stops everything?
  • Do its paper results include realistic fills and costs?

A vendor who cannot answer these plainly is a warning sign. For more on spotting weak products, see trading bot red flags.

Key takeaways

  • A trading bot turns a signal (a target portfolio) into orders by comparing the target with what the account already holds.
  • The most important work happens before an order is sent: checks for consent, subscription, signal age, timing cutoffs, tradeable funds and stock splits.
  • Unique order IDs stop network retries from placing the same trade twice.
  • A good bot never holds your money and cannot withdraw it; it only sends instructions to a broker you control.
  • Paper results are only useful if they include realistic fills at the next open and trading costs.
  • A kill switch that stops all orders at once is a basic requirement, not a feature.

AlgolaneBots is software, not a broker or an adviser, and nothing here is a personal recommendation. Trading carries real risk of loss; see our risk disclosure.

See the order pipeline on paper first

The easiest way to understand how a bot places orders is to watch one do it with pretend money. Start a free 90-day paper trial with a $10,000 paper account, real prices and realistic costs, and see every order the five strategies would place. No card is needed, and the trial starts only when you press start.

Where the numbers come from: every strategy figure is from AlgolaneBots's own historical backtests, run on past prices with the method on how we test. Nobody earned them, and future results will differ. General market facts are checked against regulator and company sources. This guide is general information, not personal advice. Read the risk disclosure and how we write our guides.

Keep reading

Automated trading basics · 7 min read · Gregory Walsh

What Is a Trading Bot and How Does It Work?

What is a trading bot? A program that follows fixed rules to decide when to buy or sell, then sends orders to a broker. Here is how one works, step by step.

Automated trading basics · 7 min read · Priya Sharma

AI Trading Bots: What They Really Do

What does an AI trading bot really do? Most use fixed rules or machine learning on past prices. Learn the difference, the overfitting risk and what to check.

Automated trading basics · 8 min read · Daniel Kowalski

Algo Trading Explained: How It Works

Algo trading means a computer places trades by rules written in advance. Learn how it works, the main strategy types, the real risks and how to test it.