Skip to content
All library documents

Range-Bound Entries and Martingale Recovery in a Trading EA

Article MQL5 code base

Summary

The EA begins by placing a sell limit just above a recent high and a buy limit just below a recent low, using a configurable lookback. If neither side has opened a position, it can refresh those orders after a set number of bars. Trading-day and forbidden-date filters constrain when new entries are allowed. The parameters also control initial size, direction permissions, take profit on pending orders, and order expiry.

After a trade, the EA can add positions at a set adverse price distance, multiplying size for each step and limiting the series length. A floating-profit threshold closes all positions in the series. The document describes configurable mechanics rather than performance evidence: it provides no backtest or live results. It warns that increasing size after losses can lead to large drawdowns and capital loss. Market executions are opened without fixed stop loss or take profit, and the described entry logic and martingale direction behavior warrant careful review before use.

Key ideas

  • The EA places initial limit orders around the highest high and lowest low over a configurable lookback.
  • Trading-day and forbidden-date settings can restrict new orders.
  • The martingale sequence adds trades after adverse price movement and increases lot size by a multiplier.
  • A floating-profit target closes the series, while a maximum trade count limits its length.
  • The document gives no performance evidence and warns of high drawdown and capital-loss risk.

Tags

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