%LOSS

Category: ProBacktest

The %LOSS instruction in ProBuilder language is used to set a stop loss at a specified percentage below the average position price. This feature is crucial for managing risk by limiting potential losses on a trade. The stop loss is dynamically calculated based on the average price of the position and adjusts the exit point accordingly.

Syntax:

SET STOP %LOSS x

Where x represents the percentage loss at which the stop loss should be set.

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 stop loss at 2% from the average position price
SET STOP %LOSS 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 buy order, a stop loss is set to trigger at 2% below the average price at which the position was entered.

  • MACD Indicator: The Moving Average Convergence Divergence (MACD) 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.
  • Usage: The %LOSS instruction is particularly useful in automated trading systems where maintaining strict risk management protocols is essential. It helps in minimizing potential losses by automatically closing out positions that move against the trade by a specified percentage.

This instruction is applicable for individual orders with IG or PRT-CFD trading platforms, ensuring that each order adheres to the specified risk parameters independently.

Related Instructions:

  • PLOSS probacktest
  • Logo Logo
    Loading...