EA/Indicator to send an alert email when a trade opens/closes

 

I modded an EA based on Nicholishen's original alerter EA. Here is the file.

It alerts upon the close of a trade on a pair to which the EA was attached. I use a commercial EA, and I open up an extra chart to which I attach the alerter.

Mind you, I am not a MQ4 programmer, I just dabble, so it may not be the best code in the world, but it works for me. I would love to have it augmented to alert on trade openings as well, but I am not that smart yet. If anyone can contribute that part to this code, that would be great!

This is what the email looks like:

Subject: CLOSE pr: 23.59, bal: 5152.57, eq: 5058.81


Symbol: <PAIR> <BUY/SELL> <MAGIC#>
Comment: <COMMENT>
Ticket#: <TICKET#>
Size: <SIZE_LOT>
OpenTime: <OPEN_TIME/DATE>
Close Time: <CLOSE_TIME/DATE>
Open: <OPEN_PRICE>
Close: <CLOSE_PRICE>
Profit: <$PROFIT>
Pips: <PROFIT_IN_PIPS>

Balance: <CURRENT_BALANCE>
Used Margin: <USED_MARGIN>
Free Margin: <FREE_MARGIN>
Equity: <CURRENT_EQUITY>
Open Orders: <CURRENT_OPEN_ORDERS>

Broker: <BROKER_NAME>
Leverage: <LEVERAGE_USED>

Reason: