Home›Learn›Grid & EA types›What is a Trading Algorithm?

What is a Trading Algorithm?

A trading algorithm is a fixed set of rules software runs for you — entry, exit and risk. Here's how it works and how it differs from discretionary trading.

Grid & EA types5 minUpdated 14 Aug 2026
What is a Trading Algorithm?

A trading algorithm is a set of rules, written down precisely enough that software can follow them without you. It decides when to open a trade, when to close it, and how much to risk, and it does the same thing every time the same conditions appear. No hunches, no second-guessing. In retail forex that algorithm almost always arrives as an Expert Advisor (EA) running inside MetaTrader.

What it is

A trading algorithm turns a trading idea into instructions a machine can act on. Every decision a person would make by feel has to become an explicit rule: a condition to enter, a condition to exit, and a rule for size and risk. If a rule cannot be written as "if this, then that", the algorithm cannot use it.

Most algorithms are built from three kinds of rule:

  • Entry rules — the exact conditions that open a position.
  • Exit rules — where the trade closes, in profit or in loss.
  • Risk rules — how much of the account each trade may put at stake.

The point is not cleverness. It is consistency. The algorithm takes the person out of the moment of decision, which is usually where discipline breaks.

How it works

Once the rules are coded, software watches the market tick by tick and checks whether the entry conditions are met. When they are, it places the order, sets the stop and target, and manages the trade to its exit without asking you. A simple one, in plain English:

If the 50-period average crosses above the 200-period, buy 0.10 lots, stop 30 pips, close when they cross back.

That is a complete algorithm. It is not a good one on its own, but it shows the shape: a trigger, a size, a stop and an exit, each defined with no room for interpretation.

A worked example

Give an algorithm a £10,000 account and a rule to risk 1% per trade. It sees its signal, works out that 1% is £100, and sizes the position so a hit stop loses exactly that. Over 40 trades it wins 18 and loses 22. The 18 winners average £160, the 22 losers average £95. Gross profit is £2,880, gross loss is £2,090, so the month nets £790. A person trading by hand might have skipped the three ugly-looking winners and held two losers "a bit longer". The algorithm did neither, because it cannot.

Algorithmic vs discretionary

The opposite of algorithmic trading is discretionary trading, where a person makes each call in the moment. Discretion can adapt to things no rule anticipated; it can also talk itself into revenge trades and moved stops. An algorithm is the reverse — blind to anything outside its rules, but immune to mood. It will trade at 3am, it will take the signal after a losing streak, and it will never widen a stop out of hope. That reliability is the appeal, and also the risk: an algorithm following bad rules follows them faithfully, all the way down.

Common misconceptions

  • "Algorithm" does not mean profitable. A rule set can be simple, coded, and consistently losing. Automation is a delivery method, not an edge.
  • It only knows what you told it. A news spike, a broker change, a widening spread — it ignores anything no rule covers.
  • A backtest is not a promise. Rules tuned until they look perfect on old data often fall apart the moment they trade live.
  • It still needs watching. Running unattended is the point, but unattended is not unmonitored. An account can drift, stall or blow up while you assume the rules are holding.

The Karnek note

Karnek watches the live account an algorithm is trading — balance, equity, open positions and drawdown — read straight from your MetaTrader terminal. You see what the rules are actually doing, not what the backtest promised. It is read-only by design, so it can never place a trade or change one; it only reports.

See it in Karnek: monitor grid and martingale EAs, with drawdown alerts before they run away.

More in Grid & EA types →

Written and reviewed by the Karnek Research team. Last updated August 2026.

Educational content only - not financial advice. Past performance does not predict future results. Trading carries significant risk.