Ticket Lock Copier

Ticket Lock Copier copies trades from one MetaTrader 5 terminal (the master) to another (the receiver) when both run on the same PC or the same VPS. The two terminals talk through files in the common data folder. There is no DLL, no WebRequest and no external server. One EA has two roles: set it to MASTER on the source account and to SLAVE on the account that copies.

It is for traders who run a signal account and a second account on the same machine, who manage several accounts of their own, or who want a copy with a different lot size on another broker. It is not a trading strategy and it does not create signals. It only repeats what the master account already does.

Reviews of local copiers often describe the same failure: the receiver opens the same master trade again and again, sometimes every second, until the account is gone. This EA is built around that one problem. Before it sends an order, it writes the master ticket into a ticket book saved on disk. The book is read again after a terminal restart. A ticket that is in the book is not opened a second time.

How the ticket lock works

  • The master ticket is stored in the book first, with the state "in flight", and only then is the order sent. The copy carries the comment TLC#ticket.
  • No new order is sent if the ticket is already in the book, or if a position or order with that tag already exists on the receiver.
  • If you close the copy by hand, or its SL or TP is hit, the ticket is marked as closed on the receiver and it is not opened again. There is an optional input that allows one reopen. It is off by default.
  • If the broker answers with a doubtful result (timeout, requote, price changed, no answer), the order stays "in flight". Before any retry, the EA checks the live positions and the deal history for the tag. It retries only if nothing is found, up to a set number of attempts per ticket.
  • Removing and re-attaching the EA, or restarting the terminal, does not clear the book. The book file is named by receiver account, channel and master account.
  • A ticket blocked by a cap or a rule is not retried. It stays in the book and in the CSV log, and the Experts log gets one line with the reason.

Hard caps, on by default

The receiver has limits that work from the first run. You can change them, or set them to 0 to turn them off.

  • Maximum lot per copied trade: 2.0. Larger copies are cut to this size.
  • Maximum total copied lots open: 10.0. If a new copy does not fit, that ticket is blocked.
  • Maximum copied positions open: 10. If the number is reached, that ticket is blocked.
  • Daily loss limit of the receiver: 3% of the day-start balance. When it is hit, no new copies are opened until the next day. Optionally it also closes the copied trades.

Stop loss on the server

Every copy is sent with its SL from the first order. If the master trade has no SL, the default policy adds an emergency SL calculated so that the trade risks 2% of the receiver equity. You can choose instead to skip trades that have no SL. A copy never removes an SL that is already set.

What it copies

  • Open positions, with SL and TP changes.
  • Partial closes (proportional volume) and full closes.
  • Pending orders, if you turn that on. Only LIMIT and STOP types.
  • Symbol mapping between brokers, for names like XAUUSD and GOLD#.
  • Optional inverted copy: buy becomes sell, and SL and TP are swapped.

Lot size on the receiver, by mode:

  • Multiplier of the master lot (default 1.0), or the same lot.
  • Risk percent of the receiver equity, using the distance to the master SL. If the master trade has no SL, it falls back to the multiplier and logs it.
  • Proportional to equity (receiver equity divided by master equity, sent in the snapshot).
  • Fixed lot. It is one option among others, not the only one.

All lots go through the same normalization: step, minimum and maximum of the symbol, the symbol volume limit, and a reduction when free margin is not enough.

Other safety rules

  • By default it copies only trades opened after the EA started, and never a trade older than 60 seconds.
  • Heartbeat: if the master file is not updated for 30 seconds, the receiver opens nothing new and the panel shows STALE. It does not close anything because of this.
  • The snapshot file is written to a temporary file and then moved into place. It has a checksum that the receiver verifies. A half-written file is discarded.
  • The master never republishes positions whose comment starts with TLC#, so an account that is both receiver and master does not create a loop.
  • Master and receiver wait a few seconds after start and until the account data is loaded, to avoid publishing an empty list or reading the account wrongly before the terminal is synchronized.
  • SL and TP changes are compared before sending. If the change is not safe for the stops level, freeze level or spread, it is skipped and tried again later.

Symbol mapping

The receiver looks for the symbol in this order:

  1. The explicit map you write, for example XAUUSD=GOLD#;US30=US30Cash#.
  2. The same name.
  3. An automatic match by prefix or suffix. It searches the Market Watch first, then all broker symbols, and takes the shortest name that contains the base symbol.

