MT4 function/EA question

 

Hi guys,

I'm still new with coding using MQL4 and have a question. Is it possible for an EA to send you an e-mail when it reaches/breached a certain price you've specified?

Maybe an indicator will suffice? But anyway, I'm still currently working on it and studying MQL4, but I think asking also won't hurt.

But anyway, for example, you want the EA/Indicator (whichever has the capability) to send you an e-mail once it goes above let's say 118.00 for the USD/JPY.

So what I want to happen here is I will specify the price level on which the EA/Indicator will send me an e-mail. Once it goes to that price, it will send me an e-mail.

I've already setup my e-mail in the Options -> Email tab and have already sent successfully the Test signal.

Answers are greatly appreciated.

Regards,

East

 

Here's the code I came up with:

//---- input parameters

extern double priceAlert;

int start() {

double priceClose = Close[0];

if (priceClose >= priceAlert) {

SendMail("Price Alert", "Price Reached target price of : " + priceAlert);

}

return(0);

}

So my question will also be: Will the EA send mail only during forward testing and not on simulation/back testing

using MT4's testing?

And will it also recognize the price I set to "priceAlert"?

Again, I'm still new and hope you'd spare some of your time to answer my questions.

Best regards,

East

 

Okay, got the answer.

What I want to happen can actually be done by a simple indicator.. Sweet..