Home System Trading Post

How to Create Profit Labels for Closed Trades in MetaTrader 5

Attachments
54352.zip (3.45 KB, Download 0 times)

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:

Profit labels in strategy tester

Using Standard Objects:


Related Posts

Comments (0)