The %PROFIT instruction in ProBuilder language is used to automatically set a target profit level as a percentage above the average position price. This feature is particularly useful for traders who want to lock in profits at a predetermined level relative to their entry price. The instruction calculates the target profit for each individual order placed, making it a dynamic tool for managing trading positions.
SET TARGET %PROFIT x
Where x represents the percentage increase from the average position price at which you want to set your profit target.
myMACD = MACD[12,26,9](close)
long = myMACD crosses over 0
IF NOT LongOnMarket AND long THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Set a target profit at 2% from the average position price
SET TARGET %PROFIT 2
In this example, a trading strategy is implemented using the MACD indicator, where a buy order is placed if the MACD line crosses over the zero line and there is no existing long position. Following the order, the %PROFIT instruction sets a profit target at 2% above the average price at which the contract was bought.
This instruction is applicable for trading with IG or PRT-CFD platforms, where it automatically calculates and sets the profit target based on the specified percentage.