PROFIT

Category: ProBacktest

The SET TARGET PROFIT instruction in ProBuilder language is used to define a specific profit target in trading strategies. This command sets a goal for the trading system to close a position once a specified profit level is reached, measured in the price units of the traded instrument.

Syntax:

SET TARGET PROFIT x

Here, x represents the number of price units (equal to the POINTSIZE of the instrument) that you aim to gain as profit.

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 profit target at 50 price units
SET TARGET PROFIT 50

In this example, a trading strategy is implemented using the MACD indicator. A buy order is placed when the MACD line crosses over the zero line, indicating a potential upward trend. The SET TARGET PROFIT 50 command specifies that the position should be closed once a profit of 50 price units is achieved.

  • The MACD (Moving Average Convergence Divergence) is a trend-following momentum indicator that shows the relationship between two moving averages of a security’s price. The MACD is calculated by subtracting the 26-period Exponential Moving Average (EMA) from the 12-period EMA.
  • The crosses over condition is used to detect when the MACD line crosses from below to above the zero line, typically signaling a potential entry point for a long position.

This instruction is crucial for automating trade exits at predefined profit levels, helping to manage risk and secure gains without manual intervention.

Related Instructions:

  • PPROFIT probacktest
  • %PROFIT probacktest
  • Logo Logo
    Loading...