Step 7: Trailing Stoploss

You can not only set a Stop Loss for the position but also periodically adjust its value. For example, you can tighten it as the price moves in a profitable direction, thereby reducing potential losses. This adjustment of the protective level is known as a trailing stop. Traders often use trailing stops to lock in profits while minimizing their risk.

There are many variants of trailing stops: you can simply adjust the Stop Loss as the price moves by a given distance. You can also choose to start moving the Stop Loss only when the position reaches a certain level of profitability, at which point it is immediately moved to the break-even level. This standard method is built into ESB. Additionally, you can use a custom trailing stop and define any desired method through Expressions. For example, a trailing stop can be based on technical indicators like moving averages, which allows you to avoid reacting to short-term price changes. It can also be based on indicators such as Ichimoku or Parabolic SAR (Stop and Reverse), even though the latter was not originally designed for this purpose.

To set up a trailing stop, you need to configure the options in three blocks: Trailing Start, Trailing Step, and Trailing Stop. In the first block, determine when the trailing stop should start. In the second block, set the trailing steps, and in the third block, determine how the Stop Loss will move in the direction of the price movement.

  • Trailing Start:

As mentioned earlier, the first step in trailing is to set a start condition. Once this condition is met, the trailing process will begin. There are several modes for determining the conditions to start trailing.

Start After Fixed Distance: Start trailing after the price moves a fixed number of points in profit, determined by the “Fixed Distance” parameter.

Start After Fixed Profit: Start trailing after the price reaches a fixed profit (in the currency of the account), determined by the “Fixed Profit” parameter.

Start After N SL: In this case, ESB starts trailing after the price moves in profit by a proportion of the Stop Loss. This proportion can be set by the “SL Ratio” parameter.

Start After N ATR Ratio: ESB starts trailing after the price moves in profit by a proportion of the ATR indicator. This method is very popular among traders. The proportion can be set by the “ATR ratio(N)” parameter. There is also a parameter for setting the “ATR Period“.

Start When Expressions: If none of the above modes fit your trailing start conditions, you can define them using “Buy/Sell Expression“. The ESB checks these conditions, and once they are true, the trailing process begins.

  • Trailing Step:

Suppose trailing has started; now, how should ESB check the trailing condition? Should it check continuously, or only after the price moves further in profit? If the trailing process needs to be continuous, select “Continuous (No Step)” mode. However, if you want ESB to wait for the price to move by a step before adjusting the Stop Loss again, you can choose from the following modes:

Fixed Step: In this mode, ESB will wait for the price to move a fixed number of points in profit before adjusting the Stop Loss again. The size of the step can be determined by the “Fixed Distance” parameter.

Stoploss Ratio: In this mode, the size of trailing steps is determined by a ratio of the Stop Loss. For example, if the Stop Loss is 40 pips and you set the “SL Ratio” to 0.2, the step size will be 8 pips. This means that every time the price moves 8 pips in profit, ESB adjusts the Stop Loss and waits for the next 8 pips.

N ATR: This mode determines the size of steps based on a ratio of the ATR indicator. ATR parameters include “ATR period” and “ATR ratio(N)”.

Custom Step Expressions: As mentioned earlier, you can define custom steps by writing “Buy/Sell Expressions“. ESB calculates these expressions and uses their values as the size of each step.

  • Trailing Stop:

Once trailing has started and the price moves by one step in profit, the ESB adjusts the Stop Loss. In the Trailing Stop block, you can set how ESB should adjust the Stop Loss. ESB supports all types of trailing stops as described here.

Fixed Distance: Like other parts, ESB can adjust the Stop Loss to a fixed distance from the current price. You can set this by the “Fixed Distance” parameter in points.

Profit Lock: In this mode, you can set a percentage to the “Profit Lock” parameter, and ESB will adjust the Stop Loss to secure that percentage of the profit. For example, if you set the profit lock to 70%, the Stop Loss will be adjusted to lock in 70% of the profit at every step. In this case, if the price hits the Stop Loss, you will only lose 30% of the profit.

By Moving Average: This is a popular method for tracking price movements. You can set a moving average indicator using the “Mode“, “Applied Price“, and “Shift” parameters, and ESB will adjust the Stop Loss based on this moving average. Note that the shift refers to the candle number and should not be confused with the Moving Average shift.

N ATR: In this method, ESB uses a ratio of the ATR indicator to adjust the Stop Loss. You can set ATR parameters using the “ATR period” and “ATR ratio“. At every step, ESB adjusts the Stop Loss to maintain a distance based on the ATR ratio. For example, if the ATR value is 0.00150 and the price is 1.16500, with an ATR ratio set to 2.0, for a buy position, the Stop Loss would be set at 1.16500 – 2.0 * 0.00150 = 1.16200, and for a sell position, it would be set at 1.16800.

By Expressions: If none of the above modes fit your trailing stop method, you can define it using “Buy/Sell Expressions“. The ESB calculates this expression and uses its result as the value of the Stop Loss.