Loading…

Ladder Ticket Group Manager

A ladder entry - several market orders filled at slightly different prices as a position is scaled in - is one trade in the trader's head but several unrelated tickets to MetaTrader 4, each with its own open price and its own stop-loss. Moving each ticket to its own breakeven individually makes no sense once they are meant to behave as one position; the correct breakeven is the group's blended average entry, not any single fill. This rebuilds group membership from the live order pool on every scan, rather than caching it once. Tickets sharing a symbol, a magic number and a direction that were opened within a configurable window of each other join one group; the group's average entry price, total volume and blended profit in pips are recomputed fresh each pass. Once the blended profit clears the configured trigger, every ticket still in that group is moved to the same shared breakeven price in one action, respecting each symbol's own stop and freeze level before sending any modification. Because group membership is derived live rather than stored, a ticket closed by hand or by another program simply drops out of its group on the next scan instead of leaving a stale, half-updated group behind. Notes and limitations - Only market orders (OP_BUY/OP_SELL) are grouped; pending orders are not part of a ladder group until they are filled. - A group never mixes directions - a buy ladder and a sell ladder on the same symbol and magic number are always tracked as separate groups. - The breakeven arm is one-shot per group per attach: once a group is marked armed it is not re-evaluated for a lower or higher lock level, even if more tickets are later added to a symbol/magic/direction that already armed. - This does not open, close or resize any position - it only reads the order pool and, if enabled, modifies stop-loss levels on existing tickets.

Expert advisor · MT5 · v1.0 · Free

About Ladder Ticket Group Manager

Ladder Ticket Group Manager is an expert advisor (trading robot) for MetaTrader 5. It moves the stop loss behind price (trailing stop / break-even). It has 8 settings, such as Magic filter, Group window seconds and Breakeven trigger pips. MQL source code included.

Files in the download: LadderTicketGroupManager.ex5, LadderTicketGroupManager.mq5, LadderTicketGroupManager.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Magic filter0Magic number to group; 0 = every magic number
Group window seconds300Positions on the same symbol opened within this many seconds of each other join one group
Breakeven trigger pips15.0Group's blended profit, in pips of the group's average entry, needed to arm breakeven
Breakeven lock pips1.0Pips beyond the average entry price the shared stop is set to once armed
Move whole group stopstruetrue = every position in an armed group gets the same breakeven stop
Scan interval sec5Seconds between group re-evaluation passes
Max retries5Attempts per PositionModify before giving up on a ticket
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Volume · Trailing Stop & Break-even · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria