Simple code - Max drawdown during trade

Can someone help me code MT4 to have a column in my trade tab or any other way to know what is my max drawdown during the course of a trade? This means that even if i close my trades with an eventual +, i want to know what was the max drawdrown during the course of the trade.

The thing is that i’m not just running one pair otherwise i could just look at the charts and see the high and low. I am opening 7 or 8 pairs at the same time and closing them at the same time so im wondering what is the max drawdown during any single point that the trade is open.


It’s not possible for an indicator on one chart to communicate with another indicator on another chart.

I’m sorry to say you’ll just have to do the math yourself… :frowning:

Thank you for the response! The problem is that since its 7 or 8 pairs at a time its not possible to do the math for when the max drawdown happened during the course of a trade that may last 12 hours. The only way is to continually stare for the entire 12 hours at the profit column in the trade tab and see when it gives a number that i can conclude has been at the maximum minus.

Its not really about communicating with indicators from different charts - its about the tally at the bottom of the profit column keeping a log of its most extreme value during an entire trade. Do you think that’s possible?


Or how about a code that would send an alert to my phone or email when my pl is -$5000, -$10,000, -$15,000 etc?


I do not know how long your trades last, but you could look on a 1 minute chart to see where the price action went during your trade.

If your program goes back far enough and stores enough of the data, this should not be a problem.
You only then need to keep track of your entry points. :slight_smile:

Hope this helps.

I see what you’re saying now.

I can code you something like that pretty easily. It won’t show it on the trade tab, but it can be displayed on your chart or be emailed to you.

I’ll write something up and post it here when I’m done.

Thanks Phil - very much appreciated!

Here’s one I threw together real quick. It’s not very pretty, but it gets the job done.

To reset the numbers you have to remove the indicator from your chart and put a new one on.

If I have time later I’ll make a better one with more features.

max (1.66 KB)

Thank you Phil - it works nicely. 2 questions. 1. How does one remove indicator from chart? 2. How often is it set to refresh?

To remove it right-click anywhere on your chart and select “Indicators List”, then select it from the list and hit “delete.”

It refreshes everytime the price changes, but it does lag one tick behind. There’s no way around that, it’s a limitation of the MT4 programming language.