//+------------------------------------------------------------------+ //| alert_timer.mq4 | //| Copyright 2014, Rondo | //| http://fx-dollaryen.seesaa.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright 2014, Rondo" #property link "http://fx-dollaryen.seesaa.net/" #property version "1.1" #property strict #property indicator_chart_window input int alert_time = 5; //1-60分 int alertMin; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int init() { EventSetTimer(1); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int deinit() { EventKillTimer(); return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTimer(){ static int alertCounts; if(MathMod(TimeMinute(TimeLocal()), alert_time) == 0){ int sec = TimeSeconds(TimeLocal()); if(0<= sec && sec <5){ if(alertCounts == 0){ Alert(TimeToStr(TimeLocal(), TIME_MINUTES)); alertCounts++; } } else alertCounts = 0; } } //+------------------------------------------------------------------+