Skip to content
All library documents

ATR-Based Trailing Stop Levels for Long and Short Positions

Article MQL5 code base

Summary

This document describes an indicator that plots possible stop-loss levels separately for long and short positions. Users set a calculation period and a coefficient that scales the distance between price and the stop level. The distance is based on a Wilder-smoothed average of a range measure constructed from intrabar range and gap-adjusted high and low references.

The stop line updates according to the close’s position relative to its previous value: it can move with price while applying a minimum or maximum constraint to avoid moving backward in the stated direction. The document provides formulas for the range components and update rules, but does not give parameter-selection guidance, market examples, or performance tests. It describes indicator levels rather than a complete entry, exit, or risk-management system, so suitability and results would depend on further testing.

Key ideas

  • The indicator plots candidate stop levels for both long and short positions.
  • Its distance uses a coefficient multiplied by a Wilder-smoothed range estimate.
  • The range estimate accounts for intrabar movement and gaps relative to prior prices.
  • The stop level updates from closing prices and prior stop values.
  • The document provides no empirical results or guidance for choosing parameters.

Tags

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