$LOSS

Category: ProBacktest

The $LOSS instruction in ProBuilder language is used to set a stop loss level in terms of a fixed monetary amount. This feature is crucial for managing risk by specifying the maximum amount of money a trader is willing to lose on a single trade. When the loss on a position reaches the specified amount, the position is automatically closed, thus preventing further losses.

Syntax:

SET STOP $LOSS x

Here, x represents the monetary amount (in the currency of the traded instrument) that the trader is willing to lose.

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 $200 loss
SET STOP $LOSS 200

In this example, a trading strategy is implemented where a buy order is placed if the MACD indicator crosses over zero and there is no existing long position. Immediately after entering the position, a stop loss is set to limit the potential loss to $200.

  • 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 SET STOP $LOSS command is crucial for risk management, ensuring that losses do not exceed a predetermined amount.

This instruction is particularly useful for traders who want to ensure strict risk management in their automated trading strategies, helping to preserve capital by avoiding large losses.

Related Instructions:

  • %LOSS probacktest
  • PLOSS probacktest
  • Logo Logo
    Loading...