Skip to content
All library documents

Swing EA with Opposite Stop Orders and Increasing Position Sizes

Article MQL5 code base

Summary

This expert advisor starts a cycle by comparing the latest two bar closes: it opens a buy after an upward change and otherwise opens a sell. It then places a pending stop order in the opposite direction, a configurable distance from the current price. If that order triggers, the EA places another opposite stop order with volume adjusted by a lot coefficient, potentially multiplying the total open volume. The system is intended for hedge accounts and includes inputs for stop loss, take profit, trailing controls, position and volume limits, profit targets, equity-based pauses, trading hours, and startup position closure.

The document explains configurable mechanics rather than presenting performance evidence or a tested risk profile. Its repeated, increasing-volume order sequence can accumulate exposure; the listed caps and equity pause are controls, not proof that losses are bounded under all market conditions. It recommends optimizing on small timeframes, beginning with stop loss, take profit, and order spacing, but gives no optimization results or validation procedure.

Key ideas

  • The EA chooses its initial direction by comparing the current bar close with the prior bar close.
  • Each open position is paired with an opposite-direction pending stop order placed at a configurable distance.
  • Triggered orders restart the opposite-side cycle with volume influenced by a lot coefficient and optional total-volume multiplication.
  • The EA requires a hedge account and includes configurable trade limits, exits, equity controls, and trading hours.
  • The document provides no measured results and recommends parameter optimization without describing out-of-sample validation.

Tags

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