//+------------------------------------------------------------------+
//|                                                        Lines.mq4 |
//+------------------------------------------------------------------+
#property indicator_chart_window
//+----
 extern datetime START = D'2010.06.30 03:00';
 extern int TF = 5;  
//---- 
 extern int lines = 20;
 extern color colors = Green;
 extern int tolshina = 1;
 extern int stil = 2;
//---- 
 extern bool UGOL45 =false;
 extern bool UGOL90 =false;
 extern bool UGOL135 =false;
 extern bool UGOL180 =false;
 extern bool UGOL225 =true;
 extern bool UGOL270 =false;
 extern bool UGOL315 =false;
 extern bool UGOL360 =false;
//----
 int n45 = 4;int n90 = 3;int n135 = 2;int n180 = 1;
 int n225 = 8;int n270 = 7;int n315 = 6;int n360 = 5;
//+------------------------------------------------------------------+
void object(string z,string x,int b,color c,int v,int w)
 {ObjectCreate(z,OBJ_LABEL,0,0,0);ObjectSetText(z,x,b,"Times New Roman",c);
 ObjectSet(z,OBJPROP_CORNER,w);ObjectSet(z,OBJPROP_XDISTANCE,4);
 ObjectSet(z,OBJPROP_YDISTANCE,v);}
//+------------------------------------------------------------------+
void vline(string lin,int time)
 {ObjectCreate(lin,OBJ_VLINE,0,time,0);ObjectSet(lin,OBJPROP_COLOR,colors);
ObjectSet(lin,OBJPROP_WIDTH,tolshina);ObjectSet(lin,OBJPROP_STYLE,stil);}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void Lines(int N)
 {int n=0;int b=0;int d;for(int i=iBars(NULL,TF);i>=0;i--){if(iTime(NULL,TF,i)<START)continue;
 if(iTime(NULL,TF,i)==iTime(NULL,TF,iBarShift(NULL,TF,START,false))){vline(N+"~"+TF+"~"+n,iTime(NULL,TF,i));b=i;}n=N+1;
 for(int z=1;z<100;z++){if(lines>z&&i==b-n){vline(N+"~"+TF+"~"+n,iTime(NULL,TF,i));d=i;}n=n+N+8*z;}}
 for(int v=iTime(NULL,TF,d);v<=iTime(NULL,TF,d)+10*24*60*60;v=v+TF*60)
 {n=N+1;for(int w=1;w<100;w++){if(lines>w&&v==iTime(NULL,TF,b)+n*TF*60){vline(N+"~"+TF+"~"+n,v);}n=n+N+8*w;}}}
//+------------------------------------------------------------------+
void info()
 {if(TF==1)object("~/~","�� = "+TF,9,colors,25,1);
 if(TF==5)object("~//~","�� = "+TF,9,colors,37,1);
 if(TF==15)object("~///~","�� = "+TF,9,colors,49,1);
 if(TF==30)object("~////~","�� = "+TF,9,colors,61,1);
 if(TF==60)object("~/////~","�� = "+TF,9,colors,73,1);
 if(TF==240)object("~//////~","�� = "+TF,9,colors,85,1);
 if(TF==1440)object("~///////~","�� = "+TF,9,colors,97,1);} 
//+------------------------------------------------------------------+ 
int start()
 {if(UGOL45==true){Lines(n45);object("/","Ugol = 45",9,colors,25,3);}if(UGOL90==true){Lines(n90);object("//","Ugol = 90",9,colors,37,3);}
 if(UGOL135==true){Lines(n135);object("///","Ugol = 135",9,colors,49,3);}if(UGOL180==true){Lines(n180);object("////","Ugol = 180",9,colors,61,3);}
 if(UGOL225==true){Lines(n225);object("/////","Ugol = 225",9,colors,73,3);}if(UGOL270==true){Lines(n270);object("//////","Ugol = 270",9,colors,85,3);}
 if(UGOL315==true){Lines(n315);object("///////","Ugol = 315",9,colors,97,3);}if(UGOL360==true){Lines(n360);object("////////","Ugol = 360",9,colors,109,3);}info();}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
void deinit()
 {for(int i = Bars; i >= 0; i--)
 {ObjectDelete(n45+"//"+i);ObjectDelete(n90+"//"+i);ObjectDelete(n135+"//"+i);ObjectDelete(n180+"//"+i);
 ObjectDelete(n225+"//"+i);ObjectDelete(n270+"//"+i);ObjectDelete(n315+"//"+i);ObjectDelete(n360+"//"+i);}}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~