If no symbol is found, that trade is not copied.

How to set it up

Both terminals must run under the same Windows user on the same PC or VPS, so they share the common data folder.

Master terminal:

  1. Open any chart and make sure Algo Trading is on.
  2. Attach the EA and set InpRole to MASTER. Choose a channel name, for example myChannel. Use one channel per master.
  3. Optional: filter by magic numbers, symbols or comment text, so only some trades are published.
  4. The panel should show that it is publishing, and the file TLC_myChannel.snap should appear in the common folder.

Receiver terminal:

  1. Open any chart and make sure Algo Trading is on.
  2. Attach the EA and set InpRole to SLAVE. Use the same channel name.
  3. Optional: write the master account number in InpMasterLogin so only that account is accepted.
  4. Choose the lot mode and check the caps. Write a symbol map if the names differ.
  5. The panel should show that the master heartbeat is OK.
  6. Test on two demo accounts first. Open a small trade on the master, close the copy by hand on the receiver, and check that it is not opened again, also after removing and re-attaching the EA.

If one receiver follows several channels, use a different InpMagic for each channel.

Inputs

General

  • InpRole (default MASTER): MASTER or SLAVE.
  • InpChannel (default "default"): channel name, letters and digits. One per master.
  • InpTimerMs (default 250): work timer in milliseconds.
  • InpCopyPendings (default false): also publish and copy pending orders.
  • InpWriteCsv (default true): write the action log.
  • InpAlerts (default false): terminal alerts on important events.

Master: what to publish

  • InpMasterMagics (default empty): magic numbers to publish, comma list. Empty = all.
  • InpMasterSymbols (default empty): symbols to publish, comma list. Empty = all.
  • InpMasterComment (default empty): publish only positions whose comment contains this text.
  • InpHeartbeatSec (default 5): rewrite the snapshot at least every N seconds.

Receiver: copy rules

  • InpMasterLogin (default 0): accept only this master account. 0 = any.
  • InpMagic (default 240923): magic number of copied trades. Use one per channel.
  • InpCopyExistingOnStart (default false): copy trades already open when the EA starts.
  • InpMaxAgeSec (default 60): never copy a trade older than N seconds. 0 = no limit.
  • InpReopenIfClosedOnSlave (default false): allow one reopen of a copy closed on the receiver.
  • InpMaxOpenRetries (default 3): maximum send attempts per master ticket.
  • InpInflightTimeoutSec (default 8): seconds to wait before checking an unconfirmed order.
  • InpMasterTimeoutSec (default 30): no heartbeat for N seconds = no new copies.
  • InpCopySlTp (default true): synchronize SL and TP changes.
  • InpCopyPartials (default true): synchronize partial closes.
  • InpInvert (default false): copy inverted.
  • InpSymbolMap (default empty): symbol map, for example XAUUSD=GOLD#;US30=US30Cash#.
  • InpSlippagePoints (default 30): maximum slippage in points.

Receiver: lot size

  • InpLotMode (default Multiplier): multiplier, same lot, risk percent, proportional to equity, or fixed lot.
  • InpLotMultiplier (default 1.0): used in multiplier mode.
  • InpRiskPct (default 1.0): percent of equity per trade, in risk mode.
  • InpFixedLot (default 0.01): used in fixed lot mode.

Receiver: hard caps

  • InpMaxLotPerTrade (default 2.0): maximum lot per copied trade. 0 = off.
  • InpMaxTotalLots (default 10.0): maximum total copied lots open. 0 = off.
  • InpMaxPositions (default 10): maximum copied positions open. 0 = off.
  • InpDailyLossPct (default 3.0): daily loss limit, % of day-start balance. 0 = off.
  • InpCloseOnDailyLoss (default false): also close the copied trades when the daily limit is hit.
  • InpNoSlPolicy (default Emergency SL): add an emergency SL, or skip trades without SL.
  • InpEmergencyRiskPct (default 2.0): percent of equity at risk with the emergency SL.

Panel

  • InpShowPanel (default true), InpCorner (default top left), InpFontSize (default 9) and five color inputs.

Strategy Tester

  • InpTesterDemo (default true): demo with a simulated master, tester only.

Panel and log

