Skip to content
All library documents

Two-Sided Per-Bar Expert Advisor with Take-Profit Exits

Article MQL5 code base

Summary

This Expert Advisor is designed for hedge accounts and holds opposing long and short positions. At each new bar, it closes existing positions and opens a buy and a sell simultaneously. The intended outcome is for one side to reach its take-profit level during the bar, while the other side may benefit if price reverses slightly.

Configurable parameters include initial lot size, a multiplier for increasing volume when positions are already open, a maximum lot cap, take-profit distance in points, and a unique identifier. The description provides no backtest, performance figures, transaction-cost analysis, or risk controls beyond the volume cap. Because both directions are opened and position sizing may increase, actual results would depend on spread, execution, and price movement; the brief description does not establish that the expected reversal behavior is profitable.

Key ideas

  • The Expert Advisor requires a hedge account and opens long and short positions together.
  • At each new bar, it closes existing positions before opening a new opposing pair.
  • The stated exit mechanism is a take-profit level for whichever position moves favorably.
  • Inputs control volume, volume scaling, maximum size, take-profit distance, and the EA identifier.
  • The description provides no evidence that the approach is profitable after trading costs.

Tags

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