Once a trade is open, its stop is what protects it. This post explains how Project Iris moves the stop on a trade that is going well, and what changed between 23 September and 2 October. The rules are the same for gold, index and FX trades. Only the distances differ between families.

Illustrated buy trade: the stop jumps to break-even plus costs, then trails the best price in steps that only move up; a brief spread spike is ignored and the trade exits in profitIllustrated buy trade: the stop jumps to break-even plus costs, then trails the best price in steps that only move up; a brief spread spike is ignored and the trade exits in profit
Illustration of a buy trade. The stop only ever moves in your favour.

1. Break-even: the first move

Once a trade has moved far enough in its favour, its stop moves to the entry price plus all costs. From then on, a normal exit can no longer be a loss. "Far enough" is measured against how much the instrument usually moves, so it adapts to both quiet and busy markets:

These distances are starting points. The engine adjusts them for current volatility, for the spread, and for how many recovery legs the trade has. Two rules never change. A break-even stop sits at or above the entry, never below it. And it covers the commission on both the opening and the closing side (since 25 September). On FX, one cost was being counted twice, which made some break-even stops impossible to place; that was fixed on 30 September.

2. A break-even stop is never undone

On 28 September a bitcoin trade reached break-even. Its stop moved up and, because the trade could no longer lose, its recovery leg was removed. A moment later, a separate rule that re-reads recent candles moved the stop back down, and the recovery leg never came back. The trade was left with neither protection.

Since 1 October at 05:19 UTC, a committed break-even is never undone: the candle rule may only tighten a stop, never loosen it. As a second safeguard, if a stop loosens for any other reason, the trade gets its recovery leg back.

3. Trailing: following the best price

Further into profit, the stop starts to trail. It follows the best price reached, keeping a distance behind it. Each new high can pull the stop up, and since 24 September nothing can push it back down.

On 30 September at 19:31 UTC, index trades gained a second trail. Until then, an index trade's stop only followed the lows of completed short bars. On 28 September a German index trade reached a good profit and then gave most of it back, because no trail was following the peak. Now an index trade also follows its best price once it is well into profit. Whichever of the two trails is tighter is the one that applies.

4. A brief spread spike is ignored

The spread is the gap between the buying and the selling price, and now and then it widens briefly. When spreads are wide, the engine tightens its stops for a reason: wide spreads often come with fast markets.

On 1 October a gold trade's spread jumped for a single moment. The trail treated that blip as the new normal: it started earlier and moved closer to price. Because a stop never moves back, the effect of that one moment became permanent. The trade closed with a small profit while price carried on in its direction.

Since 2 October at 18:05 UTC, a wider spread only tightens a stop once it has lasted. A brief spike is ignored. A narrower spread counts at once, because it can only give the trade more room. Longer spells of wide spreads, the kind that come with real market stress, still tighten stops as before.

5. After a recovery, in a ranging market

When a trade has needed a recovery leg and the market is moving sideways, waiting for the full break-even distance keeps the whole group exposed for longer. Since 25 September at 09:11 UTC, once a recovery leg has filled in a ranging market and price is back past the group's average entry price, the stop locks at break-even straight away, costs included.

6. End of the day and end of the week

And around major news

Before high-impact news, all of these distances shrink gradually. That has its own post: Before major news: how Iris tightens step by step.

The rules as small programs

Three of the rules above are easier to see as code. These are simplified sketches of the logic, not the engine's source code.

A stop only moves in your favour

def next_stop(trade, candidate):
    if trade.side == "buy":
        return max(trade.stop, candidate)   # a buy stop can only rise
    return min(trade.stop, candidate)       # a sell stop can only fall

Every move of the stop passes through a rule like this one, which is why a trailing stop cannot be pushed back down and a committed break-even cannot be undone by another rule that re-reads recent candles.

Break-even covers the costs

def break_even_stop(trade, commission_open, commission_close, spread):
    costs = commission_open + commission_close + spread
    sign = 1 if trade.side == "buy" else -1
    return trade.entry + sign * costs      # a normal exit here cannot be a loss

A brief spread spike is ignored

def spread_for_stops(spread_now, spread_used, wide_since, now, hold):
    if spread_now <= spread_used:
        return spread_now                  # a narrower spread counts at once
    if wide_since is not None and now - wide_since >= hold:
        return spread_now                  # it has lasted, so it counts
    return spread_used                     # a brief spike changes nothing

The value of hold is not published. What matters is the shape: wider spreads have to last before they tighten a stop, narrower ones do not.

What you need to do

Nothing. These rules run on the engine for every account it trades.


Notes

  1. "How much the instrument usually moves" is measured on completed bars only, never on the bar that is still forming.
  2. The examples name real trades by date and instrument only. They show how a rule behaved, not a result.
  3. Internal change references: #392 (gold break-even restored), #449 (lone-trade break-even), #448 and #470 (costs), #479 (break-even never undone), #394 (trail never widens), #481 (index peak trail), #489 (brief spread spikes), #444 (early exit after a recovery), #480 (end-of-session close), #466 (Friday afternoons).