Docs / User guides / How orders work

How orders work

What happens between the moment you place an order and the moment the broker reports it: order types, stops, time in force, the checks on the way and every status you can see.

Updated 16 Nov 2026·Version 0.x
Live and demo accounts. PerkBridge trades MetaTrader 5 live and demo accounts. Nothing on this page closes or changes anything at the broker by itself: an order is sent once, and a lost answer is checked with the broker, never resent.

1. Orders and positions

An order is a request. A position is what the broker holds once a buy or sell order has been filled. The two are shown apart in the dashboard: the Open positions section lists what you hold, the Pending orders section lists the orders that wait at the broker for their price, and Recent orders lists every request you made, with its status.

PerkBridge keeps a record of every order it places, named by an order id, and follows it until the broker has given a final answer. It lists only the orders it placed itself. Orders you place with other tools, for example straight in a MetaTrader 5 terminal, are shown at the broker but PerkBridge does not manage them.

An order comes from one of three places:

  • The dashboard. The New order button on an account's Orders tab, and the Close, Modify and Cancel buttons in the lists.
  • Your own program, through the Trading API with an API token for the account.
  • PerkBridge itself, in a few named cases: the emergency stop's optional "cancel pending orders", a time rule that closes positions or cancels orders before market close or a news window, and the automatic cancel of pending orders when a deployment is removed. Each of these is an order of its own in Recent orders, marked with who or what requested it.

2. The path of an order

Every order travels the same road, whoever placed it. The control plane checks it, the Fleet Agent on the trading server checks it again with the terminal's live values, NileTrade inside the MetaTrader 5 terminal sends it to the broker, and the broker's answer travels back the same way. Each step is written to the order's timeline, which you can open from Recent orders with Details.

The path of an order: from the dashboard or your program to the control plane, which checks it, to the Fleet Agent on the server, which checks it again, to NileTrade in the MetaTrader 5 terminal, to the broker. The answer comes back along the same path into the order's timeline. YouDashboard: New orderor your program via API Control planechecks the order,records it, queues it Fleet Agenton your trading server:checks again, live values MetaTrader 5NileTrade sends itto your broker the broker's answer comes back the same way, into the order's timeline Checked at the control plane• account verified• trading on, no emergency stop• symbol allowed on the route• volume, exposure, open positions• fresh quote, spread• rate and one order in flight• your risk rules Checked again on the server• same checks, with the terminal's current values• nile-risk checks your rules• not expired on arrival• broker connected, trading allowed on the account• NileTrade: broker's own limits
The checks run twice on purpose. The control plane refuses early so you see why; the server's check is the one that counts, because it uses what the terminal sees right now.

Three rules hold on this road:

  • Nothing is executed until the status says so. "Sent to Nile" in the dashboard means the order was recorded and queued. The position appears, or the order rests, only when the broker has reported it.
  • An order is sent once. If the answer is lost on the way back, PerkBridge checks with the broker. It never sends the same order again by itself, not after a restart, not after a failover switch to a standby server. See section 8.
  • Orders on one account go one at a time. Only one order can be on its way per account. The next one waits in the queue, and a refused or expired order frees the queue at once.

3. Order types

PerkBridge places four order types. A market order is filled at once; the other three are pending orders that rest at the broker until the price reaches them.

Order types on a price scale. At the current price: a market order. Above it: buy stop, sell limit and a buy stop limit with its trigger and limit prices. Below it: buy limit, sell stop and a sell stop limit. A stop loss and a take profit sit on either side of a position's open price. price Current price (bid / ask) ABOVE THE MARKETBELOW THE MARKET Buy stopbuys once the price rises to it Buy limitbuys once the price falls to it Sell limitsells once the price rises to it Sell stopsells once the price falls to it Buy stop limit: triggerthen rests as a buy limit here then rests as a sell limit hereSell stop limit: trigger Take profit (buy)closes with a gain Stop loss (buy)closes to limit the loss for a buy at the current price Market order: filled now
Where each order type sits against the current price. A stop limit order has two prices: the trigger, and the limit price it rests at once triggered.
TYPEWHAT IT DOESPRICE YOU GIVE
MarketBuys or sells now, at the broker's current price. The fill price can differ from the price you saw; the broker decides.None.
LimitRests at the broker and fills at your price or better. A buy limit sits below the market, a sell limit above it.The limit price.
StopRests and becomes a market order once the price reaches it. A buy stop sits above the market, a sell stop below it.The trigger price.
Stop limitRests until the trigger price, then rests again as a limit order at the limit price. One order in PerkBridge, two stages at the broker.The trigger price and the limit price.

