← Algo Trading Basics

The Building Blocks of a Trading Algorithm: Entry, Exit, Risk

16 Oct 2026 · 2 min read

BullsEdges algo trading guide: Every trading algorithm, simple or complex, is built from the same parts. Understanding them makes it easier to design, read and judge any strategy.

Whether it is a two-line moving-average crossover or a multi-module gold system, every trading algorithm is assembled from the same building blocks. Looking at a strategy block by block is the fastest way to understand it - and to find its weak spots.

BullsEdges algo trading application: Document entry, exit, position size and safety limits together; an entry signal without the other components is not a complete strategy.

1. Market and timeframe

Which symbol, which chart period, which hours. "XAUUSD, M5, London and New York sessions only" is already a set of decisions that shapes everything else.

2. Filters

Filters decide whether trading is allowed at all:

  • Trend filter: only buy above a long moving average.
  • Volatility filter: skip very quiet or very wild markets.
  • Time filter: avoid rollover, Friday evenings, specific sessions.
  • News filter: pause around high-impact releases.
  • Spread filter: no entries when costs are abnormally high.

Filters often contribute more to a strategy's edge than the entry signal itself.

3. Entry trigger

The exact event that opens a trade: a breakout above a range, a pullback to an average, an indicator cross, a pending order filled. It must be precise enough to code - "price closes above the 20-bar high" rather than "price breaks out".

4. Initial stop loss

Where the trade is wrong. Common choices are a fixed distance, a multiple of ATR, or beyond a recent swing high or low. A strategy without a stop loss has not removed the risk - it has made the risk unlimited and hidden it.

5. Position sizing

How big each trade is. Fixed lots are simple; percentage risk (lot size calculated from the stop distance) keeps risk constant as the account and volatility change.

6. Trade management

What happens while the trade is open:

  • Moving the stop to break-even.
  • Trailing stops.
  • Partial take-profit.
  • Adding to the position (pyramiding into winners, or averaging into losers - very different risk profiles).

7. Exit

Take-profit level, opposite signal, time-based exit, or trailing stop. Exits have a huge effect on results; two strategies with the same entries can have completely different outcomes.

8. Safety limits

Account-level protections that sit above the strategy: maximum daily loss, maximum drawdown, maximum open lots, kill switch. These are what stand between a bad day and a destroyed account.

Using the blocks

When you evaluate any EA - your own or one you are thinking of buying - write down each block. Missing blocks are warnings: no stop loss, no safety limit, no news handling. Vague blocks are warnings too. And when you improve a strategy, change one block at a time and re-test, so you know what actually made the difference.

Trading forex and gold carries a high level of risk and may not be suitable for every investor. Past performance and backtests do not guarantee future results. This article is education, not financial advice.

Start your 1 month free trial

Full access to the Finoways Forex & XAUUSD algo, setup support included.