Kagels Trading
Topics

Algo Trading: How It Works, Platforms and Risks

Contents
  1. Algo trading in 30 seconds
  2. What is algo trading?
  3. Algo trading, bots and AI trading: the terms
  4. How a trading algorithm works: five steps on every new price
  5. From idea to live system: six steps that filter out weak systems
  6. Which platform and language fit you?
  7. Build, buy or rent: three ways to automate
  8. Pros and cons of algo trading
  9. Why trading systems fail: five risks
  10. Is algo trading legal in the US? What FINRA, the SEC and the CFTC say
  11. How to learn algo trading: books, contests and role models
  12. Conclusion: algo trading is testing work, not an autopilot
  13. Frequently asked questions about algo trading
  14. About the author

A trading algorithm turns an idea into a rule that trades without you. That sounds like freedom, but it is mostly craft: most systems do not fail because of the code, they fail because their rules only worked in the past.

This guide is the starting point for algo trading at Kagels Trading. You will learn what algorithmic trading is, which platform and language fit you, how a system is tested from the first idea to a live account, and where the risks are. Wherever we have a detailed guide on a part of the topic, this page links to it.

Algo trading in 30 seconds

  • What it is: a program decides by fixed rules whether, when, at what price and in what size an order is sent.
  • What you need: a strategy that fits into clear rules, a platform with a programming language and a broker with an API.
  • Where most fail: overfitting. The system is tuned to old prices and loses once new prices arrive.
  • How to test: backtest, then out-of-sample and walk-forward tests, then a forward test with little money.
  • Where to start: a platform language such as MQL5, EasyLanguage or NinjaScript if you are new to coding; Python with a broker API if you want flexibility.
  • What it is not: passive income. An automated system still needs monitoring, maintenance and a risk limit.

What is algo trading?

Algo trading (algorithmic trading) is trading in which a computer program sets the order details by predefined rules. The program decides whether to place an order, at what time, at what price and in what size, and how to handle the order after it is sent. A system that only routes orders you typed in yourself is not algo trading.

A trading algorithm is a set of rules in code that turns market data into a buy or sell signal and then into an order. It reads prices, checks its conditions and acts without waiting for you to click.

Algo trading starts with the rule, not with the code. If you cannot write your strategy down so that a stranger could trade it without asking you a question, no program can trade it either. “Buy when the market looks strong” is not a rule. “Buy when the daily close is above the 20-day high” is one.

Algo trading, bots and AI trading: the terms

Five terms are often mixed up, and they mean different things. The difference matters, because each term comes with other providers, other costs and other risks.

Term What it means
Algo trading trading by programmed rules, from signal to order
Trading bot a ready-made program, often rented, common in crypto
AI trading rules learned from data instead of written by hand
Quantitative trading strategies built on statistics and data analysis
High-frequency trading algo trading in milliseconds, with servers next to the exchange

Retail traders, funds and banks all use algo trading, while high-frequency trading is mainly the business of banks and market makers. The speed race of the big firms is not the game a private trader can or should play; a retail system lives on its rules, not on microseconds.

A trading bot is a ready-made program that places orders by its maker’s rules, while the user mostly sets parameters. The key difference is control. With your own algorithm you know why an order is sent. With a rented bot you often know only the sales pitch and a performance curve.

How a trading algorithm works: five steps on every new price

A trading algorithm repeats the same five steps every time a new price arrives. Whether you use MetaTrader, Python or NinjaTrader changes the language, not the process.

  1. Read data: price, volume, time and, if needed, indicator values.
  2. Check the signal: is the entry rule met, or has an exit condition occurred?
  3. Size the position: how many shares or contracts fit the risk limit per trade?
  4. Send the order: market, limit or stop order through the broker API.
  5. Manage the position: move the stop, check the target, shut down on errors.

A broker API (application programming interface) is the technical access through which a program receives prices and sends orders directly to a broker. Without it, your rules stay a chart signal that someone still has to click.

In practice, step three decides whether the account survives. A signal with an edge does little good if the program doubles the size after three losses. Keep the risk per trade fixed and small, and make it part of the code, not a decision you take later.

From idea to live system: six steps that filter out weak systems

A robust trading system is built in stages, and each stage should be allowed to kill it. If you only check whether the backtest looks good, you will almost always find a result that looks good. The real question is whether it also holds on data outside the test.

Six stages from idea to a running trading system, from turning the idea into rules to going live with small size, each with the typical reason systems fail at that stageClick to enlarge
The six stages of a trading system. Each stage should be allowed to reject the system before it costs real money.

Source: Graphic by Kagels Trading.

1. Turn the idea into rules

Every system starts with a market observation, not with an indicator. For example: after a breakout from a tight range, price often keeps going, or a market tends to return to its average after strong days. From that you build entry, exit, stop and position size, each rule clear enough to code. Our guide to breakout trading shows how such an observation is measured before it becomes a rule.

2. Get clean data

A backtest is only as good as the prices it runs on. Missing days, badly rolled futures contracts or stock lists without the companies that were later removed distort the result before the first rule fires. With stocks, the last error is called survivorship bias: you only test the winners that are still around today.

