Skip to content
All library documents

A Fixed Short Stop-Entry Scalper With Position Sizing and Trailing Stops

Article MQL5 code base

Summary

This MetaTrader expert advisor places a sell-stop entry below the current bid, then manages the pending order and any resulting position. It exposes settings for stop loss, take profit, spread and slippage limits, trading hours, and a magic number. Its volume function can use a fixed lot size or scale lots from free margin and a configured risk percentage. The code also adjusts price and slippage units for symbol precision and checks spread, volume, order distance, stop levels, and available funds before submitting an order.

The strategy logic is notably one-sided: the active signal branch submits a sell stop, while the buy-stop branch is present but not selected by the fixed order type. Trailing logic updates stops on open positions and repositions pending orders as prices move. The document gives implementation details, but no market rationale, backtest, or performance evidence. Its lot calculation is a simple free-margin formula rather than a demonstrated loss-based risk model, and the small configured stop distances may be sensitive to spread, execution, and broker constraints.

Key ideas

  • The configured order type is a sell stop placed below the current bid.
  • The advisor provides optional time, spread, volume, stop-distance, and margin checks before order submission.
  • Lot size can be fixed or estimated from free margin and a risk percentage.
  • Trailing logic adjusts stops on open positions and reprices pending stop orders.
  • The code describes mechanics but supplies no backtest or evidence that the setup is profitable.

Tags

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