Skip to content
All library documents

Using Parabolic SAR as an Accelerating Trailing Stop

Article MQL5 code base

Summary

This expert advisor demonstrates using Wilder’s Parabolic Stop and Reverse as a trailing stop for existing positions. On each new bar, it updates the stop level toward the position’s favorable price extreme. The acceleration factor rises in fixed increments when a new extreme is reached and is capped at a configured maximum, causing the stop to move faster as the trend extends. The document provides separate update equations for long and short positions, based on the prior stop, the extreme point, and the acceleration factor.

Unlike Wilder’s original reversal concept, this implementation treats SAR as a stop manager rather than a rule that automatically reverses a position when price touches the level. It supports an initial stop, optional randomly opened demonstration trades, and a timer delay between new trades; the trailing logic can also manage positions opened manually or by another expert. No backtest or performance evidence is provided, and the random-entry option is for illustration rather than a validated entry strategy.

Key ideas

  • The advisor updates the trailing stop at each new bar using the Parabolic SAR recurrence.
  • The stop moves toward the most favorable price extreme recorded since trailing began.
  • The acceleration factor increases when price sets a new extreme and stops increasing at its configured cap.
  • This implementation manages stops rather than automatically reversing a position when price reaches SAR.
  • Random entries are optional and serve to demonstrate the stop logic, not to define a tested strategy.

Tags

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