This forum is in read-only mode now. You may discuss your questions on forums of MQL4.community and MQL5.community

Send email when trade executes


Back to topics list
avatar
Trader 2008.12.12 20:27 

Hi I would like to have MT4 send me a email when a trade executes from a EA. I do not have the code for the EA as it is locked (greyed out). Can a second code be added to a chart and when the trade executes it would automaticly send a email of the trade execution? I am offten on the road and it would be nice to see when trades are happing on my Blackberry. A text would also be cool on my phone. I don't have any experience coding so I am sort in the dark on this one. Or does anybody know of a way to send an alert for this. I see that alerts can be sent on when certain events happen like highs and lows but you can't send email for a trade execution.

Thanks in advance.

avatar
Trader 2008.12.15 09:39 
You can attache an endless script to the needed chart. This script should check all orders several times per second and send an email via the function SendEmail().
avatar
Trader 2008.12.16 09:18 
Rosh :
You can attache an endless script to the needed chart. This script should check all orders several times per second and send an email via the function SendEmail().

Can you help me with this script. I do not know how to program MT4 yet. If this is easy could you write the script and then I can paste it into the chart?

avatar
Trader 2008.12.16 09:32 

See article Events in МetaТrader 4:

The article deals with programmed tracking of events in the МetaТrader 4 Client Terminal, such as opening/closing/modifying orders, and is targeted at a user who has basic skills in working with the terminal and in programming in MQL4.

avatar
Trader 2008.12.17 17:36 
Rosh :

See article Events in МetaТrader 4:

The article deals with programmed tracking of events in the МetaТrader 4 Client Terminal, such as opening/closing/modifying orders, and is targeted at a user who has basic skills in working with the terminal and in programming in MQL4.

As noted before I do not know how to script is there anyone out there that could help or possibly I could pay someone to write this add on so I can get emails whenever a trade opens with a EA or the trade is closed. I got the email portion all setup and working. My EA is locked so I can not add code to it.

avatar
Trader 2009.01.08 08:51 
Jeffodell :
Rosh :

See article Events in МetaТrader 4:

The article deals with programmed tracking of events in the МetaТrader 4 Client Terminal, such as opening/closing/modifying orders, and is targeted at a user who has basic skills in working with the terminal and in programming in MQL4.

As noted before I do not know how to script is there anyone out there that could help or possibly I could pay someone to write this add on so I can get emails whenever a trade opens with a EA or the trade is closed. I got the email portion all setup and working. My EA is locked so I can not add code to it.

If anyone is intrested I got this to work with the help of a programmer. We devloped a script or Ea that will send an email everytime a trade is taken out or closed. It send an email or text message. If anyone needs this the programmer is selling it. I love this as I can see my trades on my mobile phone or email at work. Check it out https://www.plimus.com/jsp/buynow.jsp?contractId=2215388&referrer=jeffodell84

avatar
Trader 2009.06.02 00:52 

What a ripoff!


Here is a free code I modded an EA based on Nicholishen's original alerter EA.

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 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>


Attached files:
  MailAlertOnOrderClose.zip (1.04 KB)
avatar
Trader 2009.06.08 22:50 
dimmyr :

What a ripoff!


Here is a free code I modded an EA based on Nicholishen's original alerter EA.

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 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>


dim myr  - what's the issue with a programmer making some money then?

I've written extensive email notification into numerous EAs, notifying initialisation parameters, de-initialisation reasons, order opens, order closes, margin exhaustion etc. etc.

I can easily do what you need. But I'll charge you more than £33.19 just on principle, since reading your comment. 

avatar
Trader 2009.06.09 09:26 
cloudbreaker :

dim myr - what's the issue with a programmer making some money then?

I've written extensive email notification into numerous EAs, notifying initialisation parameters, de-initialisation reasons, order opens, order closes, margin exhaustion etc. etc.

I can easily do what you need. But I'll charge you more than £33.19 just on principle, since reading your comment.

Sorry, didn't mean to offend.

Back to topics list