Closing Symbol Positions When Price Meets a Moving Average
Summary
This document explains a MetaTrader expert advisor that closes open trades for the chart’s symbol when price reaches a moving average. In Stealth Mode, buy trades close when the bid is at or below the average, while sell trades close when the ask is at or above it. In Spread Mode, trades close when the moving average lies between bid and ask. The stated gap behavior differs: Stealth Mode closes at the first available price after a gap, while Spread Mode waits for price to return across the average or for manual closure.
The advisor can manage trades across charts for the same symbol and offers alerts, including mobile push notifications for closed trades. The document warns against attaching it to multiple charts for the same symbol, since multiple instances can close trades unexpectedly. It also explains that manually opened orders lack magic numbers, limiting the advisor’s ability to identify and control them selectively. No backtest or performance evidence is provided; this is operational guidance for an exit tool, not proof that a moving-average exit improves results.
Key ideas
- The advisor closes buy and sell trades according to separate bid and ask comparisons with a moving average.
- Spread Mode triggers when the average lies between bid and ask, while Stealth Mode uses directional price thresholds.
- After a price gap, the two modes handle exits differently.
- The advisor acts across charts for the same symbol, so multiple instances can cause unintended closures.
- Manually opened orders lack magic numbers, which limits selective order control.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.