$PROFIT
The $PROFIT instruction sets a take profit target as a fixed money amount in the instrument currency with SET TARGET $PROFIT in ProBacktest and ProOrder.
Syntax
SET TARGET $PROFIT xParameters
| Name | Type | Default | Description |
|---|---|---|---|
x | numeric | none | Profit at which the position closes, expressed in the currency of the traded instrument. |
How it works
$PROFIT combines with SET TARGET only. The instruction states the exit as a monetary outcome: once the unrealized profit on the position reaches x currency units, the platform closes it. The money amount is converted into a price level using the position size and the instrument's point value, so a larger position reaches the same money target with a smaller price move.
The setting is persistent. After it executes, it applies to the current position and to every future position until another SET TARGET call replaces it. SET TARGET $PROFIT 0 cancels the target. Strategies usually place the call once, unconditionally, near the end of the code.
On IG and PRT-CFD accounts the target is attached to each individual order, so with cumulated orders each order exits at its own computed level.
The stop-side counterpart is SET STOP $LOSS. A stop deliberately placed in the profit zone is the inverted form documented under Set Stop Profit.
Examples
Example 1, MACD entry with a 100 currency-unit target (ProBacktest)
myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0
IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Take the profit once the position has gained 100
SET TARGET $PROFIT 100The strategy buys on a MACD cross above zero and exits automatically once the open profit reaches 100 currency units.
Example 2, Money target on a short position (ProOrder)
resistance = Highest[20](high)
IF NOT ShortOnMarket AND close crosses under Average[50](close) THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
// Same instruction for shorts, the platform places the exit below entry
SET TARGET $PROFIT 80For a short position the exit level is computed below the entry price so the trade closes after an 80 currency-unit gain.
Example 3, Money bracket sized from a fixed risk budget (ProOrder)
DEFPARAM CumulateOrders = false
// Trade plan in money: risk 50 to make 150
riskAmount = 50
rewardAmount = 3 * riskAmount
IF NOT OnMarket AND RSI[14](close) crosses over 50 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
SET STOP $LOSS riskAmount
SET TARGET $PROFIT rewardAmountBoth sides of the bracket accept variables, so the risk-reward relationship can be written once and reused. Here the trade risks 50 to make 150.
Common errors and gotchas
- Wrong SET pairing.
$PROFITis documented withSET TARGET. The money-based stop isSET STOP $LOSS. Attaching$PROFITtoSET STOPbelongs to the inverted forms and places the exit on the other side of the entry. - Position size changes the price distance. The same
xon twice the contracts means half the price move to reach the target. After editing sizing logic, verify that the implied exit is not inside the spread. - Instrument currency, not account currency. The amount is measured in the currency the instrument trades in. Cross-currency accounts realize a slightly different amount depending on the exchange rate at exit.
- Shared target slot.
$PROFIT,%PROFIT,PPROFITandSET TARGET BREAKEVENwrite to the same internal target; the most recentSET TARGETcall wins. Re-arming with different values per bar reprices the exit silently.
Related instructions
%PROFIT, take profit as a percentage of the position price.PPROFIT, take profit as a distance in points.$LOSS, stop loss as a fixed money amount.$TRAILING, trailing stop as a fixed money amount.BREAKEVEN, moves the stop or target to the entry price.TARGET, pending target orders and the SET TARGET family.Set Stop Profit, stop placed in the profit 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.