The panel shows the role, channel, heartbeat state, the time of the last copy (from the moment the master wrote the snapshot until the receiver confirmed the order, measured with the system clock, so it is valid only on the same PC), copied positions and lots, counters, the daily lock, the last event and the last error.

With InpWriteCsv on, every action is written to MQL5\Files\TLC_log_channel.csv. Semicolon separated. Columns: time; event; symbol; ticket; volume; price; retcode; equity; detail.

What it does not do

  • It does not copy between different PCs or over the internet. There is no network or cloud part, on purpose.
  • It does not generate signals and it does not choose trades. It copies the master.
  • It does not copy trades older than the age limit, and by default it does not copy trades that were open before it started.
  • It does not close the copies when the master heartbeat stops. It only stops opening new ones.
  • It does not guarantee the same price, the same fill or the same result as the master. The receiver is a different account, with its own broker, spread, execution and slippage.
  • It does not replace your own risk management and it does not make a strategy profitable.

Limitations

  • Same PC or VPS only. Both terminals need to share the common data folder, which is normal under the same Windows user.
  • One channel per master. If several masters write to the same channel, they overwrite the same file.
  • Netting accounts: opposite tickets on the same symbol are offset in the net position, so the copy is approximate. SL and TP are synchronized only when there is a single copied trade on that symbol. Manual closes on the receiver are not detected by ticket (the EA avoids reversing the position, nothing more). Volume increases of a master ticket, when netting adds to a position, are not copied. Hedging accounts keep one position per master ticket.
  • Pending orders: only LIMIT and STOP types, not STOP_LIMIT. Expiration is not copied. If the master pending order is triggered, the receiver deletes its pending order and opens at market, as long as the trade is within the age limit.
  • If you change the master filters (magic, symbol, comment), the filtered trades disappear from the snapshot and the receiver closes its copies of them.
  • The ticket lock depends on the book file in the common folder. If that file is deleted, or you change channel or master account, a new book starts empty.
  • The terminal must be running, connected, with Algo Trading enabled. If the master or the receiver is off, nothing is copied. A VPS is a common choice, but that is your decision.
  • Closing and opening are at market. Slippage, requotes and rejected orders happen, and a copy can fail or open at a different price.
  • Caps limit the exposure of copied trades but do not remove the risk. The final loss can be larger than the daily limit, because of gaps, slippage or trades that cannot be closed when the market is closed.

Strategy Tester demo

The tester has no master terminal. If InpTesterDemo is on (tester only, never on a real or demo account chart), the EA simulates an internal master. At most twice a day it opens a trade with a stop loss based on the H1 ATR (wider, with lower risk, on symbols with a wide spread), moves its SL after one hour, closes part of it after two hours, and closes it after three hours. Each simulated snapshot goes through the same reconciliation code that the receiver uses, so opening, ticket lock, modification, partial close and close are all exercised.

When a trade opens, the same snapshot is processed 4 times and the EA prints one line in the Experts log, in this form:

TicketLockCopier demo: ticket 9000001 processed 4 times -> sends=1 live copies=1 (ticket lock OK, no duplicate)

If the minimum lot risks too much for the account (gold, or USDZAR with a small balance) or there is not enough margin, it opens no trade and prints a message once. The book is not saved in the tester, and the demo is only to show the behavior, not a result.

Notes

  • Works on any symbol and any timeframe, on hedging and netting accounts (see the netting limits above).
  • Test with two demo accounts and small lots before using it on live accounts.

Risk warning: trading leveraged products carries a high risk of loss. This tool copies trades, it is not trading advice and it does not guarantee any result. The caps reduce, but do not remove, the risk of copying trades from another account.

