Skip to content
All library documents

Percentage-Based Trailing Stop Levels for Long and Short Positions

Article MQL5 code base

Summary

This indicator plots separate potential stop-loss levels for long and short positions. Its distance from the closing price is set by a percentage input, offering an alternative to an ATR-based trailing stop. The document describes the calculation as a stateful update: the prior stop and consecutive closes on one side determine whether the stop continues tightening or is reset relative to the current close.

The rules use the maximum of the prior stop and a lower price for a rising-side stop, or the minimum of the prior stop and a higher price for a falling-side stop. When price crosses the previous stop, the level is recalculated on the other side of the close. The document gives no performance tests, parameter guidance, or explicit initialization rule, and does not define how the percentage input is converted into the loss distance. Treat the plotted levels as an indicator description, not evidence that a particular setting will manage risk effectively.

Key ideas

  • The indicator derives a stop distance from a user-set percentage of the closing price.
  • It maintains separate potential stop levels for long and short positions.
  • Consecutive closes on one side of the prior stop cause the level to tighten monotonically.
  • A close crossing the previous stop resets the level to the other side of the current close.
  • The description supplies no performance evidence or initialization details.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.