Hi all. I am trying to code a very simple alert function. All I want is to be alerted when one of the three major FX pairs goes up in price by an average of .01% per minute.
I have looked at some of the basic code examples and came up with the code below. I think there are some problems with it however. First, I don't know how to tell the program to get the quote info for a certain pair. How do I tell it to check the EUR/USD history for example? Second, I don't know how to change the period length. I want all the periods to be in minutes, but haven't figured out how to tell the program that. Don't I alsoneed to open up a connection with the quote server, or is that automatic? Does anyone know how to make a given .wav file play, or a beeping sound, when the alerts are triggered?
Thanks All
//check for price movement over last minute
if(((Close[1]/Close[2])-1) > .0001)
{
Alert("EUR/USD up ", ((Close[1])/(Close[2])-1), "% per minute in last minute");
}
//check for price movement over last 5 minutes
if((((Close[1]/Close[6])-1)/5) > .0001)
{
Alert("EUR/USD up ", (((Close[1]/Close[5])-1)/5), "% per minute in last 5 minutes");
}
//check for price movement over last 10 minutes
if((((Close[1]/Close[11])-1)/10) > .0001)
{
Alert("EUR/USD up ", (((Close[1]/Close[11])-1)/10), "% per minute in last 10 minutes");
}
//check for price movement over last 30 minutes
if((((Close[1]/Close[31])-1)/30) > .0001)
{
Alert("EUR/USD up ", (((Close[1]/Close[31])-1)/30), "% per minute in last 30 minutes");
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I have looked at some of the basic code examples and came up with the code below. I think there are some problems with it however. First, I don't know how to tell the program to get the quote info for a certain pair. How do I tell it to check the EUR/USD history for example? Second, I don't know how to change the period length. I want all the periods to be in minutes, but haven't figured out how to tell the program that. Don't I alsoneed to open up a connection with the quote server, or is that automatic? Does anyone know how to make a given .wav file play, or a beeping sound, when the alerts are triggered?
Thanks All
//check for price movement over last minute if(((Close[1]/Close[2])-1) > .0001) { Alert("EUR/USD up ", ((Close[1])/(Close[2])-1), "% per minute in last minute"); } //check for price movement over last 5 minutes if((((Close[1]/Close[6])-1)/5) > .0001) { Alert("EUR/USD up ", (((Close[1]/Close[5])-1)/5), "% per minute in last 5 minutes"); } //check for price movement over last 10 minutes if((((Close[1]/Close[11])-1)/10) > .0001) { Alert("EUR/USD up ", (((Close[1]/Close[11])-1)/10), "% per minute in last 10 minutes"); } //check for price movement over last 30 minutes if((((Close[1]/Close[31])-1)/30) > .0001) { Alert("EUR/USD up ", (((Close[1]/Close[31])-1)/30), "% per minute in last 30 minutes"); }