$PROFIT

Category: ProBacktest

The $PROFIT instruction in ProBuilder language is used to set a specific profit target for a trading strategy. This instruction allows traders to specify an amount in the currency of the traded instrument, at which the position should be closed to capture a predetermined level of profit.

Syntax:

SET TARGET $PROFIT x

Here, x represents the profit target amount in the currency of the instrument.

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 100$
SET TARGET $PROFIT 100

In this example, a trading strategy is defined using the MACD indicator, where a buy order is placed if the MACD line crosses over the zero line and there is no long position already in the market. After placing the buy order, a profit target of $100 is set using the $PROFIT instruction.

  • 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 in the example checks for a specific event where the MACD line moves from below to above the zero line, indicating a potential entry point for a long position based on the momentum change.

This instruction is crucial for implementing risk management strategies within automated trading systems, ensuring that trades are closed at profit levels that align with the trader’s objectives.

Related Instructions:

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