3. The backtest

A backtest simulates a strategy on historical prices to see how it would have behaved in the past. It belongs with fees and slippage included, with enough trades for a solid statement and without rules that were added after looking at the results. How this works step by step in one popular tool is shown in our guide to backtesting in TradingView.

4. Test robustness: out-of-sample, walk-forward, Monte Carlo

Overfitting means a trading system is tuned so closely to past prices that it captures random patterns instead of a real edge. It is the most common reason a system that looked great in testing fails with real money, because the optimizer found noise.

Against overfitting, data the system has never seen is the best test. In an out-of-sample test, you hold back a period and run the finished system on it only at the end. A walk-forward analysis repeats this in steps: optimize, trade the next period, move on. A Monte Carlo simulation reshuffles the order of the trades and shows how deep a drawdown could also have been with the same win rate.

5. Forward test: watch the system in real time

A forward test runs the finished system on new, live prices, in a demo account or with very small size. It finds errors no backtest can show: broken connections, orders that are not filled at the expected price and differences between your data feed and your broker’s prices. A practice account such as TradingView paper trading lets you watch signals and fills without risking money.

Kevin Davey, who sells his process as the Strategy Factory, calls this stage incubation. Only when a system has behaved within the range of its backtest for weeks or months does it get real money. That patience is the step most beginners skip.

6. Go live and monitor

A live system needs shutdown rules before the first trade. Decide in advance at which drawdown (the decline from the last account high) you stop it, for example at one and a half times the largest decline in the test. Also stop it if the win rate stays well below the test values. A rule you set while you are calm is easier to follow than one you invent during a losing streak.

Which platform and language fit you?

The platform decides which markets you can trade automatically. If you want to automate futures, you end up with different tools than someone who trades forex or stocks. The table sorts the common choices; check the provider’s site for current costs and supported brokers.

