I already have the email alert system in MT4 already set up and it works when I send a test message. I have no experience with Mt4 code, but I want to code the RSI indicator so that it sends me email alerts whenever it crosses over 50 or below 50. How would I be able to do that? Thanks
So there are two things that you can do. Send an email or send a message to your phone.
The hard part with email is MT4 requires a lot of information about the server that your email provider uses and most companies like gmail and msn etc. don’t like to share. But what you need to do is get the information for MT4 to use. You should be able to find it under options or something like that for exactly what it needs.
or the easier way is to get the metaquotes app on your android or iphone and get that id number from it. Copy and paste that id number under Notification part of your MT4 platform.
Then you have the code. I have to double check it later as I’m at work, but i believe it will go like this.
declare the rsi indicator as a variable after you incorporate it into the ea.
Then it’ll look something like this:
OnTick
{
double RSI = rsi indicator() //this is the declaration.
if RSI >= 50.00;
SendNotification(Rsi has crossed up above 50!); //notification will say what’'s in parenthesis
return();
if RSI <50.00;
SendNotification(Rsi has crossed down below 50!); //notification will say what’s in parenthesis
return();
return(0)
}
There’s also another issue, and i can’t remember the code at the moment but you will want to have the notification sent when the candle actually closes. I’ll look into it again so I can better help you.
Okay so i got some clarification on this matter. first you need to get your e-mail settings in the trading platform. then you need to incorporate the rsi indicator into your expert advisor, at this time I’m still working on figuring out how to do that.
The coding for e-mail with the Sri is as follows.
if RSI >=50.00;
bool SendMail(e-mail subject here, e-mail text here);
else RSI <=50.00;
bool SendMail(e-mail subject here, e-mail text here);
okay i think i got it all together now
double iRSI(NULL,0,14,0,0); // the 14 in the parenthesis is the period of your rsi
double iRSI=rsi;
if rsi<=50.00;
blah blah same stuff as before.
the double iRSI above inputs the calculation of rsi on the current chart of the current timeframe however, I’m not sure if it will actually draw the rsi in a separate indicator window.
That should be everything you need.
SendMail() is for e-mail and SendNotification() is for the text message, but you must remember to set the phone and/or e-mail settings in the trading platform. let me know if I can help more.
Cheers,
AK
Thanks. I will try to input this into the rsi indicator later today.