Tell us how you trade and we'll point you to the right research segment.
Talk to Our Team →Start with our beginner-friendly guides on market basics, order types, and risk management before you place your first trade.
Start Learning → Browse All Articles →Automation pitfalls in algo execution are mostly about plumbing, not strategy: orders sent twice, prices that are stale, legs that fill unevenly, and loops nobody can stop. A sound strategy can still lose money through these faults. Knowing each failure by name, and building a switch for it, matters more than refining entry rules.
Short answer
Most algo losses come from execution faults rather than bad ideas: duplicate or rejected orders, stale quotes, partial fills, dropped connections and loops with no stop. The defence is layered limits, a manual kill switch, reconciliation against the broker’s position book and a small-size live trial first.
TL;DR
Key points
Retail traders who move from manual to automated trading usually spend months on signal logic and an afternoon on everything else. That ratio is backwards. The signal decides what you want to do; the execution layer decides what actually happens, and the gap between the two is where unexplained losses live.
This article walks through the day in order: before the open, at the open, during the session and after the close. Each stage has failures that are specific to it, and each has a matching protection. If you are new to the whole topic, start with the beginner’s overview of algo trading and come back.
Many incidents are born overnight. A contract rolled, a lot size was revised, a symbol changed its format, a holiday shifted the calendar. The code still runs, but it runs on yesterday’s world.
Watch out
A system that starts cleanly and shows no errors is not necessarily healthy. It may simply have no idea that the world changed. Print the contract, quantity and starting position at startup and read them every morning.
The first minutes of the session combine the widest spreads, the fastest price changes and the heaviest message traffic. A system that was well behaved at midday can misfire here.
Market orders sent into a thin opening book can fill far from the last seen price. Strategies that rely on a prior close as their reference can also misjudge a gap, as explained in our piece on how opening prices are discovered. A common protection is simply to forbid trading for a fixed window after the open and let the book settle.
Worked example
A trend-following script is coded to buy when price crosses above yesterday’s high. On a gap-up morning the first tick is already above that level. The script fires instantly with a market order and fills at the poorest price of the session. A cooling-off window, plus a limit price tied to a maximum allowed slippage, would have turned a bad fill into a skipped trade.
Related: Options Tips for Managing Slippage in Order Execution
Mid-session faults are the ones people picture when they hear the phrase runaway algorithm. They tend to fall into a handful of repeatable patterns.
| Failure | What happens | Typical protection |
|---|---|---|
| Duplicate orders | A retry after a slow response sends the same order twice | Unique order tags and an idempotency check |
| Stale quotes | Data feed freezes, logic acts on old prices | Timestamp check; halt if data is older than a limit |
| Partial fills | Only some quantity executes; the rest hangs | Track filled quantity, cancel or complete explicitly |
| Rejected legs | One leg of a spread is refused, leaving naked risk | Send protective legs first; verify all legs |
| Infinite loop | Exit triggers re-entry, re-entry triggers exit | Cap orders per minute and per day |
Common misreading
Retrying a failed request without checking whether the first attempt actually reached the exchange is how duplicate positions are born. A timeout does not mean the order was not placed.
Spreads and hedged positions depend on every leg arriving. If the hedge leg is rejected for margin or price reasons while the main leg fills, you hold an unintended directional position. Read how this plays out in our guide to basket orders, then design your own code to verify each leg’s final status before moving on.
Connections fail at inconvenient times because volatile moments also stress networks and gateways. If your system loses its link while holding positions, it cannot adjust a stop or exit. That is a risk you can reduce but not remove.
Reduce the exposure
Accept what remains
The principle is that automation should degrade gracefully. If the code disappears, resting orders at the broker should still limit damage. This is closely related to the idea of GTT orders, which live outside your own program.
A kill switch is a mechanism that stops all new orders and, if you choose, flattens positions, regardless of what the strategy thinks. It must work even when the strategy is confused, so it cannot depend on the strategy’s own logic.
Write the limits down before you go live, not after the first scare. Choosing them while emotional tends to produce numbers that are too loose. If you want a framework for the limits themselves, see drawdown management.
Related: Algo Trading for Beginners: From Idea to Live System
Not every fault lives in the order path. Sometimes the strategy is fed bad inputs and does exactly what it was told. These errors are subtle because every component reports success.
Watch out
Two indicators with the same name can give different values on different platforms because of small differences in smoothing or bar construction. Validate your live calculation against a trusted reference before trading it.
A good habit is a sanity layer between data and logic. It rejects readings that violate simple rules, such as a price outside the day’s allowed band, and raises an alert instead of acting. Understanding how circuit bands work, as covered in circuit limits and trading halts, helps you write those rules.
Automation does not remove psychology; it moves it. Instead of fearing the next entry, the trader now fears the next bug, or worse, stops fearing anything because the machine seems calm.
| Behaviour | Why it is risky | Better habit |
|---|---|---|
| Editing live code mid-session | Untested changes meet real money | Change only after the close, test in a sandbox |
| Overriding the system on a hunch | Breaks the statistics you are measuring | Log overrides and review them honestly |
| Ignoring repeated warnings | Alerts become background noise | Keep few alerts, each requiring action |
| Assuming silence means safety | Dead feeds also look quiet | Send a heartbeat message and alert when it stops |
Every modification, however small, should be recorded with the date and reason. When behaviour shifts a week later, the log is the first place to look. Without it, you are debugging from memory.
The same discipline that supports a trading journal applies here: write down what changed and what you expected, then compare with what happened.
Related: Sensex Trading Complete Guide: A Five-Stage Roadmap
The session ending does not end the work. Compare what the strategy believes it did with what the broker’s records say it did. Discrepancies, even small ones, are early warnings of a deeper fault.
Why this matters
A day that ends in profit can still hide a serious bug. Reconcile every day, especially the good ones, because nobody investigates a profit.
The final protection is procedural. Move from backtest to paper trading, then to the smallest live size, and only scale after a run of days where reconciliation is clean. Our article on paper trading discusses how long a trial period should last and what to measure in it.
Worked example
A trader finishes a backtest and wants to run his script at full size on day one. Instead he runs it for a few weeks at the smallest tradable size. In that period he discovers that rejected orders occur whenever two signals fire in the same second, a case the backtest could never show. He fixes the sequencing, then raises size gradually. The bug would have been costly at full scale.
Related: Inverted Hammer Candlestick: Rules, Failures and Shooting Star Test
Yes, if the system is built with limits, tested at small size and monitored. The risks are real, but they are manageable when you treat execution as seriously as the strategy.
Brokers apply risk checks, but those checks are generic and cannot know your intent. You remain responsible for your own limits and for confirming what orders actually went out.
Backtests ignore rejections, latency, partial fills and spread costs. These small frictions add up, which is why measuring slippage in live trading is so important.
Even a well-built system benefits from supervision, especially in the opening minutes and around events. Unattended running is something to earn gradually, after a long clean record.
Explore our Our Services service or get in touch with our research team.