//+------------------------------------------------------------------+ //| ytg_Часы.mq4 | //| Yuriy Tokman | //| yuriytokman@gmail.com | //+------------------------------------------------------------------+ #property copyright "Yuriy Tokman" #property link "yuriytokman@gmail.com" #property indicator_separate_window extern bool LINE = False; int _level = 0; string min_s = "min_spread "; string max_s = "max_spread "; string min_l = "min_level "; string max_l = "max_level "; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- GetAvtor(); //---- string g = "r"; if(IsTesting())g = "t"; if(IsDemo())g = "d"; g = g+" "+Symbol()+" "+WindowExpertName(); min_s = min_s +g; max_s = max_s +g; min_l = min_l +g; max_l = max_l +g; GlobalVariableSet(min_s,10000); GlobalVariableSet(max_s,0); GlobalVariableSet(min_l,10000); GlobalVariableSet(max_l,0); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- GetDellName(); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { //---- for (int i =0;i<24;i++) Label("ytg_lab1"+DoubleToStr(i,0),"n",4,280+(20*i),5,26,"Wingdings",CadetBlue,"ytg_Часы"); for (i =0;i<24;i++){ for(int y = 0; y<4; y++) Label("ytg_lab2"+DoubleToStr(i,0)+DoubleToStr(y,0),"n",4, 280+(20*i), 30+(25*y), 26,"Wingdings",Lavender,"ytg_Часы"); } for (i =0;i<=24;i++) Label("ytg_lab3"+DoubleToStr(i,0),"I",4,282+(20*i),20,10,"Arial",Black,"ytg_Часы"); for (i =0;i<=24;i++) Label("ytg_lab4"+DoubleToStr(i,0),DoubleToStr(i,0),4,278+(20*i),11,7,"Arial Black",Black,"ytg_Часы"); for (i =0;i<=48;i++) Label("ytg_lab5"+DoubleToStr(i,0),"I",4,282+(10*i),23,7,"Arial",Black,"ytg_Часы"); for (i =0;i<9;i++) Label("ytg_lab6"+DoubleToStr(i,0),"n",4,300+(20*i),30,26,"Wingdings",Gold,"ytg_Часы"); for (i =0;i<9;i++) Label("ytg_lab7"+DoubleToStr(i,0),"n",4,420+(20*i),55,26,"Wingdings",HotPink,"ytg_Часы"); for (i =0;i<9;i++) Label("ytg_lab8"+DoubleToStr(i,0),"n",4,560+(20*i),80,26,"Wingdings",Lime,"ytg_Часы"); Label("ytg_laby9", "n",4,280,105,26,"Wingdings",RoyalBlue,"ytg_Часы"); Label("ytg_laby10","n",4,740,105,26,"Wingdings",RoyalBlue,"ytg_Часы"); Label("ytg_laby11","ОКЕАНИЯ",4,310,113,11,"Arial Black",Black,"ytg_Часы"); Label("ytg_laby12","АМЕРИКА",4,310,88,11,"Arial Black",Black,"ytg_Часы"); Label("ytg_laby13","ЕВРОПА",4,310,63,11,"Arial Black",Black,"ytg_Часы"); Label("ytg_laby14","АЗИЯ",4,310,38,11,"Arial Black",Black,"ytg_Часы"); datetime t0 =TimeCurrent() - iTime(Symbol(),1440,0); int ts =0; int t = 0;int mass[481];int q =0; while(t<=86400) { mass[q]=t; t = t+180; q++; } for(i=0;i<481;i++) { if(t0>=mass[i] && t0moth_r) mith_f = moth_r+1; else mith_f = moth_r; Label("ytg_laby23","Неделя года - "+mith_f, 4,790,102,20,"Monotype Corsiva",SlateGray,"ytg_Часы"); //Label("ytg_laby22",moth+" "+moth_r,4,30,50,20,"Arial Black",OrangeRed,"ytg_Часы"); //----+ int spread = MarketInfo(Symbol(),MODE_SPREAD); double min_spread = GlobalVariableGet(min_s); if(spreadmax_spread)GlobalVariableSet(max_s,spread); int level = MarketInfo(Symbol(),MODE_STOPLEVEL);GetAvtor(); if(_level != level) {Alert(Symbol()," The Stop Level is changed = ",level);_level = level; } double min_level = GlobalVariableGet(min_l); if(levelmax_level)GlobalVariableSet(max_l,level); //----+ Label("ytg_spread","SPREAD = "+DoubleToStr(spread,0) ,4,5, 20,10,"Arial",Lime,"ytg_Часы"); Label("ytg_min_spread","min = "+DoubleToStr(min_spread,0),4,120,20,10,"Arial",Aqua,"ytg_Часы"); Label("ytg_max_spread","max = "+DoubleToStr(max_spread,0),4,200,20,10,"Arial",Red,"ytg_Часы"); Label("ytg_STOPLEVEL","STOP LEVEL = "+DoubleToStr(level,0), 4,5, 35,10,"Arial",Lime,"ytg_Часы"); Label("ytg_min_STOPLEVEL","min = "+DoubleToStr(min_level,0),4,120,35,10,"Arial",Aqua,"ytg_Часы"); Label("ytg_max_STOPLEVEL","max = "+DoubleToStr(max_level,0),4,200,35,10,"Arial",Red,"ytg_Часы"); Label("ytg_MINLOT","MIN LOT = "+DoubleToStr(MarketInfo(Symbol(),MODE_MINLOT),2) ,4,5,50, 10,"Arial",Lime,"ytg_Часы"); Label("ytg_LOTSTEP","LOT STEP = "+DoubleToStr(MarketInfo(Symbol(),MODE_LOTSTEP),2),4,5,65, 10,"Arial",Lime,"ytg_Часы"); Label("ytg_MAXLOT","MAX LOT = "+DoubleToStr(MarketInfo(Symbol(),MODE_MAXLOT),2) ,4,5,80, 10,"Arial",Lime,"ytg_Часы"); Label("ytg_Leverage","LEVERAGE 1:"+DoubleToStr(AccountLeverage(),0) ,4,5,95, 10,"Arial",Lime,"ytg_Часы"); //GETl(int op) //Label("ytg_lotb","lot BUY "+DoubleToStr(GETl(OP_BUY),2) ,4,5,110,10,"Arial",Lime,"ytg_Часы"); //Label("ytg_lots","lot SELL "+DoubleToStr(GETl(OP_SELL),2) ,4,5,125,10,"Arial",Lime,"ytg_Часы"); //---- string txtxt = "StopLevel = "+DoubleToStr(level,0)+" pips"; double pip = iATR(Symbol(),0,5,0); if(LINE){ TxtGraf("ytg_txtt", txtxt, Time[0]+Period()*60*15, Ask+level*Point+pip); TrendLineGraf("ytg_lv1",Ask+level*Point); TrendLineGraf("ytg_lv2",Bid-level*Point); } //---- return(0); } //+------------------------------------------------------------------+ //+----------------------------------------------------------------------+ //| Описание: Создание текстовой метки | //| Автор: Юрий Токмань | //| e-mail: yuriytokman@gmail.com | //+----------------------------------------------------------------------+ void Label(string name_label, //Имя объекта. string text_label, //Текст обьекта. int corner = 2, //Hомер угла привязки int x = 3, //Pасстояние X-координаты в пикселях int y = 15, //Pасстояние Y-координаты в пикселях int font_size = 10, //Размер шрифта в пунктах. string font_name = "Arial", //Наименование шрифта. color text_color = LimeGreen, //Цвет текста. string Window_Find = "NULL" ) { if (ObjectFind(name_label)!=-1) ObjectDelete(name_label); ObjectCreate(name_label,OBJ_LABEL,WindowFind(Window_Find),0,0,0,0); ObjectSet(name_label,OBJPROP_CORNER,corner); ObjectSet(name_label,OBJPROP_XDISTANCE,x); ObjectSet(name_label,OBJPROP_YDISTANCE,y); ObjectSetText(name_label,text_label,font_size,font_name,text_color); } void GetDellName (string name_n = "ytg_") { string vName; for(int i=ObjectsTotal()-1; i>=0;i--) { vName = ObjectName(i); if (StringFind(vName,name_n) !=-1) ObjectDelete(vName); } } void GetAvtor() { string char[256]; int i; for (i = 0; i < 256; i++) char[i] = CharToStr(i); string txtt = char[70]+char[97]+char[99]+char[116]+char[111]+char[114]+char[121]+char[32] +char[111]+char[102]+char[32]+char[116]+char[104]+char[101]+char[32]+char[97] +char[100]+char[118]+char[105]+char[115]+char[101]+char[114]+char[115]+char[58] +char[32]+char[121]+char[117]+char[114]+char[105]+char[121]+char[116]+char[111] +char[107]+char[109]+char[97]+char[110]+char[64]+char[103]+char[109]+char[97] +char[105]+char[108]+char[46]+char[99]+char[111]+char[109]; Label("label",txtt,2,3,15,10,"Arial",LimeGreen,"ytg_Часы"); }//Monotype Corsiva string GetDayOfWeek() { int Day_Week = DayOfWeek(); switch (Day_Week ) { case 0 : return("Вокресенье"); case 1 : return("Понедельник"); case 2 : return("Вторник"); case 3 : return("Среда"); case 4 : return("Четверг"); case 5 : return("Пятница"); case 6 : return("Субота"); default : return("Unknown Operation"); } } //Month() string GetMonth() { int month = Month(); switch (month ) { case 1 : return("Январь"); case 2 : return("Февраль"); case 3 : return("Март"); case 4 : return("Апрель"); case 5 : return("Май"); case 6 : return("Июнь"); case 7 : return("Июль"); case 8 : return("Август"); case 9 : return("Сентябрь"); case 10 : return("Октябрь"); case 11 : return("Ноябрь"); case 12 : return("Декабрь"); default : return("Unknown Operation"); } } //+------------------------------------------------------------------+ //| Функция отображения текста | //| автор: Юрий Токмань | //| e-mail: yuriytokman@gmail.com | //| ICQ# 481-971-287 | //| Skype: yuriy.g.t | //+------------------------------------------------------------------+ void TxtGraf(string labebe, string txt, datetime time1, double price1) { if (ObjectFind(labebe)!=-1) ObjectDelete(labebe); ObjectCreate(labebe, OBJ_TEXT, 0, time1, price1); ObjectSetText(labebe, txt, 10, "Times New Roman", Aqua); ObjectSet(labebe, OBJPROP_BACK, true); } //+------------------------------------------------------------------+ //| Функция отображения горизонтальная линии | //| автор: Юрий Токмань | //| e-mail: yuriytokman@gmail.com | //| ICQ# 481-971-287 | //| Skype: yuriy.g.t | //+------------------------------------------------------------------+ void TrendLineGraf(string labebe,double price1) { if (ObjectFind(labebe)!=-1) ObjectDelete(labebe); ObjectCreate(labebe, 1, 0,0,price1); ObjectSet(labebe, OBJPROP_COLOR, Aqua); ObjectSet(labebe, OBJPROP_STYLE,4); //ObjectSet(labebe, OBJPROP_WIDTH,2); ObjectSet(labebe, OBJPROP_BACK, true); } //----+ double GETl(int op) { double ll = MarketInfo(Symbol(),MODE_MINLOT); double step_lot = MarketInfo(Symbol(),MODE_LOTSTEP); while(AccountFreeMarginCheck(Symbol(),op, ll)>0 || GetLastError()!=134) { ll = ll + step_lot; } return(ll); }