drawguard.io logodrawguard.io
GuidesCompareLive demo
Guides

Why the trade comment changes to [sl] or [tp] in MT5

Updated Nov 10, 2026 · 5 min read

Short answer: the broker's server rewrites the comment when a position is closed by Stop Loss or Take Profit. The MT5 help says so: "a comment to an order can be changed by a broker or server. For example, if a position is closed by Stop Loss or Take Profit, the corresponding information is displayed in the comment." On the closing record, your EA's text is replaced by something like [sl 1.08350] or [tp 1.08900].

So don't use the comment to identify trades. Use the magic number as the ID, and the comment only as a label you read while the trade is open. This guide covers what gets rewritten, how to tell why a trade closed, and what to rely on instead.

What you see in the History tab

Open the Toolbox (Ctrl+T), go to History, and find a trade that hit its stop. If your EA opened it with the comment grid-A, the closing line can show [sl 1.08350] instead. A take profit shows [tp ...] with the price.

A user in an MQL5 forum thread describes the same thing: when a position closes by SL or TP, [sl xxx.xx] or [tp xxx.xx] is written in the comment field of the report instead of the original comment.

That is why a comment filter or a spreadsheet pivot on comments loses every trade that ended on a stop or a target.

Why the comment gets overwritten

The comment is a free-text field attached to the order. The MQL5 docs call it simply "Order comment" and give no guarantee about what happens to it afterwards. The MT5 help says the server may change it, and that the maximum length is 31 characters.

In practice:

  • Stop Loss or Take Profit closes replace the text with [sl ...] or [tp ...].
  • Length is capped. The help gives a maximum of 31 characters.
  • The broker decides. Servers can write different things, so a rule that works on one broker's history may fail on another's.

An MQL5 forum moderator puts it bluntly in another thread: "comments are not reliable (it can be changed by the broker)". Their advice there is to use a different magic number for each EA and symbol.

How to tell why a trade closed

If what you want is "which trades hit their stop", don't parse the comment text. A moderator in the forum thread above recommends the deal's reason field. MQL5 has DEAL_REASON, and the docs list these values:

ValueMeaning
DEAL_REASON_SLExecuted as a result of Stop Loss activation
DEAL_REASON_TPExecuted as a result of Take Profit activation
DEAL_REASON_EXPERTPlaced from an MQL5 program, such as an EA or script
DEAL_REASON_CLIENTPlaced from a desktop terminal
DEAL_REASON_SOExecuted as a result of a Stop Out

The History tab has no column for it, so reading it takes a short MQL5 script or an EA. Because it is a value on the deal, the broker's wording doesn't affect it.

What to rely on instead

  1. The magic number is the ID. It is fixed when the position opens, and the deals that come from it carry it. See how to see the magic number of a trade.
  2. Give every EA, and every setfile you treat as separate, its own magic number. Then nothing depends on the comment.
  3. Keep comments short. Stay well under 31 characters. A short label like trend-aggr is easy to read in the Trade tab while the position is open.
  4. Check your own broker. Switch the History tab to the Positions and Deals view (right-click, Statement) and compare the opening deal with the closing deal of a trade that hit its stop. What each one shows depends on your broker's server.

See it on a live demo portfolio

Three simulated prop accounts in DrawGuard. Drawdown broken down by symbol, magic number and comment. No sign-up needed.

Open the demo →

Reading comments while the trade is open

While a position is open, its comment is still what your EA sent. That is also when you most need to know which EA a floating loss belongs to.

DrawGuard records it at that point. A free EA on one chart sends the account's equity and every open position, with its symbol, magic number, comment and floating profit, every 60 seconds to a web dashboard. Every day, week and month is broken down by symbol, magic number and comment, so you can see which one caused each drawdown, and charts filter by the same. You can look at it on the live demo without signing up.

It records from the moment the EA connects. It does not rebuild floating drawdown from before that, and it never places or closes trades. For the full picture of splitting drawdown by EA, see drawdown per EA by magic number.

FAQ

Why does my MT5 trade comment show [sl] or [tp]?

The broker's server rewrites the comment when a position is closed by Stop Loss or Take Profit. The MT5 help says a comment can be changed by a broker or server, and gives this case as the example.

Can I stop the broker from changing the comment?

No. The change happens on the server, not in your EA. Use the magic number to identify trades and treat the comment as a label.

How long can an MT5 order comment be?

The MT5 help gives a maximum of 31 characters. Keep yours shorter, since the server can change the text afterwards.

How do I find which trades closed on a stop loss?

Read the deal's reason, DEAL_REASON_SL for a Stop Loss and DEAL_REASON_TP for a Take Profit, instead of matching text in the comment. The reason is stored as a value on the deal, so it doesn't depend on the broker's wording.

See your own drawdown per EA, live

Attach the DrawGuard EA to one chart and every strategy on the account is tracked from then on: equity, drawdown, and which magic number caused it. One account is free forever.

Explore the live demo →Start free

More guides

  • How to check the correlation between your EAs in MT5

    Do your EAs lose on the same days? How to measure correlation between EAs from daily profit per magic number, and what a good or bad number means for drawdown.

  • Maximal vs relative drawdown in the MT5 Strategy Tester report

    How to read the absolute, maximal and relative drawdown lines in an MT5 Strategy Tester report, with a worked example, and how they compare with live drawdown.

  • How to find the maximum drawdown of a live MT5 account from its history

    MT5's reports can give a maximum drawdown from closed history, but floating drawdown from the past is estimated, not recorded. What you can get and what to record from now on.

drawguard.io provides trading risk analytics for informational purposes only — not financial advice, not trading signals. Past performance does not guarantee future results.

Guides·Compare·Privacy Policy·Terms of Service·Refund Policy·Risk Disclaimer·Contact

© 2026 TRADEINTEL (Pty) Ltd · drawguard.io · Reg. 2026/445160/07