A pending order's price has to be on the right side of the market and far enough from it: every broker sets a minimum distance (its "stops level"). An order too close, or on the wrong side, is refused as stops_invalid or price_invalid before anything is sent. The symbol's page on the account's Overview tells you which order types the broker accepts for it.

4. Stop loss and take profit

A stop loss closes a position to limit a loss; a take profit closes it to take a gain. Both are held by the broker: once set, they work even when PerkBridge, the server or the terminal is down.

  • On a limit, stop or stop limit order, give the stop loss and take profit when you place it. They are attached to the resting order and carry over to the position when it fills. You can change or remove them while the order rests, with Modify.
  • On a market order (since 1.2.0-beta), give them with the order. MetaTrader 5 applies them to the position it opens, and checks their side and distance against the fill price. On an account in risk mode they can also be given as a distance, such as 20 pips, and are converted to prices from the quote (see Position protections). A broker that refuses stops on market orders for a symbol answers stops_not_supported; then set them on the position after it opens.
  • On an open position, Edit SL/TP in the Open positions section sets, moves or removes the stop loss and take profit. The change is an order of its own in Recent orders (kind modify_position), with its own status.

A stop loss or take profit must sit on the right side of the price and at least the broker's minimum distance from it, otherwise it is refused as stops_invalid. While trading is off, during an emergency stop or when a risk rule blocks the account, you can still add a stop loss or take profit that a position does not have, so a position is never left unprotected; moving or removing one waits until trading is back on.

Pips. A pip is not the same size on every instrument, so each symbol has a pip size, in price units. You can set it per account in the Pip size column of the account's Symbols table (see Trading accounts and orders). Otherwise a default rule applies: 10 points on a symbol quoted with 3 or 5 digits, 1.00 on a crypto symbol with at most 2 digits such as BTCUSD, and one point on anything else. Metals and indices keep one point until you set another size, for example 0.10 for gold. A stop given in pips is converted with the pip size, the order form shows it as "1 pip = X", and the order keeps the pip size it used. A change applies to orders accepted afterwards and to the symbol's active protections. Pips convert with the pip size on accounts in risk mode whose runtime image has NileTrade 1.6.0 or later.

Checked before sending. On an account in risk mode, the risk engine on the trading server checks the stop loss and take profit of a market order, and the converted stops of a position change, against the quote that decides the order. A stop on the wrong side of the market, inside the spread, or closer than the broker's stops level (measured from the bid for a buy and from the ask for a sell) is refused as stops_invalid before anything reaches the broker, and the message says how far the stop must be. A close, and the stops a change leaves as they are, are never checked. Before this check, such a stop reached the broker, which refused the whole order: a 30-pip stop on BTCUSD, counted with a one-point pip, sat inside the spread.

5. Time in force

Time in force says how long a pending order rests. The broker removes the order when its time is up; PerkBridge never expires an order itself, and shows it as cancelled by the broker's expiry.

Four time-in-force choices on a timeline: good till cancelled rests until you cancel it; day rests until the broker's end of day; good till date rests until a time you set; good till day rests until the end of a day you set. placed broker's end of day gtcrests until you cancel it (or it fills)… dayrests until the broker's end of day gtduntil a time you setyour time, at least 60 s ahead gtd_dayuntil the end of a trading day you setyour day
The broker removes a pending order when its time in force ends. The dashboard then shows it as cancelled, with the reason "expired at the broker".
  • gtc, good till cancelled: the default when you give no time.
  • day: until the end of the broker's trading day.
  • gtd, good till date: until a time you set, at least 60 seconds ahead.
  • gtd_day: until the end of a trading day you set.

