Product URL : https://www.mql5.com/en/market/product/165363
Overview
The EX5 Signal Copier Library converts MT5 trade events into structured signals.
Your EA reads these signals and decides what to do.
Architecture
Trade occurs ↓ OnTradeTransaction() ↓ Library processes event ↓ Signal added to queue ↓ Your EA reads signal ↓ You execute logic
Installation
-
Copy library:
-
Include in your EA:
-
Attach EA to chart
Call in OnInit() :
SCL_Init( sourceMagic, sourceSymbol, enableCopy, copyMagic, lotMultiplier, slippage, logToFile, printToExperts, verboseMode );Parameters
| Parameter | Description |
|---|---|
| sourceMagic | Filter trades by magic (0 = all) |
| sourceSymbol | Filter symbol ("" = all) |
| enableCopy | Enable built-in copier |
| copyMagic | Magic number for copied trades |
| lotMultiplier | Lot scaling |
| slippage | Allowed slippage |
| verboseMode | Debug logs |
Event Handling
You must forward trade events:
void OnTradeTransaction(...) { SCL_OnTradeTransaction(trans, request, result); }
Polling (Backup)
void OnTimer() { SCL_Poll(); }
Reading Signals
while(SCL_GetSignalCount() > 0) { SCL_ReadSignal(...); }
Signal Fields
| Field | Meaning |
|---|---|
| action | BUY / SELL / CLOSE |
| event_type | OPEN / MODIFY |
| symbol | Instrument |
| volume | Lot size |
| price | Entry price |
| sl / tp | Stop loss / Take profit |
| ticket | Position ID |
Actions
| Action | Meaning |
|---|---|
| SCL_ACTION_BUY | Buy position |
| SCL_ACTION_SELL | Sell position |
| SCL_ACTION_CLOSE_POSITION | Close |
| SCL_ACTION_MODIFY_POSITION | SL/TP change |
| SCL_ACTION_PARTIAL_CLOSE | Partial close |
Example 1 — Simple Copier
if(action == SCL_ACTION_BUY) { SCL_CopyBuy(symbol, volume, sl, tp, "Copy"); } if(action == SCL_ACTION_SELL) { SCL_CopySell(symbol, volume, sl, tp, "Copy"); }
Example 2 — Reverse Trading
if(action == SCL_ACTION_BUY) { SCL_CopySell(symbol, volume, tp, sl, "Reverse"); }
Example 3 — Risk Management
if(volume > 1.0) volume = 1.0; SCL_CopyBuy(symbol, volume, sl, tp, "RiskManaged");
Example 4 — Filter by SL/TP
if(sl == 0 || tp == 0) return;
Example 5 — Send to External API (Binance)
if(action == SCL_ACTION_BUY)
{
orderMarket("BUY", symbol, volume, price);
}
Example 6 — Limit Orders
if(action == SCL_ACTION_BUY_LIMIT) { PlaceLimit(symbol, volume, price); } Example 7 — Close Sync
if(action == SCL_ACTION_CLOSE_POSITION) { CloseExternalTrade(ticket); } Utility Functions
SCL_GetActiveOrderCount(); SCL_GetActivePositionCount(); SCL_GetMappingCount();
Cleanup
void OnDeinit() { SCL_Deinit(); }
Best Practices
-
Always call SCL_OnTradeTransaction
-
Use polling as backup
-
Process signals in loop
-
Avoid heavy logic inside loop
-
Enable verbose mode for debugging
Debugging
Enable:
Inp_VerboseMode = true; Inp_PrintToExperts = true;
Advanced Use Cases
-
Multi-account copier
-
Hedging systems
-
Grid replication
-
Trade journaling
-
Prop firm trackers
-
MT5 → Crypto bridge
Demo Script with examples attached


