%PROFIT

Category: ProBacktest

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.

Syntax:

SET TARGET %PROFIT x

Where x represents the percentage increase from the average position price at which you want to set your profit target.

Example:

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.

  • The MACD (Moving Average Convergence Divergence) indicator is used here to determine the entry point. It is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price.
  • The %PROFIT instruction is useful in automating the exit strategy by setting a profit target, which can help in emotion-free trading and disciplined profit taking.

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.

Related Instructions:

  • PPROFIT probacktest
  • Logo Logo
    Loading...