//+------------------------------------------------------------------+ //| Тунель Вегаса.mq4 | //| Yeg | //| | //+------------------------------------------------------------------+ #property copyright "Yeg" #property link "" #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 DeepSkyBlue #property indicator_color2 Blue //---- input parameters extern int ПериодМА1=144; extern int ПериодМА2=169; extern int Уровень1=55; extern int Уровень2=89; extern int Уровень3=144; extern int Уровень4=233; extern int Уровень5=377; extern color Цель1=Red; extern color Цель2=Orange; extern color Цель3=Green; extern color Цель4=Yellow; extern color Цель5=Gold; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double l1,l2,l3,l4,l5,tv; //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE,0,2); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_LINE,0,2); SetIndexBuffer(1,ExtMapBuffer2); return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- return(0); } //+------------------------------------------------------------------+ //Эта функция показывает линии void Make() { ObjectCreate("Line1",OBJ_HLINE,0,0,l1); ObjectCreate("Line2",OBJ_HLINE,0,0,l2); ObjectCreate("Line3",OBJ_HLINE,0,0,l3); ObjectCreate("Line4",OBJ_HLINE,0,0,l4); ObjectCreate("Line5",OBJ_HLINE,0,0,l5); ObjectSet("Line1",OBJPROP_COLOR,Цель1); ObjectSet("Line2",OBJPROP_COLOR,Цель2); ObjectSet("Line3",OBJPROP_COLOR,Цель3); ObjectSet("Line4",OBJPROP_COLOR,Цель4); ObjectSet("Line5",OBJPROP_COLOR,Цель5); } //Эта функция прячет линии void Del() { ObjectDelete("Line1"); ObjectDelete("Line2"); ObjectDelete("Line3"); ObjectDelete("Line4"); ObjectDelete("Line5"); } //+------------------------------------------------------------------+ int start() { int limit,counted_bars=IndicatorCounted(); if(counted_bars<0)return(-1); if(counted_bars>0)counted_bars--; limit=Bars-counted_bars; for(int i=0;i<limit;i++) { ExtMapBuffer1=iMA(NULL,0,ПериодМА1,0,MODE_EMA,PRICE_CLOSE,i); ExtMapBuffer2=iMA(NULL,0,ПериодМА2,0,MODE_EMA,PRICE_CLOSE,i); if (Close[1]>ExtMapBuffer2 && Close[2]<ExtMapBuffer2) { Del(); tv=ExtMapBuffer2; l1=tv+Уровень1*Point; l2=tv+Уровень2*Point; l3=tv+Уровень3*Point; l4=tv+Уровень4*Point; l5=tv+Уровень5*Point; Make(); } //----------------------- if (Close[1]<ExtMapBuffer1 && Close[2]>ExtMapBuffer1) { Del(); tv=ExtMapBuffer1; l1=tv-Уровень1*Point; l2=tv-Уровень2*Point; l3=tv-Уровень3*Point; l4=tv-Уровень4*Point; l5=tv-Уровень5*Point; Make(); } } return(0); } //+------------------------------------------------------------------+ По изученному в этой ветке получилось так, вроде работает! За точку входа считается первое закрытие вверх или вниз от туннеля. Буду Благодарен если кто подскажет, что не так! Уважаемый Liv, а Вы будете продолжать уроки?