Brokers keep times in their own server clock. For day, gtd and gtd_day, PerkBridge needs the broker's clock offset from the terminal's last report; until it has one, those choices are refused as broker_time_unknown and gtc still works. Not every broker offers every choice for every symbol; an unsupported one is refused as time_in_force_not_supported.

6. What happens to an order

Every order ends in exactly one final status. Until then it is on its way, and the dashboard shows where.

The statuses of an order. Accepted, then queued, then sent. A market order ends filled, partly filled or rejected by the broker. A pending order rests at the broker, then ends filled, cancelled or expired. Before sending, an order can be refused or expire. If the answer is lost the outcome is unknown and PerkBridge checks with the broker. Accepted Queued Sent Filled Partly filled Rejected by broker Resting at broker market orderpending order Filled Cancelled by you Expired at broker Refuseda check said no; nothing sent Expirednot sent in time; nothing sent Outcome unknown answer lost Checked with broker ends filled, rejected or not found; never resent
Green statuses mean the broker did something. Red and grey ones mean nothing happened at the broker. Orange ones are not final yet.
STATUSFINALAT THE BROKERMEANING
AcceptednonothingRecorded; the control plane's checks passed. "Sent to Nile" in the dashboard.
QueuednonothingSigned and handed to the trading server. It waits its turn behind an earlier order of the account.
SentnopossibleNileTrade handed it to the broker; the answer is on its way.
RefusedyesnothingA check said no, at the control plane or on the server. The reason is shown, for example halted, exposure_limit or quote_stale.
ExpiredyesnothingIt could not be sent before its time ran out (10 seconds by default, up to 60). Nothing was sent.
FilledyesdoneThe broker filled the whole volume. The position is in Open positions.
Partly filledyesdoneThe broker filled part of the volume; the rest was not executed.
Rejected by brokeryesnothingThe broker said no and gave a reason code.
Resting at the brokernorestingA pending order waits for its price. It stays there even if PerkBridge, the server or the terminal stops.
CancelledyesremovedA pending order left the broker with nothing filled: you cancelled it, its time in force ended ("expired at the broker"), or the broker removed it.
DoneyesappliedA modify, a cancel or a stop loss change the broker shows applied.
Outcome unknownnopossibleThe order was sent but the answer did not come back. PerkBridge is checking with the broker; see section 8.
Not foundyesnothing foundAfter the check, with the broker connected and in sync, no trace of the order exists. If the broker's history shows it later, the status changes to Filled and that change is recorded.

A status never goes backwards: a late report cannot move a filled order back to sent. The Details view of an order shows every step with its time and who reported it: the control plane, the server, the broker or the simulator.

7. Changing and cancelling a pending order

A resting order can be changed or removed from the Pending orders section or through the API. Each change is an order of its own, in Recent orders, with its own status: it goes through the same checks and the same road as any order, and ends Done once the broker shows the change.

  • Modify changes the price, the time in force, the stop loss or the take profit. The volume cannot change: cancel the order and place a new one. A stop limit order's trigger price can change only until it triggers; after that, only its limit price can.
  • Cancel removes the order from the broker. A part that already filled stays open as a position. Cancelling counts as a close: it works with trading off, during an emergency stop and when a risk rule blocks the account.
  • Only one change per order is on its way at a time; the dashboard does not offer a second one until the first has ended.
  • Once an order has filled, it is a position: there is nothing left to modify or cancel. Use Close, or Edit SL/TP, on the position instead.

8. Closing a position

Close sends a market order that closes the whole position at the broker's current price, which can differ from the price shown. To close only part of it, send a volume (on the API) or use Volume to close (in the dashboard); this needs the runtime image main-213a8d4 or later.

Every closed position is listed under Closed trades on the account's Orders tab, with the reason it closed: by one of your orders (and who sent it: a user, an API token or a strategy), by a position protection, by the broker's stop loss, take profit or stop out, by hand in MetaTrader 5, or outside PerkBridge. The broker's own reasons need the runtime image NileTrade 1.5.0 and a current Fleet Agent; with an older image, a stop loss or take profit is still named when PerkBridge recorded it. Through the API, a closed trade carries close_reason and closed_by.

You can always close. A close is accepted with trading off, during an emergency stop, after a risk rule has tripped, and even while the risk engine on the server is down (a separate close-only channel exists for that). The only things that can stop a close are a broker that is not connected, or a symbol the broker has disabled entirely.

