//+------------------------------------------------------------------+ //| Trade-Time.mq4 | //| Имя: Саша | //| mailto: marketadviser@rambler.ru | //| | //| Каталог установки: | //| C:\Program Files\ - Терминал - \experts\indicators\ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2009, MetaQuotes Software Corp." #property link "http: //www.metaquotes.net" #property indicator_chart_window //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- ObjectsDeleteAll(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- //---- Ввод данных datetime Time_Local=TimeLocal(); datetime Time_Current=TimeCurrent(); //---- Ввод глобальных переменных if(!GlobalVariableCheck("gTimeLocal") || !GlobalVariableCheck("gTimeCurrent")) { if(GlobalVariableSet("gTimeLocal",Time_Local)==0) return(false); if(GlobalVariableSet("gTimeCurrent",Time_Current)==0) return(false); } datetime gTime_Local=GlobalVariableGet("gTimeLocal"); datetime gTime_Current=GlobalVariableGet("gTimeCurrent"); //---- Расчёт разницы во времени int Del_Global=gTime_Local-gTime_Current; int Del_Time=Time_Local-Time_Current; int Del=Del_Global-Del_Time; //---- Определение знака if(Del<0) string ZnakDel="-"; else ZnakDel="+"; //---- Вызов функции TimeServer(MathAbs(Del),ZnakDel,MathAbs(Del_Time),Time_Current); //---- //---- return(0); } //+------------------------------------------------------------------+ //| Индикация времени | //+------------------------------------------------------------------+ void TimeServer(int Del, string ZnakDel, datetime Del_Time, datetime Time_Current) { //---- int TimePic; color ColorPic; //---- Перевод времени из 24ч. в 12ч. if(TimeHour(Time_Current)<12) int hour=TimeHour(Time_Current);else hour=TimeHour(Time_Current)-12; //---- Перепресвоение переменных индикации switch(hour) { case 0: TimePic=194; ColorPic=Black; break; case 1: TimePic=183; ColorPic=MidnightBlue; break; case 2: TimePic=184; ColorPic=Indigo; break; case 3: TimePic=185; ColorPic=DarkSlateBlue; break; case 4: TimePic=186; ColorPic=DarkViolet; break; case 5: TimePic=187; ColorPic=BlueViolet; break; case 6: TimePic=188; ColorPic=RoyalBlue; break; case 7: TimePic=189; ColorPic=DodgerBlue; break; case 8: TimePic=190; ColorPic=SkyBlue; break; case 9: TimePic=191; ColorPic=LightBlue; break; case 10: TimePic=192; ColorPic=LightSkyBlue; break; case 11: TimePic=193; ColorPic=Navy; break; default: Print("NOT TIME"); break; } //---- Циферблат с часовой стрелкой ObjectCreate("TAB",OBJ_LABEL,0,0,0,0,0); ObjectSet("TAB",OBJPROP_CORNER,3); ObjectSet("TAB",OBJPROP_XDISTANCE,10); ObjectSet("TAB",OBJPROP_YDISTANCE,10); ObjectSetText("TAB",CharToStr(TimePic),25,"Wingdings",ColorPic); //---- Накопленная разность во времени ObjectCreate("ERR",OBJ_LABEL,0,0,0,0,0); ObjectSet("ERR",OBJPROP_CORNER,3); ObjectSet("ERR",OBJPROP_YDISTANCE,28); ObjectSet("ERR",OBJPROP_XDISTANCE,45); ObjectSetText("ERR"," "+ZnakDel+" "+"`"+TimeToStr(Del,TIME_MINUTES|TIME_SECONDS),8,"Tahoma",Blue); //---- Разность во времени между ПК и торговым сервером ObjectCreate("GMT",OBJ_LABEL,0,0,0,0,0); ObjectSet("GMT",OBJPROP_CORNER,3); ObjectSet("GMT",OBJPROP_YDISTANCE,15); ObjectSet("GMT",OBJPROP_XDISTANCE,45); ObjectSetText("GMT","GMT "+TimeToStr(Del_Time,TIME_MINUTES|TIME_SECONDS),8,"Tahoma",Blue); }