Hey fellow traders! Today, I want to share a neat little trick that shows how to code profit and loss labels for your recently closed trades in MetaTrader 5.
This Expert Advisor (EA) will run dummy trades, so you can see how it all looks in the strategy tester. Keep in mind that the labels will only apply to trades from now on – they won’t show up in your trade history.
I’ve put together a solution using both the Canvas library and the standard library. You’ll find two options in the code that let you switch between using the Canvas approach or the more traditional text and rectangle objects from the standard library. And hey, if you think you can make it better, feel free to tweak the code as you see fit!
Using Canvas:

Using Standard Objects:

Related Posts
- Unlocking Trading Success with the 3MaCross EA for MetaTrader 4
- Harnessing MQL5 Wizard for Trading Signals: 3 Black Crows & 3 White Soldiers with MFI
- Unleashing RndTrade: A Simple Strategy for MetaTrader 4
- Mastering NirvamanImax: Your Go-To EA for MetaTrader 4
- CCICOMA Strategy Tester Report for EURCHF: An In-Depth Analysis