How the system works
Position management
What happens after a trade opens: emergency exit, break-even, profit ratchet and partial close — the shipped defaults, and the two rules we ship disabled.
Last reviewed: 25 August 2026
Who owns a trade once it is open
Position management does, and it runs in the C++ trading core on every tick with no involvement from the AI, the console or the database. The model that proposed the trade has no say in when it closes.
This is the part of the system that keeps working when everything above it is down. It needs nothing but live prices.
The rules, in priority order
Evaluated in this order on every tick, so a protective rule always resolves before a profit-taking one:
| Priority | Rule | Shipped default | State |
|---|---|---|---|
| 1 | Emergency exit | Closes the position at 5% unrealized loss | On |
| 2 | Profit lock | Arms at 1% profit, gives back 0.3% of equity | Off |
| 3 | Break-even | Moves the stop to entry at 0.3% profit | On |
| 4 | Trailing stop | Arms at 0.5% profit, trails by a fixed price distance | Off |
| 5 | Profit ratchet | Arms at 5% profit, gives back 75% of the peak | On |
| 6 | Partial close | Closes half the position at 0.8% profit | On |
Emergency exit
A hard stop on unrealized loss, evaluated before every other rule, on each position independently. It cannot be outvoted by a strategy signal or a confident model, and it does not consult the AI layer — which is the point of running it first and separately.
Break-even and partial close
Break-even moves the resting stop to your entry once the trade is modestly ahead, converting a winning position into one that cannot become a losing one at the broker level. Partial close takes half the position off at a configured profit, which reduces the size at risk while leaving the remainder to run.
The profit ratchet
A resting broker-side stop that steps up behind peak profit. Once armed it can never sit at a losing level. It arms at 5% profit and gives back 75% of the peak — which sounds generous until you read it the other way round: it locks a quarter of the best the trade ever showed, and only starts doing so once the trade is substantially ahead.
Those two numbers were measured, not chosen
Two rules ship switched off
Both remain in the code and can be enabled. Neither is on by default, and the reasons are worth stating plainly rather than hiding behind a config file.
Profit lock is off because the share of peak profit it surrenders shrinks as the peak grows — it gives back a fixed percentage of equity, not a proportion of the gain — and because it closes the position at market rather than moving a stop. Tested across ten symbols of history with costs applied, that combination lost money out of sample at every setting tried. The profit ratchet replaces it with a proportional, broker-side version.
Trailing stop is off because its distance is an absolute price distance, and no single value is correct across instruments. A distance that is a hair-trigger on an instrument priced in the thousands computes a stop below zero on one priced near 1.00 — a stop that can never tighten. The ratchet expresses the same idea in basis points, which is scale-independent.
Stops rest at the broker
Every level these rules set is placed on the broker's own order, not merely tracked in memory. That is what makes them survive a dropped connection — see Connecting MetaTrader 5.
A stop level is not a guaranteed fill
Changing the defaults
All of these are configurable per account, and every change is version-stamped into the record alongside the decisions made under it, so a trade from months ago can still be read against the policy that was actually in force — Audit trail covers how.