//+------------------------------------------------------------------+
//|                                               Auto_Refresh_Alarm |
//|                               Copyright © 2010, Dennis Hamiilton |
//|                                              ramble_32@yahoo.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Dennis Hamiilton"
#property link      "ramble_32@yahoo.com"

extern int Alarm_Count=1000;
extern int Delay=10;
datetime LastTimeSaved;
int AlertCount;

//+------------------------------------------------------------------+
int start(){
   MotherFunction();
  }
//----
void MotherFunction(){
   while(true){
      RefreshRates();
//----
   if(GlobalVariableGet("alarm_set")==true)
     {
      if(TimeCurrent() > LastTimeSaved+Delay && AlertCount <= Alarm_Count)
        {
         AlertCount++;
         LastTimeSaved=TimeCurrent();
         PlaySound("alert.wav"); Alert("Max Trades Reached!!!");
        }
     }
//----
   Sleep(100);
  }
//----
   return(0);
  }
//+------------------------------------------------------------------+