$LOSS
The $LOSS instruction sets a stop loss as a fixed money amount in the instrument currency with SET STOP $LOSS in ProRealTime™ ProBacktest and ProOrder code.
Syntax
SET STOP $LOSS xParameters
| Name | Type | Default | Description |
|---|---|---|---|
x | numeric | none | Maximum acceptable loss on the position, expressed in the currency of the traded instrument. |
How it works
$LOSS combines with SET STOP only. Instead of specifying a price distance, the instruction specifies a monetary outcome: when the unrealized loss on the position reaches x currency units, the platform closes it. Internally the money amount is converted into a price level using the position size and the instrument's point value, so the same x produces a tighter price stop on a larger position and a wider one on a smaller position.
The setting persists once executed. It protects the current position and every subsequent one until another SET STOP call overrides it, and SET STOP $LOSS 0 cancels the stop. A single unconditional call near the end of the code is the standard pattern.
On IG and PRT-CFD accounts the stop is attached to each individual order, so with cumulated orders every order carries its own money-based protection.
The target-side counterpart is SET TARGET $PROFIT. A target deliberately placed in the loss zone is a different, inverted form documented under Set Target Loss.
Examples
Example 1, MACD entry capped at a 200 currency-unit loss (ProBacktest)
myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0
IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Close the position once it loses 200 in account terms
SET STOP $LOSS 200The strategy buys on a MACD cross above zero. Regardless of where the entry fills, the trade is abandoned once the open loss reaches 200 currency units.
Example 2, Money stop on a short position (ProOrder)
fast = Average[10](close)
slow = Average[40](close)
IF NOT ShortOnMarket AND fast crosses under slow THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// The same money cap works for shorts, no sign change needed
SET STOP $LOSS 150The instruction is direction-agnostic. For a short position the exit level is computed above the entry so that the loss never exceeds 150 currency units.
Example 3, Money bracket with a 1:2 risk-reward ratio (ProOrder)
DEFPARAM CumulateOrders = false
IF NOT OnMarket AND close crosses over Highest[20](high)[1] THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Risk 100, aim for 200, both in the instrument currency
SET STOP $LOSS 100
SET TARGET $PROFIT 200Pairing SET STOP $LOSS with SET TARGET $PROFIT expresses the whole trade plan in money, which reads directly as risk-reward.
Common errors and gotchas
- Amount is per position, and size-dependent as a price distance. Doubling the number of contracts halves the price distance implied by the same
x. After changing position sizing rules, re-check that the implied stop still sits outside normal market noise. - Wrong SET pairing. The documented form is
SET STOP $LOSS. The money-based target isSET TARGET $PROFIT, a separate keyword. Combining$LOSSwithSET TARGETbelongs to the inverted forms and behaves differently. - Currency of the instrument, not the account.
xis denominated in the traded instrument's currency. On instruments quoted in another currency than the account, the realized loss in account terms varies with the exchange rate. - Shared stop slot.
$LOSS,%LOSS,PLOSS, trailing stops andBREAKEVENoverwrite each other; only the latestSET STOPcall is active. Choose one stop style per trade phase.
Related instructions
%LOSS, stop loss as a percentage of the position price.PLOSS, stop loss as a distance in points.$PROFIT, take profit as a fixed money amount.$TRAILING, trailing stop as a fixed money amount.BREAKEVEN, moves the stop or target to the entry price.STOP, pending stop orders and the SET STOP family.Set Target Loss, target placed in the loss zone, the inverted form.TRADEPRICE, entry price of a given trade.POINTVALUE, currency value of one point, used in money-to-price conversion.LONGONMARKET, true while a long position is open.
