Moving Open Trade Stop Losses to Break Even After a Profit Threshold
Summary
This function describes a trade-management rule for open buy and sell orders. Once price moves favorably by a configurable pip threshold, it modifies the order’s stop loss to the opening price, aiming to remove the trade’s initial price risk. Optional filters restrict processing to the current symbol, a selected strategy identifier, or both; with neither enabled, all qualifying orders are considered.
The example is implementation code rather than a tested trading strategy, and it provides no performance evidence. Its pip conversion uses a fixed multiplier, which may not suit every instrument’s quote precision. Moving a stop to entry also does not guarantee a flat result after spreads, commissions, slippage, or gaps. The function only adjusts orders whose existing stop loss remains on the adverse side of the entry, so trades with no stop loss or a stop already beyond entry may not be handled as expected.
Key ideas
- The function moves a buy or sell order’s stop loss to its entry price after a favorable move reaches the configured threshold.
- Optional symbol and strategy-identifier filters can limit which orders are processed.
- The logic operates on open orders and does not provide evidence of strategy performance.
- Its fixed pip conversion and entry-price stop do not account for all instruments or trading costs.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.