Другие продукты этого автора
Trend Pulse Detector
Jorge Eliecer Valencia Ferreira
**What it does** Trend Pulse Lite draws a 50 EMA on the chart and paints it according to the market state: - Green: uptrend. - Red: downtrend. - Gray: range, or a trend too weak to be taken seriously. A moving average alone always has a slope, even if the price has been moving sideways for hours. That is why here the trend requires two conditions: an ADX above the minimum and a moving average slope large enough relative to the ATR. Because the slope is divided by the ATR, the same threshold
FREE
TrendScalp XAUUSD
Jorge Eliecer Valencia Ferreira
TrendScalp XAUUSD — Smart Directional Scalping for Gold TrendScalp XAUUSD is a 100% automated Expert Advisor (EA) specifically engineered to capitalize on high-frequency, high-probability momentum in the Gold market (XAUUSD). Capital preservation is our highest priority: this algorithm does NOT use high-risk strategies such as Martingale, uncontrolled hedging, or Grid systems. Every trade operates with a predefined exit plan and strict filtering to protect your account at all times. How Do
Gold Regime Signal
Jorge Eliecer Valencia Ferreira
**What it does** Gold Regime Signal watches XAUUSD (and gold CFDs under any broker suffix) for multi-candle continuation moves and only signals when the underlying regime supports it. Most entry indicators fire on every strong-looking candle, including inside flat, choppy ranges — where a signal is the least reliable. This one checks market regime first (trend strength via ADX, directional movement, and higher-timeframe alignment) and only then looks for the candle pattern. No regime, no signal
Trend Pulse Multi Timeframe
Jorge Eliecer Valencia Ferreira
**What it does** Trend Pulse Pro colors a 50 EMA according to the market state: green in an uptrend, red in a downtrend, and gray in a range. To decide which is which, it combines two things: trend strength (ADX) and the moving average's slope divided by the ATR. Dividing by the ATR ensures the same threshold works on gold, a forex pair, or an index, without readjusting it every time volatility changes. Along this line, the indicator prints buy and sell arrows based on a 9/21 EMA crossover. M
Market Validation Inspector
Jorge Eliecer Valencia Ferreira
Market Validation Inspector reads the broker specification of a symbol and compares it with the settings your Expert Advisor uses: lot size, stop loss distance, take profit distance and risk per trade. It marks each check as OK, WARN or FAIL, so you can see which symbols and conditions are likely to cause trade errors before you upload an EA to the Market. It is for developers who prepare EAs for the Market. The automatic validation runs the EA on several symbols and rejects it on trading errors
Indicator Repaint Inspector
Jorge Eliecer Valencia Ferreira
Repaint Inspector watches another indicator and records, with times and values, whether it changes what it showed on bars that are already closed. It does not tell you what to trade. It only keeps a log of what the other indicator did. Repainting is one of the most common complaints in indicator reviews: arrows that appear and disappear, signals that are not there when you look at the history later, values that move after the bar closed. A backtest or a screenshot cannot show it, because you onl
EA Behavior Inspector
Jorge Eliecer Valencia Ferreira
EA Behavior Inspector reads the closed trades of your account and shows how each Expert Advisor really trades, grouped by magic number. It looks for six behaviours that traders often discover only after a bad week: martingale, grid or averaging down, trades without stop loss, holding losers much longer than winners, one loss far bigger than the average win, and a large jump in lot size. The reason is simple. A backtest or a sales page says little about how an EA behaves on a real account. Review
Daily Loss Guard
Jorge Eliecer Valencia Ferreira
Daily Loss Guard watches the equity of your account and enforces a daily loss limit that you set. When the loss for the day reaches the limit, it closes the open positions, deletes the pending orders, and keeps closing anything opened afterwards until the next daily reset. Every action is written to a CSV log with the time, ticket, price and retcode. It is for traders who run one or several Expert Advisors, trade manually, or work on a prop firm account with a daily drawdown rule, and want a rul
Lean Trade Panel
Jorge Eliecer Valencia Ferreira
Lean Trade Panel is a manual trading panel for the chart. You choose how much to risk, set the stop loss, and press Buy or Sell. The panel works out the lot size from the real value per point of the symbol, sends the order with the stop loss and take profit attached on the server, and shows the lot, the money at risk and the R:R before you click. It is for traders who enter by hand and for prop firm traders who need a daily loss cut-off, a spread filter and a cap on open positions. It has no ent
Magic Ledger
Jorge Eliecer Valencia Ferreira
Magic Ledger is a table on your chart with one row for every Expert Advisor running on the account, identified by its magic number (0 is manual trading). For each one it shows the trade count, net result, profit factor, win rate, expectancy, longest losing streak, the closed drawdown, an estimate of the floating drawdown, and the ratio between the two. A journal that only reads closed trades hides the loss that was open while the trades were running. With grid or averaging EAs this matters a lot
Фильтр:
Нет отзывов
Ответ на отзыв