The TRAILING instruction in ProBuilder language is used to set a trailing stop order, which is a dynamic stop order set at a specific number of points away from the current market price. This type of stop adjusts as the price of the asset moves, providing a flexible approach to managing risk while allowing potential profits to grow.
SET STOP PTRAILING x
Where x represents the number of points the trailing stop should be set away from the current market price.
// Define moving averages
i1 = average(close)[100]
i2 = average(close)[5]
// Define entry and exit conditions
tradeinitiate = Close > i1 AND Close < i2 AND Low[3] > Low[2] AND Low[2] > Low[1] AND Low[1] > Low
tradeclose = Close > Close[1]
// Execute trade
IF NOT LongOnMarket AND tradeinitiate THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
IF LongOnMarket AND tradeclose THEN
SELL AT MARKET
ENDIF
// Set a trailing stop loss
SET STOP PTRAILING 10
In this example, a trailing stop is set to maintain a distance of 10 points from the current market price. This stop will adjust as the market price moves, securing profits while limiting potential losses.
This instruction is essential for traders who want to manage their risk dynamically, adapting their strategies to market conditions without needing to manually reset their stop levels.