//+------------------------------------------------------------------+ //| Market Profiles.mq4 | //| Copyright © 2006, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2006, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property copyright "Êèì Èãîðü Â. aka KimIV" #property link "http://www.kimiv.ru" #property link " Modified by cja " #property indicator_separate_window extern int NumberOfDays = 10; extern string Start_1 = "15:00"; extern string Stop_1 = "23:59"; extern color Colour_1 = C'25,25,112';//US extern string Start_2 = "08:00"; extern string Stop_2 = "19:00"; extern color Colour_2 = C'128,0,30';//Europe extern string Start_3 = "00:00"; extern string Stop_3 = "12:00"; extern color Colour_3 = C'0,60,20';//Asia extern string Start_4 = "10:00"; extern string Stop_4 = "12:00"; extern color Colour_4 = C'549,111,0';//London Open Tokyo Close extern string Start_5 = "15:00"; extern string Stop_5 = "19:00"; extern color Colour_5 = C'268,0,136';//US Open London Close extern string Start_6 = "02:00"; extern string Stop_6 = "03:00"; extern color Colour_6 = C'68,80,20';//TOKYO Open HONGKONG Open extern string Start_7 = "15:30"; extern string Stop_7 = "17:00"; extern color Colour_7 = C'68,0,20';//NEWS /*extern string Start_8 = "23:00"; extern string Stop_8 = "23:59"; extern color Colour_8 = C'99,69,99';//NEW ZEALAND extern string Start_9 = "01:00"; extern string Stop_9 = "02:00"; extern color Colour_9 = C'80,89,80';//AUSTRALIA*/ extern bool HighLow = True; // true = rectangles follow hi/low // false = full length colors //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void init() { IndicatorShortName("Mkt"); DeleteObjects(); for (int i=0; i5) dt=decDateTradeDay(dt); } } void DrawObjects(datetime dt, string no, string tb, string te) { datetime time1, time2; double p1, p2; int b1, b2; time1=StrToTime(TimeToStr(dt, TIME_DATE)+" "+tb); time2=StrToTime(TimeToStr(dt, TIME_DATE)+" "+te); b1=iBarShift(NULL, 0, time1); b2=iBarShift(NULL, 0, time2); p1=High[Highest(NULL, 0, MODE_HIGH, b1-b2, b2)]; p2=Low [Lowest (NULL, 0, MODE_LOW , b1-b2, b2)]; if (!HighLow) {p1=0; p2=2*p2;}// had p2=0 but might not be right ObjectSet(no, OBJPROP_TIME1 , time1); ObjectSet(no, OBJPROP_PRICE1, p1); ObjectSet(no, OBJPROP_TIME2 , time2); ObjectSet(no, OBJPROP_PRICE2, p2); } datetime decDateTradeDay (datetime dt) { int ty=TimeYear(dt); int tm=TimeMonth(dt); int td=TimeDay(dt); int th=TimeHour(dt); int ti=TimeMinute(dt); td--; if (td==0) { tm--; if (tm==0) { ty--; tm=12; } if (tm==1 || tm==3 || tm==5 || tm==7 || tm==8 || tm==10 || tm==12) td=31; if (tm==2) if (MathMod(ty, 4)==0) td=29; else td=28; if (tm==4 || tm==6 || tm==9 || tm==11) td=30; } return(StrToTime(ty+"."+tm+"."+td+" "+th+":"+ti)); } //+------------------------------------------------------------------+