Platform (language) Markets and level
MetaTrader 5 (MQL5) forex and CFDs outside the US; easy start, many examples
cTrader (C#, Python) forex and CFDs outside the US; medium
NinjaTrader (NinjaScript, C#) futures; medium
TradeStation (EasyLanguage) US stocks, options, futures; easy
MultiCharts (PowerLanguage) futures, stocks; easy to medium
ProRealTime (ProBuilder, ProOrder) stocks, futures, CFDs; easy
AmiBroker (AFL) stocks, futures; strong for testing
TradingView (Pine Script) all; no direct live trading from a strategy
Python with a broker API whatever the broker offers; hard, very flexible
QuantConnect (Python, C#) stocks, futures, forex, crypto; cloud

An Expert Advisor (EA) is a trading program for MetaTrader that checks signals and sends orders to the broker on its own. Expert Advisors are a widespread form of retail automation in forex, and many are offered free or for a fee. How MetaTrader 5 compares with TradingView for this job is covered in our guide to TradingView alternatives.

If you have never programmed, a platform language is the shorter way. EasyLanguage, ProOrder and MQL5 are built around trading logic; stops and position sizing come as ready-made parts. Python pays off if you want to combine data from several sources, run your own statistics or trade directly through a broker API, for example at Interactive Brokers or Alpaca.

TradingView calculates strategies in Pine Script, but it does not trade them at your broker by itself. For live trading from TradingView you need alerts that outside software turns into orders through a webhook. That is an extra point of failure you have to include in your forward test. Which brokers connect to TradingView at all is listed in our guide to TradingView brokers.

Build, buy or rent: three ways to automate

Not every algo trader writes their own code. There are three ways, and each moves the risk to a different place: with your own build it depends on your skills, when you buy on the seller, when you rent on the platform.

Way Pro Con
Build your own full control, you know every rule time, learning curve
Buy a finished system ready to run rules often hidden, backtest not verifiable
Rent a bot or signal service low entry barrier dependence on the provider, ongoing fees

When you buy a system, one question matters more than any performance curve. Can you check the rules and the backtest yourself? A seller who shows only a rising line but names neither the period, the costs nor an out-of-sample part is selling you the past, not the future.

Pros and cons of algo trading

Algo trading takes the execution off your hands, but not the responsibility. The lists show where a program is really better than a person and where it creates new sources of error.

What speaks for algo trading

  • Discipline: the program keeps its stop and its rules, even after five losses in a row.
  • Testable: every rule can be tested on decades of price data.
  • Speed and stamina: it reacts in fractions of a second, also at night.
  • Many markets at once: one computer watches dozens of markets, a person only a few.
  • Less screen time: you develop and monitor instead of clicking every trade yourself.

What speaks against algo trading

  • Overfitting: a nice backtest is easy to build and says little about the future.
  • Technical failures: power, internet, the platform or the broker API can fail while a position is open.
  • Market regimes change: a trend-following system loses in long sideways phases, a mean-reversion system in strong trends.
  • Costs: data, platform, server and fees are due before the first profit arrives.
  • False sense of safety: automation tempts you to stop looking at the account.

Why trading systems fail: five risks

Most algo accounts do not die on one bad day, but from a bad design. These five errors show up in almost every losing story, and all five can be checked in advance.

  1. Overfitting: too many parameters, too few trades, too many test runs. The cure is data the system has never seen.
  2. Costs underestimated: a system with a small profit per trade quickly turns into a loser after spread, commission and slippage.
  3. Position size too large: the edge is real, but the account cannot survive a normal losing streak. Our Kelly criterion simulation shows how deep the drawdowns get in a model when the size is too large.
  4. Doubling down: martingale systems and tight grid strategies show long, smooth equity curves and then collapse at once.
  5. No shutdown rule: nobody decided in advance when the system counts as broken.

Slippage is the difference between the price at which your system wanted to trade and the price at which the order was actually filled. It is small on a quiet day and can be large around news or at the open.

Yes, algorithmic trading is legal in the US, and the special supervision rules are aimed at brokers and firms, not at individual traders. FINRA’s Regulatory Notice 15-09 gives member firms guidance on supervising algorithmic strategies, from code testing to risk controls. The SEC’s market access rule, Rule 15c3-5, requires broker-dealers with market access to have pre-trade controls that reject orders above set credit or capital limits and erroneous orders outside set price or size limits.

For you as a retail trader, this means your broker’s controls also apply to your algorithm. If your program sends an order that breaks those limits, the broker can reject it. Brokers also set their own terms for API use, such as how many orders or messages you may send.

Some practices are banned for everyone, with or without a computer. The Commodity Exchange Act prohibits spoofing in futures markets, defined as bidding or offering with the intent to cancel the bid or offer before execution. In stocks, the same idea falls under the general ban on market manipulation. An algorithm that places orders it never wants filled is not a trading strategy but a legal risk.

How to learn algo trading: books, contests and role models

The fastest way to learn is to watch a practitioner test, not watch them win. Good sources show how systems are thrown out; weak ones only show the winners.

Kevin Davey is an example of an algo trader who shows his process in public. On his website KJ Trading Systems he says he has traded futures for more than 30 years and finished first or second in a real-money futures trading championship three years in a row. His book “Building Winning Algorithmic Trading Systems” walks from the idea through walk-forward testing and Monte Carlo simulation to incubation.

Andrea Unger also comes from systematic trading. He won the futures division of the World Cup Trading Championships four times (2008, 2009, 2010 and 2012) and is the only four-time champion. One contest year does not prove lasting profitability; it shows that someone held up under scrutiny with real money.

For exchange with other algo traders, the r/algotrading forum on Reddit is the largest open community. You will find many beginner questions there and just as many honest reports about systems that failed.

Conclusion: algo trading is testing work, not an autopilot

Algo trading is worth it for traders who want to put their strategy into rules and test those rules hard. The code is the smaller part of the work. The bigger part is throwing out the systems that only worked in the past, before they cost real money.

If you are starting out, pick a platform that fits your market and one simple system. Test it with costs, check it on data it has not seen and let it run live only with small size. This page grows with every new guide on the topic. My view: if only a small share of your ideas ever reaches a live account, you are not doing anything wrong, you are testing properly.

Frequently asked questions about algo trading

What is algo trading?

Algo trading means a computer program trades by fixed rules. It reads market data, checks its conditions and sends orders to the broker by itself. The trader writes the rules and monitors the system.

Does algo trading actually work?

It works as a way to execute a strategy, but it does not create an edge by itself. A program trades a weak strategy faster and more consistently than a person, so it also loses faster. Whether it works depends on a tested edge, realistic costs and a sensible position size.

Is algo trading profitable?

It can be, but there is no reliable figure for how many algo traders make money. Most systems fail because of overfitting and positions that are too large, not because of the code. Judge any system by its out-of-sample and forward-test results, not by a backtest alone.

How much money do you need to start algo trading?

For learning, a demo account is enough; for live trading, the market sets the minimum. Your account should survive the largest losing streak from your test several times over. A futures system needs more capital than a small stock or forex system. For US day traders, FINRA’s new intraday margin standards replaced the old day-trading rules, including the 25,000-dollar minimum, from 4 June 2026, and brokers may phase the change in until 20 October 2027 (FINRA Notice 26-10).

Can ChatGPT write a trading algorithm?

AI tools can write and explain code, but they cannot tell you whether the strategy has an edge. Language models help with MQL5, Pine Script or Python code. Whether the resulting system is any good is still decided by a backtest on unseen data and a forward test.

Which programming language is best for algo trading?

It depends on your platform. MetaTrader uses MQL5, NinjaTrader and cTrader use C#, TradeStation uses EasyLanguage. Python is the most flexible choice if you trade through a broker API or run your own data analysis.

Yes, retail traders may use their own algorithms. The special rules, such as FINRA guidance and the SEC’s market access rule, are aimed at brokers and firms. Spoofing and other market manipulation are banned for everyone, and your broker can set its own limits for automated orders.

What is the difference between algo trading and a trading bot?

A trading bot is usually a ready-made product, while algo trading is the broader term. With your own algorithm you know every rule; with a rented bot you mostly set parameters and have to trust the maker.

This article is market education, not investment advice. Automated trading can lose money quickly, including more than you expect from a backtest.

This US edition is based on our German edition on kagels-trading.de and has been adapted for US readers.

← All articles