9. When the answer is lost

Sometimes an order is sent and the answer never arrives: the terminal froze, the server lost its connection, or the control plane restarted at the wrong moment. The order then shows Outcome unknown, and the account shows "reconciliation pending".

  • PerkBridge asks the terminal to look for the order at the broker, by the marker every order carries. It keeps asking until the broker is connected and in sync.
  • If the broker shows it, the order ends Filled, Partly filled or Rejected, exactly as the broker says. If the broker shows no trace, it ends Not found.
  • The order is never sent again by PerkBridge. Sending it again could open the position twice. If you want the trade, place a new order once the status is final.
  • While an outcome is unknown, new opening orders on the account are refused as reconciliation_pending. Closes still work.

A change to a position's stop loss or take profit is handled a little differently: if its answer is lost, it ends as Answer lost with the stops you asked for and the stops the position had before. PerkBridge does not guess from the position. Look at the position's stops, decide, and send the change again if needed.

Restarting a terminal. If a terminal hangs, restart it from the deployment's Restart tab with Restart terminal, never by hand on the server. The restart freezes the deployment's accounts (no new positions; closes are always allowed), waits up to 30 seconds for orders in flight, takes a snapshot of positions and orders, opens a new session on the same server and compares what the broker shows with the snapshot. Trading resumes only when nothing differs or a person has decided every difference, by accepting the broker's state or resolving it with a note; until then the alert RECONCILIATION_REQUIRED stays open. Positions are never closed and nothing is sent again. A restart needs deployment:manage, and trading:configure on the deployment's accounts.

10. What still works when trading is blocked

Three things block new positions: the account's trading switch, the organization's emergency stop, and a tripped risk rule or time rule. None of them touches the broker by itself. What each still allows:

ACTIONTRADING OFFEMERGENCY STOPRISK RULE TRIPPED
Open a new position (market or pending order)refusedrefusedrefused
Close a positionallowedallowedallowed
Cancel a pending orderallowedallowedallowed
Modify a pending order's price or expiryrefusedrefusedrefused
Add a missing stop loss or take profit to a positionallowedallowedallowed
Move or remove a position's stop loss or take profitrefusedrefusedrefused
Pending orders already restingstaystay, unless you tick "cancel pending orders"stay, unless a time rule cancels them before its window

The organization emergency stop can also close every open position, if you choose that when you place it. See Stopping safely.

An order that was already queued when the block starts is not sent: it waits, then expires. A time rule can close positions and cancel pending orders before market close or a news window, when you set it to; a tripped risk rule only blocks.

11. Good to know

  • Live and demo accounts. Real accounts need the runtime image NileTrade 1.4.0 and a current Fleet Agent. On an older server, orders on a real account are refused before anything is sent.
  • Stop loss and take profit on a market order work since 1.2.0-beta. Older releases refuse them with stops_not_supported.
  • Partial close needs the MetaTrader 5 runtime image main-213a8d4 or later; send volume with the close. For a trailing stop, break-even or take-profit levels, see Position protections.
  • One order in flight per account. A program that fires several orders at once sees the others refused as in_flight_limit; send the next one when the status is final. An account that collects too many refusals in a minute turns its own trading off, so a looping program cannot hammer the broker.
  • Orders placed with other tools are shown at the broker and count towards your exposure, but PerkBridge cannot modify or cancel them.
  • Prices and profit in the dashboard come from the terminal's last report, every few seconds. The broker's price at execution is the one that counts.
  • Tick value. A quote carries the symbol's tick value for a profit and for a loss (tick_value_profit, tick_value_loss): what a move of one tick is worth for one lot, in the account currency, read with that quote. Use it to size a position or a stop in money. It needs the runtime image NileTrade 1.7.0; before that, and on simulated accounts, the fields are empty (null).
  • Sending under load. Since 1.2.10-beta an accepted order is sent at once, without waiting for the control plane's next one-second pass over all accounts.

For the exact fields, codes and limits, see the Trading API reference. For the buttons, see Trading accounts and orders. For the limits you can set, see Risk limits and rules.

Was this page helpful?