//+------------------------------------------------------------------+ //| TimeCurrentXR.mq4 | //| Copyright © 2009, XrustSolution. | //| http://www.xrust.ucoz.net | //+------------------------------------------------------------------+ #property copyright "#Copyright © 2009, XrustSolution.#" #property link "#http://www.xrust.ucoz.net#" #property indicator_chart_window extern color Col= Blue; string tm15="|| "; string tm30="|||| "; string tm45="|||||| "; string tm60="||||||||"; //+------------------------------------------------------------------+ int deinit(){ObjectsDeleteAll(0,OBJ_LABEL);return;} //+------------------------------------------------------------------+ int start() {string time;int min,y,x; SetLabel("TM",TimeToStr(TimeCurrent(),TIME_SECONDS)+" ",Col,5,5,1,15); if(TimeSeconds(TimeCurrent())<15){time=tm15;} if(TimeSeconds(TimeCurrent())>=15&&TimeSeconds(TimeCurrent())<30){time=tm30;} if(TimeSeconds(TimeCurrent())>=30&&TimeSeconds(TimeCurrent())<45){time=tm45;} if(TimeSeconds(TimeCurrent())>=45){time=tm60;} SetLabel("M1", time+"M1 ",Col,5,25,1,15); if(TimeMinute(TimeCurrent())%5<2){time=tm15;} if(TimeMinute(TimeCurrent())%5>=2&&TimeMinute(TimeCurrent())%5<3){time=tm30;} if(TimeMinute(TimeCurrent())%5>=3&&TimeMinute(TimeCurrent())%5<4){time=tm45;} if(TimeMinute(TimeCurrent())%5>=4){time=tm60;} SetLabel("M5", time+"M5 ",Col,5,45,1,15); if(TimeMinute(TimeCurrent())<15){y=0;} if(TimeMinute(TimeCurrent())>=15&&TimeMinute(TimeCurrent())<30){y=1;} if(TimeMinute(TimeCurrent())>=30&&TimeMinute(TimeCurrent())<45){y=2;} if(TimeMinute(TimeCurrent())>=45){y=3;} x=TimeMinute(TimeCurrent())-(y*15); if(x<4){time=tm15;} if(x>=4&&x<8){time=tm30;} if(x>=8&&x<12){time=tm45;} if(x>=12){time=tm60;} SetLabel("M15",time+"M15",Col,5,65,1,15); if(TimeMinute(TimeCurrent())<30){y=0;}else{y=1;} x=TimeMinute(TimeCurrent())-(y*30); if(x<8){time=tm15;} if(x>=8&&x<15){time=tm30;} if(x>=15&&x<22){time=tm45;} if(x>=22){time=tm60;} SetLabel("M30",time+"M30",Col,5,85,1,15); if(TimeMinute(TimeCurrent())/15<1){time=tm15;} if(TimeMinute(TimeCurrent())/15>=1&&TimeMinute(TimeCurrent())/15<2){time=tm30;} if(TimeMinute(TimeCurrent())/15>=2&&TimeMinute(TimeCurrent())/15<3){time=tm45;} if(TimeMinute(TimeCurrent())/15>=3){time=tm60;} SetLabel("H1", time+"H1 ",Col,5,105,1,15); if(TimeHour(TimeCurrent())<4){y=0;} if(TimeHour(TimeCurrent())>=4&&TimeHour(TimeCurrent())<8){y=1;} if(TimeHour(TimeCurrent())>=8&&TimeHour(TimeCurrent())<12){y=2;} if(TimeHour(TimeCurrent())>=12&&TimeHour(TimeCurrent())<16){y=3;} if(TimeHour(TimeCurrent())>=16&&TimeHour(TimeCurrent())<20){y=4;} if(TimeHour(TimeCurrent())>=20){y=5;} x=TimeHour(TimeCurrent())-4*y; if(x<1){time=tm15;} if(x>=1&&x<2){time=tm30;} if(x>=2&&x<3){time=tm45;} if(x>=3){time=tm60;} SetLabel("H4", time+"H4 ",Col,5,125,1,15); if(TimeHour(TimeCurrent())<6){time=tm15;} if(TimeHour(TimeCurrent())>=6&&TimeHour(TimeCurrent())<12){time=tm30;} if(TimeHour(TimeCurrent())>=12&&TimeHour(TimeCurrent())<18){time=tm45;} if(TimeHour(TimeCurrent())>=18){time=tm60;} SetLabel("D1", time+"D1 ",Col,5,145,1,15); return(0); } void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9) { if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0); ObjectSetText(nm, tx, fs,"Arial"); ObjectSet(nm, OBJPROP_COLOR , cl); ObjectSet(nm, OBJPROP_XDISTANCE, xd); ObjectSet(nm, OBJPROP_YDISTANCE, yd); ObjectSet(nm, OBJPROP_CORNER , cr); ObjectSet(nm, OBJPROP_FONTSIZE , fs); Sleep(100); WindowRedraw(); }