Algorithmic Trading: What You Are Automating and Where an Algorithm Loses Money
· 5 min · beginner
Automated material · TradeAlmanac editorial deskDraft prepared by a language model from our stored data; not reviewed by an editor.
Algorithmic trading means handing a machine a rule defined in advance: under what condition to place an order, of what size, at what price and when to cancel it. What gets automated is not "the ability to make money" but the execution of a decision that a human has already put into words and tested against historical data. This leads to the key practical distinction: an algorithm can automate the decision (when to enter and exit) or only the execution (how to work an already-made decision through the order book without moving the price against yourself). These are different tasks, with different risks and different mathematics, and confusing the two is the most common reason an idea that works on paper loses money in a live account.
What an algorithm is made of, as opposed to a trading idea
Any live strategy breaks down into components, and each of them fails in its own way.
Data source. Quotes, the order book, trades, corporate events, financial statements. An algorithm is exactly as reliable as the feed it runs on: a missed tick, a delay, an unreconciled adjustment after a dividend record date or a stock split — and the rule fires on an artefact rather than on the market. That is why a serious share of the work is not hunting for a signal but reconciling data: the corporate events calendar and issuers' financial reports must enter the model in the same form in which they entered the price.
Signal rule. The condition that turns data into intent: buy, sell, do nothing. What matters here is not the elegance of the formula but the number of free parameters — the more there are, the easier it is to fit the rule to the past.
Risk management and position sizing. The part beginners write last, yet the one that breaks the account first. It covers the per-instrument limit, the daily limit, behaviour when the price gaps at the open, and the response to a broker's margin call if the strategy uses leverage — see our article on margin trading and the glossary entry on margin trading.
Execution. Order type, slicing of volume, acceptable slippage, behaviour when the spread is wide. In liquid stocks this component is barely noticeable; in short-dated OFZ bonds and illiquid issues it can eat up the entire projected result.
Supervision and the kill switch. An algorithm must be able to stop itself: when the connection is lost, when its own record of the position diverges from the broker's, when the daily loss limit is breached. A robot without a kill switch is not a strategy but a source of orders.
Where an algorithm loses money
First, overfitting. If the rule has been tweaked on the same stretch of history until the chart looked attractive, what has been tested is no longer the strategy but the diligence of the researcher. The remedy is a genuinely held-out segment of data that played no part in the fitting, and a rough formula instead of a precise one.
Second, costs. Commission, spread and slippage are deducted from every trade, not from the total, which is why they hit high-frequency strategies hardest. A rule that earns a thin price increment per trade can be mathematically correct and economically pointless.
Third, automated overtrading: the machine reproduces the same behaviour as a nervous human, only without fatigue and on an industrial scale. Frequency is not a sign of a good algorithm but a parameter that has to be justified on its own terms.
Fourth, survivorship bias in backtests. History contains only the issuers that have survived to the present day. A strategy tested on the current index constituents already knows an answer that did not exist in the past.
Fifth, a silent regime change. A rule built for one market state keeps placing orders in another. The warning sign is not a single loss but a persistent gap between the expected and the actual profile of trades.
The legal framework in Russia
Automation does not create a separate licence and does not remove liability. Market manipulation and the misuse of insider information are governed by Federal Law No. 224-FZ of 27 July 2010, and criminal liability for manipulation by Article 185.3 of the Russian Criminal Code. For an algorithmic trader this translates into concrete prohibitions: you may not place orders with no intention of executing them in order to create the appearance of demand; you may not trade with yourself to simulate turnover; you may not build a signal on non-public information — see the entry on insider trading. Separately, the exchange and the broker set their own limits on order intensity, and breaching them cuts off access faster than any regulator.
Where to start in practice
Step 1 — write the strategy down in words, without code: entry condition, exit condition, size, loss limit. If it does not fit into a few sentences, there is nothing to code yet. Step 2 — test the rule on historical data, then on the held-out segment, then in observation mode with no money at stake, recording the discrepancies between the calculated and the actual execution price. Step 3 — go live with minimal size and compare not returns but execution: fill accuracy, the share of unfilled orders, actual costs. Step 4 — only after that discuss scaling up.
A useful habit at every step is to keep the news feed and the glossary close at hand: most of a robot's "inexplicable" losses are explained by a corporate event that a human would have noticed but the rule did not take into account.
Let me be clear: the share of algorithmic orders in the turnover of Russian trading venues, typical latencies and fee schedules are not given here — the source material for this article contains no such data, and inserting a plausible-looking figure is worse than leaving it out.
Draft prepared by a language model from our stored data; not reviewed by an editor.
Model: claude-opus-5
How we use language modelsSimilar articles
- Walk-forward analysis: why a strategy is tested on data the optimiser has never seenWalk-forward analysis is a procedure for testing a trading system in which parameters are fitted on one segment of history and the result is taken from the next segment, one that played no part in the fitting, window after window until the end of the sample.
- Profit factor: the ratio of money made to money lost, and how easily it is fakedThe profit factor is the sum of all of a strategy's winning trades divided by the absolute sum of all its losing trades.
- Monte Carlo for a Strategy: What You Are Actually ShufflingIn trading, Monte Carlo does not answer the question "how much will I make" but rather "how much of the result I have already seen in the backtest was down to the order of events".
- Intermarket analysis: the channels through which interest rates and commodities reach a share priceIntermarket analysis reads the price of an instrument through the state of other markets: interest rates, government debt, currency, commodities and fund flows.