Stepwise Trailing Stops for Managing Open Trades
Summary
This document provides a MetaTrader-style function for adjusting stop losses on open buy and sell orders. It can filter which orders it manages by symbol and magic number. For a buy, the logic first allows a stop to be placed at a configured initial level after price advances by a starting threshold, then raises that stop in increments as the bid moves sufficiently beyond it. The sell branch applies the corresponding downward movement as price falls. The function also normalizes stop prices to the instrument’s digits and reports order-modification errors.
The example describes trade management rather than an entry signal, and it does not provide performance tests or guidance for choosing the start and step distances. Its behavior depends on platform price units, order settings, and whether an initial stop has already been placed. The source contains a suspicious comparison in the sell-side initial-stop branch, so it should be reviewed before use. It does not explain slippage, rejected modifications, or broker stop-distance rules, which can affect actual execution.
Key ideas
- The function can manage all open orders or restrict updates by symbol and magic number.
- It places an initial stop after price moves by a configured starting distance.
- After activation, the stop advances in fixed increments as price moves favorably.
- Buy and sell positions use mirrored stop adjustment logic.
- The example lacks parameter validation and performance evidence, and its sell-side logic merits review.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.