//+------------------------------------------------------------------+
//| n.mq4 |
//| Copyright © 2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#property indicator_chart_window
extern double highPrice;
extern double lowPrice;
extern double rm;
extern bool showPriceLevels = false;
extern bool sendMailAlert = true;
extern bool soundAlert = false;
static int PrevSignal = 0, PrevTime = 0, SIGNAL_BAR=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
// Get close price of current bar
double currentClose = Bid;
if (sendMailAlert || soundAlert) {
if (Minute()>=rm && (currentClose >= highPrice || currentClose <= lowPrice)) {
if (sendMailAlert) {
SendMail("Price Alert", "Price breached target price of : " + highPrice);
}
if (soundAlert) {
PlaySound("alert.wav");
}
}
}
//----
//----
if(SIGNAL_BAR > 0 && Time[0] <= PrevTime )
return(0);
return(0);
}
//+------------------------------------------------------------------+
Comments