//+------------------------------------------------------------------+
//| SoundAtOpenNewBar.mq4 |
//| Copyright © 2008, Serega Lykov |
//| http://mtexperts.narod.ru/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Serega Lykov"
#property link "http://mtexperts.narod.ru/"
//---- property of indicator ----------------------------------------+
#property indicator_chart_window
//---- external parameters ------------------------------------------+
extern string SoundFile = "alert.wav";
//---- global variables ---------------------------------------------+
static datetime bartime;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- initialization of parameters
bartime = Time[0];
//---- finish of initialization
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//---- finish of deinitialization
return(0);
}
//+------------------------------------------------------------------+
//| Sound At Open New Bar |
//+------------------------------------------------------------------+
int start()
{
if(bartime == Time[0]) return(0);
bartime = Time[0];
PlaySound(SoundFile);
// finish of iteration
return(0);
}
//+------------------------------------------------------------------+
Comments