Navigation:Home > Content >

GoodTrade.mq4

Time: 2014-09-03 | Download file:GoodTrade.mq4

#property copyright ""
//#property link      "http://www.forex.hostmain.ru"
#property indicator_chart_window

extern string Block_1 = "Общие данные для системы";
extern int History = 1000;
extern string Block_2 = "Анализ на сектора";
extern int Begin_draw_down = 5;
extern int Begin_draw_up = 5;
extern int Sektor_bar = 13;
extern int f_period_draw = 1;
extern int clear_opposite = 4;
extern string Block_3 = "Анализ на микро волны";
extern int Wawe_bar = 21;
extern bool f_draw_wawe_fibo = TRUE;
extern bool f_draw_target_level = TRUE;
extern string Block_4 = "Анализ на установочный набор";
extern int DM_sdvig = 7;
extern int DM_xvost = 10;
extern string Block_5 = "Анализ на проекцию цен";
extern bool f_draw_mini_trend = false;
extern string ind_name="ups";

int MA_Per = 55;

int gia_184[10];
int gia_188[10];
int gi_192;
int gi_196;
int gi_200;
int gi_204;
int gi_208;
int gi_212;
int gia_216[10];
int gia_220[10];
int gia_224[10];
int gia_228[10];
int gia_232[10];
int gia_236[10];
int gia_240[7];
double gda_244[7];
int gia_248[7];
double gda_252[7];
int gia_256[10][5];
int gia_260[10][30];
double gda_264[10][30];
double gda_268[10][30];
double gda_272[10][30];
int gia_276[10][30];
int gia_280[10][5];
int gia_284[10][30];
double gda_288[10][30];
double gda_292[10][30];
double gda_296[10][30];
int gia_300[10][30];
int gia_304[10];
int gia_308[10];
int gia_312[10];
int gia_316[10];
int gi_320;
int g_count_324 = 0;
double gda_unused_328[10];
int gi_332 = 0;
int gi_336 = 0;
double gd_340;
double gd_348;
int gi_unused_356 = 0;
int g_time_360 = 0;
int gi_364 = 3;
int gi_368 = 3;
int gi_372 = 3;
int gi_376 = 3;
int gia_380[10];
string gs_384;
string gs_392;
int gi_400 = 0;
int gi_404;
int gi_408;
int gi_412 = 0;
int gi_unused_416 = 0;
int gi_420 = 0;
int gi_424 = 0;
double gd_428;
int gi_436 = 0;
int gi_440 = 0;
int gi_444 = 0;
int gi_448 = 0;
int gi_unused_452 = 0;
int gi_unused_456;
int gi_460;
int gi_unused_464;
int gi_468;
int gi_472;
int gi_476;
int gi_480;
int gi_unused_484;
bool gi_488;
int gia_492[10];
int gia_496[10];
int gia_500[10];
int g_count_504;
datetime gt_unused_508;
int gi_unused_512;
int gi_unused_516;
int gia_520[5];
int gia_524[5];

int gi_532 = 0;
int gi_536;
int gi_540;
int gi_544;
int gi_548 = 0;
int gia_552[10];
int gia_556[10];
int gia_560[10];
int gia_564[10];
int gi_568 = 0;
string gs_572 = "";
string gs_580 = "";
string gs_unused_588 = "";
string gs_unused_596 = "";
string gs_unused_604 = "";
string gs_unused_612 = "";
int gi_76 = 5;
int gi_80 = 0;
int g_error_84;
string g_name_88;
color g_color_96;
int gi_100 = 1;
int gi_104 = 1;
int gi_108;
int gi_112 = 1;
int gi_116 = 254;
int g_x_120;
int gi_124 = 1;
//******************
int      var_76 = 0;
int      var_80 = 0;
int      var_84 = 0;
int      var_88 = 0;
int      var_92 = 0;
int      var_96 = 0;
int      var_100 = 0;
int      var_104 = 0;
int      var_108 = 0;
int      var_112 = 0;
int      var_116 = 0;
int      var_120 = 0;
int      var_124;
int      var_128;
int      var_132;
int      var_136;
int      var_140;
int      var_144;
int      var_148 = 0;
double   var_152 = 1.618;
double   var_160 = 2;
double   var_168 = 2.618;
double   var_176 = 4.235;
int      var_184 = 1;
int      var_188 = 0;
int      var_192 = 0;
int      var_196;
int      var_200;
int      var_204;
int      var_208;
int      var_212;
int      var_216;
int      var_220 = 0;
double   var_224 = 1.618;
double   var_232 = 2;
double   var_240 = 2.618;
double   var_248 = 4.235;
int      var_256 = 1;
int      var_260 = 0;
int      var_264 = 0;
int      I;
int      var_272;
int      arr_276[9];
int      var_280 = Aqua;
double   var_284;
double   var_292;
double   var_300;
int      var_308;
int      var_312;
int      var_316 = 0;
int      var_320 = 0;
int      J;
int      var_328;
int      arr_332[9];
int      var_336 = Aqua;
double   var_340;
double   var_348;
double   var_356;
int      var_364;
int      var_368;
int      var_372 = 0;
int      var_376 = 0;
int      var_380;
int      var_384;
int      var_388;
int      var_392;
int      arr_396[3,4];
double   arr_400[3,4];
double   arr_404[3,4];
int      var_408;
int      var_412;
int      var_416;
int      var_420;
int      arr_424[3,4];
double   arr_428[3,4];
double   arr_432[3,4];
string   var_436;
string   var_444;
string   var_452;
string   var_460;
double   var_468;
double   var_476;
double   var_484;
double   var_492;
double   var_500;
double   var_508;
double   var_516;
double   var_524;
int      var_532;
int      var_536;
int      var_540;
int      var_544;
int      var_548;
int      var_552;
int      var_556;
int      var_560;
int      var_564;
int      var_568;
//*********************
int start() {
   datetime l_time_0;
   double ld_unused_4;
   double ld_unused_20;
   double ld_unused_28;
   datetime l_time_36;
   double ld_unused_48;
   double ld_unused_56;
   double ld_unused_64;
   double ld_84;
   if (gi_336 != 0) {
      GlobalVariableSet(ind_name+"MT4_Ekspert_start_" + gs_392 + gs_384, 0);
      GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
      if (gi_568 == FALSE) {
         gi_568 = TRUE;
         //Comment("Останов эксперта. Код причины=", gi_336);
      }
      return (0);
   }
   gi_536 = GetTickCount();
   if (gi_412 == FALSE) {

      if (IsTesting()) {
         gi_420 = TRUE;
         gi_532 = 0;
         gi_424 = TRUE;
         //Comment("Ekspert_start : Тестовый режим.");
         gd_340 = High[0] - Low[0] + Point;
      } else {
         gi_420 = FALSE;
         gi_532 = gi_320;
         gi_424 = FALSE;
         ld_84 = 0;
         for (int li_80 = gi_320; li_80 >= 1; li_80--) ld_84 = ld_84 + High[li_80] - Low[li_80];
         gd_340 = ld_84 / gi_320;
      }
      if (gi_420 == FALSE) {
         GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
         GlobalVariableSet(ind_name+"MT4_Ekspert_load_" + gs_392 + gs_384, 1);
         GlobalVariableSet(ind_name+"MT4_Ekspert_start_" + gs_392 + gs_384, 1);
      }
      gd_348 = gd_340 / Point;
      gd_428 = gd_340 / 4.0;
      if (gd_428 < Point) gd_428 = Point;
      GlobalVariableSet(ind_name+"MT4_f_sdvig" + gs_392 + gs_384, gd_428);
      //Comment("Ekspert_start : Инициализация данных. Величина среднего бара=", DoubleToStr(gd_348, 0), " пунктов.");
      g_time_360 = Time[gi_532 + 1];
      g_count_324 = 0;
   }
   for (int i = gi_532; i >= 0; i--) 
   {
      l_time_0 = Time[i];
      ld_unused_4 = Open[i];
      ld_unused_20 = Low[i];
      ld_unused_28 = Close[i];
      if (g_time_360 != Time[i + 1]) 
      {
         if (g_time_360 != Time[i + 2] && gi_424 == TRUE) 
         {
            //Comment("Ekspert_start : Разрыв истории.");
            for (gi_548 = 1; gi_548 < Bars; gi_548++)
               if (g_time_360 == Time[gi_548]) break;
            gi_532 = gi_548;
            gi_424 = FALSE;
            if (gi_420 == FALSE) GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
            //Comment("Ekspert : Перезапуск по разрыву. Обработать ", gi_548, " баров. Последний сформированный бар=", TimeToStr(Time[1], TIME_SECONDS), " Последний обработанный бар=", TimeToStr(g_time_360, TIME_SECONDS));
            GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
            return (0);
         }
//*************
         ld_unused_48 = High[i + 1];
         ld_unused_56 = Low[i + 1];
         l_time_36 = Time[i + 1];
         ld_unused_64 = Close[i + 1];
         g_time_360 = l_time_36;
         g_count_324++;
         if (gi_448 != gi_440) gi_448 = gi_440;
         if (gi_444 != gi_436) gi_444 = gi_436;
         
         gi_436 = gt_d_wawe_sell(gia_240, gda_244, gi_192, i, gd_428, Wawe_bar, gi_436, f_draw_wawe_fibo, f_draw_target_level);
         gi_440 = gt_d_wawe_buy(gia_248, gda_252, gi_196, i, gd_428, Wawe_bar, gi_440, f_draw_wawe_fibo, f_draw_target_level);
         
         gi_unused_452 = 0;
//*************         
         if (f_draw_mini_trend == TRUE) 
         {
            for (int ii = 1; ii <= 3; ii++) 
            {
               gi_400 = gia_380[ii];
               gt_trend_3_5_7_down(gi_400, ii, i, gia_228, gia_232, gia_236, gia_496);
               gt_trend_3_5_7_up(gi_400, ii, i, gia_216, gia_220, gia_224, gia_500);
            }
         }
//*************         
         for (ii = 4; ii <= gia_380[0]; ii++) 
         {
            gi_400 = gia_380[ii];
            gia_560[ii] = gia_552[ii];
            
            gia_552[ii] = gt_max(gia_308, gia_304, gia_256, gia_260, gda_264, gda_272, gda_268, gia_276, ii, i, gi_400, gi_408, g_count_324);
            gt_max_draw(gia_552[ii], gia_184, gia_188, gia_256, gia_260, gda_264, gda_268, gia_276, ii, gi_400, g_count_324, i);
            
            gia_564[ii] = gia_556[ii];
            
            gia_556[ii] = gt_min(gia_316, gia_312, gia_280, gia_284, gda_288, gda_296, gda_292, gia_300, ii, i, gi_400, gi_404, g_count_324);
            gt_min_draw(gia_556[ii], gia_184, gia_188, gia_280, gia_284, gda_288, gda_296, gia_300, ii, gi_400, g_count_324, i);
            
            if (gia_256[ii][2] == 1 && gia_280[ii][2] == 1 && gia_276[ii][0] > gia_300[ii][0]) 
            {
               gia_280[ii][0] = gia_280[ii][1];
               gia_280[ii][1] = 10;
               gia_280[ii][2] = 0;
               gia_280[ii][3] = 0;
               gia_280[ii][4] = 0;
               gia_316[ii] = 0;
               gia_312[ii] = 0;
               gt_sektor_clear_up(gi_400);
            }
            if (gia_256[ii][2] == 1 && gia_280[ii][2] == 1 && gia_300[ii][0] > gia_276[ii][0]) {
               gia_256[ii][0] = gia_256[ii][1];
               gia_256[ii][1] = 10;
               gia_256[ii][2] = 0;
               gia_256[ii][3] = 0;
               gia_256[ii][4] = 0;
               gia_308[ii] = 0;
               gia_304[ii] = 0;
               gt_sektor_clear_down(gi_400);
            }
            if (clear_opposite > 0 && gia_492[ii] == 0) {
               if (gia_280[ii][1] == clear_opposite + 10) gia_492[ii] = 1;
               else
                  if (gia_256[ii][1] == clear_opposite + 10) gia_492[ii] = 2;
            }
            if (clear_opposite > 0 && gia_280[ii][1] == clear_opposite + 10 && gia_492[ii] == 1) {
               if (gda_296[ii][0] < gda_296[ii][gia_280[ii][1]]) {
                  gia_492[ii] = 2;
                  gia_256[ii][0] = gia_256[ii][1];
                  gia_256[ii][1] = 10;
                  gia_256[ii][2] = 0;
                  gia_256[ii][3] = 0;
                  gia_256[ii][4] = 0;
                  gia_308[ii] = 0;
                  gia_304[ii] = 0;
               }
            }
            if (clear_opposite > 0 && gia_256[ii][1] == clear_opposite + 10 && gia_492[ii] == 2) {
               if (gda_268[ii][0] > gda_268[ii][gia_256[ii][1]]) {
                  gia_492[ii] = 1;
                  gia_280[ii][0] = gia_280[ii][1];
                  gia_280[ii][1] = 10;
                  gia_280[ii][2] = 0;
                  gia_280[ii][3] = 0;
                  gia_280[ii][4] = 0;
                  gia_316[ii] = 0;
                  gia_312[ii] = 0;
               }
            }
         }
 //*************        
         
         gi_unused_456 = gi_460;
         gi_unused_464 = gi_468;
         if (gi_460 == 2) gi_468 = 0;
         if (gi_468 == 2) gi_460 = 0;
         gi_460 = gt_dm_nabor_sell(gi_460, gi_204, gi_208, DM_sdvig, i, gd_428, gia_524, gia_520);
         gi_468 = gt_dm_nabor_buy(gi_468, gi_200, gi_208, DM_sdvig, i, gd_428, gia_524, gia_520);
         if (gi_460 == 2) 
         {
            gi_480 = 2;
            gi_472 = 1;
            gi_476 = 0;
            gt_unused_508 = Time[i];
            gi_488 = FALSE;
         }
         if (gi_468 == 2) {
            gi_480 = 1;
            gi_476 = 1;
            gi_472 = 0;
            gt_unused_508 = Time[i];
            gi_488 = FALSE;
         }
//*************         
         if (gi_480 == 2 && gi_472 == 1) 
         {
            gi_472 = gt_dm_xvost_sell(gi_472, gi_212, DM_sdvig, DM_xvost, i, gd_428, gia_524);
            if (gi_472 == 2) {
               if (gi_420 == FALSE && i == 0 && gi_488 == FALSE) 
               //Alert(gs_392, "-", gs_384, "(МТ time=", TimeToStr(l_time_0, TIME_DATE|TIME_MINUTES), ") РЯД ДЕМАРКА ЗАВЕРШЕН. Сигнал на продажу сформирован.");
               g_count_504++;
               gi_488 = TRUE;
            }
         }
//*************         
         if (gi_480 == 1 && gi_476 == 1) 
         {
            gi_476 = gt_dm_xvost_buy(gi_476, gi_212, DM_sdvig, DM_xvost, i, gd_428, gia_520);
            if (gi_476 == 2) {
               if (gi_420 == FALSE && i == 0 && gi_488 == FALSE) 
               //Alert(gs_392, "-", gs_384, "(МТ time=", TimeToStr(l_time_0, TIME_DATE|TIME_MINUTES), ") РЯД ДЕМАРКА ЗАВЕРШЕН. Сигнал на покупку сформирован.");
               g_count_504++;
               gi_488 = TRUE;
            }
         }
      }
//*************      
      gi_540 = GetTickCount();
      gi_544 = gi_540 - gi_536;

      if (gi_420 == TRUE) gs_572 = "\nMT4_" + "GoodTrade" + " в тестовом режиме.";
      else {
         if (gi_424 == FALSE) gs_572 = "\nMT4_" + "GoodTrade" + " обработка истории.";
         else gs_572 = "\nMT4_" + "GoodTrade" + " готов (" + DoubleToStr(gi_544, 0) + " мс.)";
      }
      //Comment("Средний бар на истории =", DoubleToStr(gd_348, 0), " пунктам", gs_580, gs_572);
   }
   if (gi_424 == FALSE) 
   {
      if (g_time_360 != Time[1]) 
      {
         for (gi_548 = 1; gi_548 < Bars; gi_548++)
            if (g_time_360 == Time[gi_548]) break;
         gi_532 = gi_548;
         //Comment("Ekspert : Перезапуск по разрыву (в конце цикла) z_dop=", gi_548, " T[1}=", TimeToStr(Time[1], TIME_SECONDS), " T[z_dop]=", TimeToStr(Time[gi_548], TIME_SECONDS), " old_bar=", TimeToStr(g_time_360, TIME_SECONDS));
         if (gi_420 == FALSE) GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
      } else {
         if (gi_420 == FALSE) {
            GlobalVariableSet(ind_name+"MT4_Ekspert_start_" + gs_392 + gs_384, 0);
            GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 1);
         }
         gi_424 = TRUE;
         gi_532 = 0;
      }
   }
   if (gi_332 == FALSE) {
      gi_332 = TRUE;
   }
   gi_412 = TRUE;
   return (0);
}

int init() {
   bool li_24 = FALSE;
   gs_392 = Symbol();
   gs_384 = Period();
   gi_320 = 200;
   if (!IsTesting()) {
      if (Bars - gia_380[4] < 5 * gia_380[4]) {
         //Comment("Ekspert_start : Не достаточно баров истории (", Bars, ") для работы. Работа эксперта завершена.");
         gi_336 = 2;
         return (0);
      }
      if (History >= gi_320) gi_320 = History;
      else //Comment("Ekspert_start : Заданное Вами количество баров истории меньше минимального значения. Скорректировано программой до ", gi_320, " баров.");
      if (gi_320 > Bars) {
         gi_320 = Bars - (gia_380[4] + 50);
         //Comment("Ekspert_start : Количество баров истории больше чем баров на графике. Скорректировано программой до максимального значения=:", gi_320, " баров.");
      }
   }
   int l_reason_0 = UninitializeReason();
   if (l_reason_0 == REASON_PARAMETERS) {
      //Comment("Ekspert_start : Рестарт. Параметры были изменены. Cобытие=", l_reason_0);
      li_24 = TRUE;
   }
   if (l_reason_0 == REASON_CHARTCHANGE) {
      //Comment("Ekspert_start : Рестарт. Символ или период был изменён. Cобытие=", l_reason_0);
      li_24 = TRUE;
   }
   if (l_reason_0 == REASON_RECOMPILE) {
      //Comment("Ekspert_start : Рестарт. Эксперт перекомпилирован. Cобытие=", l_reason_0);
      li_24 = TRUE;
   }
   if (Begin_draw_down < 2) {
      gi_408 = 2;
      //Comment("Ekspert_start : Параметр-Begin_draw_down с ошибкой. Исправлен прораммой и преобразован к ", gi_408);
   } else gi_408 = Begin_draw_down;
   if (Begin_draw_up < 2) {
      gi_404 = 2;
      //Comment("Ekspert_start : Параметр-Begin_draw_up с ошибкой. Исправлен прораммой и преобразован к ", gi_404);
   } else gi_404 = Begin_draw_up;
   if (f_period_draw < 0 || f_period_draw > 13) {
      gia_380[0] = 1;
      //Comment("Ekspert_start : Неверный параметр f_period_draw. Установлено по умолчанию :", gia_380[0]);
   } else gia_380[0] = f_period_draw + 3;
   gia_380[1] = 5;
   gia_380[2] = 7;
   gia_380[3] = 9;
   if (f_draw_mini_trend == TRUE) //Comment("Ekspert_start : Установлены периоды для проекции цен. 1-й=", gia_380[1], " 2-й=", gia_380[2], " 3-й=", gia_380[3]);
   if (Sektor_bar < gia_380[3] + 2) {
      Sektor_bar = gia_380[3] + 2;
      //Comment("Ekspert_start : Параметр - Sektor_bar введён с ошибкой (минимально может быть равен ", Sektor_bar, "). Исправлен прораммой к ", Sektor_bar);
   }
   double ld_16 = 2.0 * MathCeil((Sektor_bar - 1) / 2) + 1.0;
   if (ld_16 != Sektor_bar && gia_380[0] > 3) {
      gia_380[4] = Sektor_bar + 1;
      //Comment("Ekspert_start : Параметр - Sektor_bar введён с ошибкой. Исправлен прораммой и преобразован к ", gia_380[4]);
   } else gia_380[4] = Sektor_bar;
   gi_364 = 1.618 * gia_380[4];
   ld_16 = MathMod(gi_364 - 1, 2);
   if (ld_16 != 0.0 && gia_380[0] > 4) gia_380[5] = gi_364 + 1;
   else gia_380[5] = gi_364;
   gi_368 = 2.618 * gia_380[4];
   ld_16 = MathMod(gi_368 - 1, 2);
   if (ld_16 != 0.0 && gia_380[0] > 5) gia_380[6] = gi_368 + 1;
   else gia_380[6] = gi_368;
   gi_372 = 3.618 * gia_380[4];
   ld_16 = MathMod(gi_372 - 1, 2);
   if (ld_16 != 0.0 && gia_380[0] > 6) gia_380[7] = gi_372 + 1;
   else gia_380[7] = gi_372;
   gi_376 = 4.236 * gia_380[4];
   ld_16 = MathMod(gi_376 - 1, 2);
   if (ld_16 != 0.0 && gia_380[0] > 7) gia_380[8] = gi_376 + 1;
   else gia_380[8] = gi_376;
   if (gia_380[0] == 3) //Comment("Ekspert_start : Секторный анализ отключён. Смежных периодов нет.");
   if (gia_380[0] == 4) //Comment("Ekspert_start : Период для секторного анализа= ", gia_380[4], ". Смежных периодов нет.");
   if (gia_380[0] == 5) //Comment("Ekspert_start : Период для секторного анализа= ", gia_380[4], ". Смежные периоды : 2-й=", gia_380[5]);
   if (gia_380[0] == 6) //Comment("Ekspert_start : Период для секторного анализа= ", gia_380[4], ". Смежные периоды : 2-й=", gia_380[5], " 3-й=", gia_380[6]);
   if (gia_380[0] == 7) //Comment("Ekspert_start : Период для секторного анализа= ", gia_380[4], ". Смежные периоды : 2-й=", gia_380[5], " 3-й=", gia_380[6], " 4-й=", gia_380[7]);
   if (gia_380[0] == 8) //Comment("Ekspert_start : Период для секторного анализа= ", gia_380[4], ". Смежные периоды : 2-й=", gia_380[5], " 3-й=", gia_380[6], " 4-й=", gia_380[7], " 5-й=", gia_380[8]);
   if (li_24 == TRUE) {
   
   for (int i = ObjectsTotal()-1; i >= 0; i--)   
   if (StringSubstr(ObjectName(i), 0, StringLen(ind_name)) == ind_name)
       ObjectDelete(ObjectName(i));
       
      if (f_draw_wawe_fibo) {
         ObjectDelete(ind_name+"MyFibo_sell-" + DoubleToStr(0, 0));
         ObjectDelete(ind_name+"MyFibo_buy-" + DoubleToStr(0, 0));
      }
      if (f_draw_target_level) {
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(3, 0));
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(4, 0));
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(3, 0));
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(4, 0));
      }
      WindowRedraw();
      li_24 = FALSE;
   }
   gi_436 = 0;
   gi_440 = 0;
   gi_444 = 0;
   gi_448 = 0;
   gi_unused_452 = 0;
   if (Wawe_bar < 9) {
      Wawe_bar = 9;
      //Comment("Ekspert_start : Неверный параметр Wawe_bar (не может быть меньше 9). Установлено по умолчанию :", Wawe_bar);
   }
   ld_16 = MathMod(Wawe_bar - 1, 2);
   if (ld_16 != 0.0) {
      Wawe_bar++;
      //Comment("Ekspert_start : Неверный параметр Wawe_bar (должен быть нечётным). Установлено по умолчанию :", Wawe_bar);
   }
   for (int x = 0; x < 10; x++) {
      gia_256[x][0] = 0;
      gia_256[x][1] = 0;
      gia_256[x][2] = 0;
      gia_256[x][3] = 0;
      gia_256[x][4] = 0;
      gia_280[x][0] = 0;
      gia_280[x][1] = 0;
      gia_280[x][2] = 0;
      gia_280[x][3] = 0;
      gia_280[x][4] = 0;
      gia_304[x] = 0;
      gia_308[x] = 0;
      gia_312[x] = 0;
      gia_316[x] = 0;
      gda_288[x][0] = 0;
      gda_288[x][1] = 0;
      gda_292[x][0] = 0;
      gda_292[x][1] = 0;
      gda_296[x][0] = 0;
      gda_296[x][1] = 0;
      gia_284[x][0] = 0;
      gia_284[x][1] = 0;
      gda_264[x][0] = 0;
      gda_264[x][1] = 0;
      gda_268[x][0] = 0;
      gda_268[x][1] = 0;
      gda_272[x][0] = 0;
      gda_272[x][1] = 0;
      gia_260[x][0] = 0;
      gia_260[x][1] = 0;
      gia_496[x] = 0;
      gia_500[x] = 0;
   }
   gia_184[0] = 16776960;
   gia_184[1] = 16776960;
   gia_184[2] = 16776960;
   gia_184[3] = 16776960;
   gia_184[4] = 8388352;
   gia_184[5] = 65535;
   gia_184[6] = 16436871;
   gia_184[7] = 14524637;
   gia_184[8] = 9639167;
   gia_184[9] = 6908265;
   gia_188[0] = RGB(40, 40, 40);
   gia_188[1] = RGB(40, 40, 40);
   gia_188[2] = RGB(60, 60, 60);
   gia_188[3] = RGB(80, 80, 80);
   gia_188[4] = RGB(0, 83, 16);
   gia_188[5] = RGB(94, 94, 0);
   gia_188[6] = RGB(0, 70, 90);
   gia_188[7] = RGB(81, 0, 81);
   gia_188[8] = RGB(70, 20, 0);
   gia_188[9] = 6908265;
   gi_192 = 13353215;
   gi_196 = 8388352;
   gi_204 = 13353215;
   gi_200 = 8388352;
   gi_208 = 16776960;
   gi_212 = RGB(255, 255, 128);
   gia_216[0] = 3329330;
   gia_216[1] = 3329330;
   gia_216[2] = 32768;
   gia_216[3] = 25600;
   gia_220[0] = 16748574;
   gia_220[1] = 16748574;
   gia_220[2] = 13434880;
   gia_220[3] = 9109504;
   gia_224[0] = 15631086;
   gia_224[1] = 15631086;
   gia_224[2] = 14822282;
   gia_224[3] = 13828244;
   gia_228[0] = 3937500;
   gia_228[1] = 17919;
   gia_228[2] = 3937500;
   gia_228[3] = 2237106;
   gia_232[0] = 16748574;
   gia_232[1] = 16748574;
   gia_232[2] = 13434880;
   gia_232[3] = 9109504;
   gia_236[0] = 15631086;
   gia_236[1] = 15631086;
   gia_236[2] = 14822282;
   gia_236[3] = 13828244;
   gt_color_user(gia_184, gia_188, gi_192, gi_196, gi_204, gi_200, gi_208, gi_212, gia_216, gia_220, gia_224, gia_228, gia_232, gia_236);
   gi_unused_512 = 0;
   gi_unused_516 = 0;
   g_count_504 = 0;
   for (x = 0; x < 5; x++) {
      gia_520[x] = 0;
      gia_524[x] = 0;
   }
   gi_332 = FALSE;
   gi_412 = FALSE;
   gi_460 = 0;
   gi_468 = 0;
   gi_unused_456 = 0;
   gi_unused_464 = 0;
   gi_480 = 0;
   gi_unused_484 = 0;
   gi_488 = TRUE;
   return (0);
}

int deinit() {
   if (gi_420 == FALSE) {
      //Comment("Деинициализация. Очистка графика");
      
   for (int i = ObjectsTotal()-1; i >= 0; i--)   
   if (StringSubstr(ObjectName(i), 0, StringLen(ind_name)) == ind_name)
       ObjectDelete(ObjectName(i));
       
      if (f_draw_wawe_fibo == TRUE) {
         ObjectDelete(ind_name+"MyFibo_sell-" + DoubleToStr(0, 0));
         ObjectDelete(ind_name+"MyFibo_buy-" + DoubleToStr(0, 0));
      }
      if (f_draw_target_level) {
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(3, 0));
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(4, 0));
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(3, 0));
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(4, 0));
      }
   } else //Comment("Деинициализация. Тестовый режим. Очистка графика не производится.");
   GlobalVariableSet(ind_name+"MT4_Ekspert_load_" + gs_392 + gs_384, 0);
   GlobalVariableSet(ind_name+"MT4_Ekspert_start_" + gs_392 + gs_384, 0);
   GlobalVariableSet(ind_name+"MT4_Ekspert_work_" + gs_392 + gs_384, 0);
   return (0);
}

int gt_color_user(int &aia_0[], int &aia_4[], int ai_unused_8, int ai_unused_12, int ai_unused_16, int ai_unused_20, int ai_unused_24, int ai_unused_28, int &aia_32[], int &aia_36[], int &aia_40[], int &aia_44[], int &aia_48[], int &aia_52[]) {
   aia_0[0] = 16776960;
   aia_0[1] = 16776960;
   aia_0[2] = 16776960;
   aia_0[3] = 16776960;
   aia_0[4] = 8388352;
   aia_0[5] = 65535;
   aia_0[6] = 16436871;
   aia_0[7] = 14524637;
   aia_0[8] = 9639167;
   aia_0[9] = 6908265;
   aia_4[0] = RGB(40, 40, 40);
   aia_4[1] = RGB(40, 40, 40);
   aia_4[2] = RGB(60, 60, 60);
   aia_4[3] = RGB(80, 80, 80);
   aia_4[4] = RGB(0, 83, 16);
   aia_4[5] = RGB(94, 94, 0);
   aia_4[6] = RGB(0, 70, 90);
   aia_4[7] = RGB(81, 0, 81);
   aia_4[8] = RGB(70, 20, 0);
   aia_4[9] = 6908265;
   ai_unused_8 = 13353215;
   ai_unused_12 = 8388352;
   ai_unused_16 = 13353215;
   ai_unused_20 = 8388352;
   ai_unused_24 = 16776960;
   ai_unused_28 = RGB(255, 255, 128);
   aia_32[0] = 3329330;
   aia_32[1] = 3329330;
   aia_32[2] = 32768;
   aia_32[3] = 25600;
   aia_36[0] = 16748574;
   aia_36[1] = 16748574;
   aia_36[2] = 13434880;
   aia_36[3] = 9109504;
   aia_40[0] = 15631086;
   aia_40[1] = 15631086;
   aia_40[2] = 14822282;
   aia_40[3] = 13828244;
   aia_44[0] = 3937500;
   aia_44[1] = 17919;
   aia_44[2] = 3937500;
   aia_44[3] = 2237106;
   aia_48[0] = 16748574;
   aia_48[1] = 16748574;
   aia_48[2] = 13434880;
   aia_48[3] = 9109504;
   aia_52[0] = 15631086;
   aia_52[1] = 15631086;
   aia_52[2] = 14822282;
   aia_52[3] = 13828244;
   return (0);
}

int RGB(int red_value,int green_value,int blue_value)
  {
//---- check parameters
   if(red_value<0)     red_value=0;
   if(red_value>255)   red_value=255;
   if(green_value<0)   green_value=0;
   if(green_value>255) green_value=255;
   if(blue_value<0)    blue_value=0;
   if(blue_value>255)  blue_value=255;
//----
   green_value<<=8;
   blue_value<<=16;
   return(red_value+green_value+blue_value);
  }
//*****************

//+------------------------------------------------------------------+

int gt_dm_xvost_sell(int inp_gtdmxs_0, int clr, int inp_gtdmxs_8, int inp_gtdmxs_12, int shift, double inp_gtdmxs_20, int& array[])
{
int    i;
int    j;
double close;
double high;
double low;
double open;
int    time;

close = Close[shift + 1];
time = Time[shift + 1];
high = High[shift + 1];
low = Low[shift + 1];
open = Open[shift + 1];

if (array[2] == 0) array[1] = 0;
array[2]++;
i = shift + 2;
var_80 = array[0] + array[2];
j = iLowest(NULL,0,MODE_LOW,var_80 - 1,i);

if (close < Low[j])
   {
   //gt_move_simvol(0,"DM-xvost-reset-",array[4],clr,253,2,time,Low[j]);
   //ObjectDelete(ind_name+"DM-sell-begin-" + DoubleToStr(array[4],0));
   //ObjectDelete(ind_name+"DM-sell-price-" + DoubleToStr(array[4],0));*/
   for (i = array[3]; i > 0; i--)
      {
      ObjectDelete(ind_name+"DM-xvost-sell-" + DoubleToStr(i,0) + DoubleToStr(array[4],0));
      }
   array[0] = 0;
   array[1] = 0;
   array[2] = 0;
   array[3] = 0;
   return(0);
   }

if (array[1] == 0)
   {
   for (j = inp_gtdmxs_8; j <= var_80; j++)
      {
      if (close <= Low[shift + j]) break;
      }
   if (j <= var_80)
      {
      //gt_move_simvol(0,"DM-sell-begin-",array[4],clr,252,2,time,low - 3 * inp_gtdmxs_20);
      //gt_move_text(0,"DM-sell-price-",array[4],clr,DoubleToStr(close,Digits),10,"Verdana",time,low - inp_gtdmxs_20 * 6.0);
      array[1] = 1;
      }
   }

if (array[1] == 0) return(1);

if (close > High[shift + inp_gtdmxs_8 - 1])
   {
   array[3]++;
   if (array[3] < inp_gtdmxs_12)
      {
      //gt_move_text(0,"DM-xvost-sell-" + DoubleToStr(array[3],0),array[4],clr,DoubleToStr(array[3],0),10,"Verdana",time,high + inp_gtdmxs_20 * 8.0);
      }
   }

if (array[3] == inp_gtdmxs_12)
   {
   gt_move_simvol(0,"DM-xvost-sell-end-",array[4],clr,202,2,time,high + inp_gtdmxs_20 * 4.5);
   gt_move_text(0,"DM-xvost-sell-p-end-",array[4],clr,DoubleToStr(close,Digits),10,"Verdana",time,high + inp_gtdmxs_20 * 8.0);
   array[0] = 0;
   array[1] = 0;
   array[2] = 0;
   array[3] = 0;
   array[4]++;
   return(2);
   }
return(1);
}

//+------------------------------------------------------------------+

int gt_dm_xvost_buy(int inp_gtdmxb_0, int clr, int inp_gtdmxb_8, int inp_gtdmxb_12, int shift, double inp_gtdmxb_20, int& array[])
{
int    i;
int    j;
double close;
double high;
double low;
double open;
int    time;

close = Close[shift + 1];
time = Time[shift + 1];
high = High[shift + 1];
low = Low[shift + 1];
open = Open[shift + 1];

if (array[2] == 0) array[1] = 0;
array[2]++;
i = shift + 2;
var_96 = array[0] + array[2];
j = iHighest(NULL,0,MODE_HIGH,var_96 - 1,i);

if (close > High[j])
   {
   //gt_move_simvol(0,"DM-xvost-reset-",array[4],clr,253,2,time,High[j]);
   //ObjectDelete(ind_name+"DM-buy-begin-" + DoubleToStr(array[4],0));
   //ObjectDelete(ind_name+"DM-buy-price-" + DoubleToStr(array[4],0));
   for (i = array[3]; i > 0; i--)
      {
      ObjectDelete(ind_name+"DM-xvost-buy-" + DoubleToStr(i,0) + DoubleToStr(array[4],0));
      }
   array[0] = 0;
   array[1] = 0;
   array[2] = 0;
   array[3] = 0;
   return(0);
   }

if (array[1] == 0)
   {
   for (j = inp_gtdmxb_8; j <= var_96; j++)
      {
      if (close >= High[shift + j]) break;
      }
   if (j <= var_96)
      {
      //gt_move_simvol(0,"DM-buy-begin-",array[4],clr,252,2,time,high + inp_gtdmxb_20 * 4.0);
      //gt_move_text(0,"DM-buy-price-",array[4],clr,DoubleToStr(close,Digits),10,"Verdana",time,high + inp_gtdmxb_20 * 7.0);
      array[1] = 1;
      }
   }

if (array[1] == 0) return(1);

if (close < Low[shift + inp_gtdmxb_8 - 1])
   {
   array[3]++;
   if (array[3] < inp_gtdmxb_12)
      {
      //gt_move_text(0,"DM-xvost-buy-" + DoubleToStr(array[3],0),array[4],clr,DoubleToStr(array[3],0),10,"Verdana",time,low - inp_gtdmxb_20 * 7.0);
      }
   }

if (array[3] == inp_gtdmxb_12)
   {
   gt_move_simvol(0,"DM-xvost-buy-end-",array[4],clr,200,2,time,low - inp_gtdmxb_20 * 4.0);
   gt_move_text(0,"DM-xvost-buy-p-end-",array[4],clr,DoubleToStr(close,Digits),10,"Verdana",time,low - inp_gtdmxb_20 * 7.0);
   array[0] = 0;
   array[1] = 0;
   array[2] = 0;
   array[3] = 0;
   array[4]++;
   return(2);
   }
return(1);
}

//+------------------------------------------------------------------+

int gt_dm_nabor_buy(int inp_gtdmnb_0, int inp_gtdmnb_4, int inp_gtdmnb_8, int inp_gtdmnb_12, int shift, double inp_gtdmnb_20, int& sarray[], int& barray[])
{
int    var_gtdmnb_36;
int    i;
int    var_gtdmnb_44;
int    time;
double close;
double low;
double high;

time = Time[shift + 1];
close = Close[shift + 1];
low = Low[shift + 1];
high = High[shift + 1];

if ((inp_gtdmnb_0 == 0) && (var_108 != 0))
   {
   if (var_108 >= inp_gtdmnb_12)
      {
      for (i = 1; i <= var_108; i++)
         {
         ObjectDelete(ind_name+"DM-buy_temp-" + DoubleToStr(i,0));
         }
      }
   var_108 = 0;
   }
      else
   {
   if ((close >= High[iHighest(NULL,0,MODE_HIGH,var_108,shift + var_108)]) && (var_108 > 1))
      {
      if (var_108 >= inp_gtdmnb_12)
         {
         for (i = 1; i <= var_108; i++)
            {
            ObjectDelete(ind_name+"DM-buy_temp-" + DoubleToStr(i,0));
            }
         }
      var_108 = 0;
      return(0);
      }
   }

if (Close[shift + inp_gtdmnb_12 + 1] > close)
   {
   if ((var_108 == 0) && (Close[shift + 2 + inp_gtdmnb_12] > Close[shift + 2])) return(0);
   var_108++;
   if (var_108 == inp_gtdmnb_12)
      {
      for (i = var_108; i >= 1; i--)
         {
         //gt_move_text(0,"DM-buy_temp-",var_108 - i + 1,inp_gtdmnb_4,DoubleToStr(var_108 - i + 1,0),10,"Verdana",Time[shift + i],Low[shift + i] - inp_gtdmnb_20);
         }
      }
   if (var_108 > inp_gtdmnb_12)
      {
      var_gtdmnb_36 = var_108 / 10;
      var_gtdmnb_44 = var_108 - var_gtdmnb_36 * 10;
      //gt_move_text(0,"DM-buy_temp-",var_108,inp_gtdmnb_4,DoubleToStr(var_gtdmnb_44,0),10,"Verdana",time,low - inp_gtdmnb_20);
      }
   return(1);
   }

if (var_108 >= inp_gtdmnb_12)
   {
   for (i = 1; i <= var_108; i++)
      {
      ObjectDelete(ind_name+"DM-buy_temp-" + DoubleToStr(i,0));
      }
   }

if (var_108 < inp_gtdmnb_12 + 5)
   {
   var_108 = 0;
   return(0);
   }

var_gtdmnb_36 = 1;
for (i = var_108; i >= 1; i--)
   {
   if (var_gtdmnb_36 == 10) var_gtdmnb_36 = 0;
   //gt_move_text(0,"DM-buy-" + DoubleToStr(var_108 - i + 1,0) + "-",var_112,inp_gtdmnb_8,DoubleToStr(var_gtdmnb_36,0),10,"Verdana",Time[shift + i + 1],Low[shift + i + 1] - inp_gtdmnb_20);
   var_gtdmnb_36++;
   }

//ObjectDelete(ind_name+"DM-sell-begin-" + DoubleToStr(sarray[4],0));
//ObjectDelete(ind_name+"DM-buy-begin-" + DoubleToStr(barray[4],0));
//ObjectDelete(ind_name+"DM-sell-price-" + DoubleToStr(sarray[4],0));
//ObjectDelete(ind_name+"DM-buy-price-" + DoubleToStr(barray[4],0));

for (i = barray[3]; i > 0; i--)
   {
   ObjectDelete(ind_name+"DM-xvost-buy-" + DoubleToStr(i,0) + DoubleToStr(barray[4],0));
   }

for (i = sarray[3]; i > 0; i--)
   {
   ObjectDelete(ind_name+"DM-xvost-sell-" + DoubleToStr(i,0) + DoubleToStr(sarray[4],0));
   }

barray[0] = var_108;
barray[1] = 0;
barray[2] = 0;
barray[3] = 0;
sarray[0] = 0;
sarray[1] = 0;
sarray[2] = 0;
sarray[3] = 0;
var_108 = 0;
var_112++;
return(2);
}

//+------------------------------------------------------------------+

int gt_dm_nabor_sell(int inp_gtdmns_0, int inp_gtdmns_4, int inp_gtdmns_8, int inp_gtdmns_12, int shift, double inp_gtdmns_20, int& sarray[], int& barray[])
{
int    var_gtdmns_36;
int    i;
int    var_gtdmns_44;
int    time;
double close;
double low;
double high;

time = Time[shift + 1];
close = Close[shift + 1];
low = Low[shift + 1];
high = High[shift + 1];

if ((inp_gtdmns_0 == 0) && (var_116 != 0))
   {
   if (var_116 >= inp_gtdmns_12)
      {
      for (i = 1; i <= var_116; i++)
         {
         ObjectDelete(ind_name+"DM-sell_temp-" + DoubleToStr(i,0));
         }
      }
   var_116 = 0;
   }
      else
   {
   if ((close <= Low[iLowest(NULL,0,MODE_LOW,var_116,shift + var_116)]) && (var_116 > 1))
      {
      if (var_116 >= inp_gtdmns_12)
         {
         for (i = 1; i <= var_116; i++)
            {
            ObjectDelete(ind_name+"DM-sell_temp-" + DoubleToStr(i,0));
            }
         }
      var_116 = 0;
      return(0);
      }
   }

if (Close[shift + inp_gtdmns_12 + 1] < close)
   {
   if ((var_116 == 0) && (Close[shift + inp_gtdmns_12 + 2] < Close[shift + 2])) return(0);
   var_116++;
   if (var_116 == inp_gtdmns_12)
      {
      for (i = var_116; i >= 1; i--)
         {
         //gt_move_text(0,"DM-sell_temp-",var_116 - i + 1,inp_gtdmns_4,DoubleToStr(var_116 - i + 1,0),10,"Verdana",Time[shift + i],High[shift + i] + 2 * inp_gtdmns_20);
         }
      }
   if (var_116 > inp_gtdmns_12)
      {
      var_gtdmns_36 = var_116 / 10;
      var_gtdmns_44 = var_116 - var_gtdmns_36 * 10;
      //gt_move_text(0,"DM-sell_temp-",var_116,inp_gtdmns_4,DoubleToStr(var_gtdmns_44,0),10,"Verdana",time,high + 2 * inp_gtdmns_20);
      }
   return(1);
   }

if (var_116 >= inp_gtdmns_12)
   {
   for (i = 1; i <= var_116; i++)
      {
      ObjectDelete(ind_name+"DM-sell_temp-" + DoubleToStr(i,0));
      }
   }

if (var_116 < inp_gtdmns_12 + 5)
   {
   var_116 = 0;
   return(0);
   }

var_gtdmns_36 = 1;
for (i = var_116; i >= 1; i--)
   {
   if (var_gtdmns_36 == 10) var_gtdmns_36 = 0;
   //gt_move_text(0,"DM-sell-" + DoubleToStr(var_116 - i + 1,0) + "-",var_120,inp_gtdmns_8,DoubleToStr(var_gtdmns_36,0),10,"Verdana",Time[shift + i + 1],High[shift + i + 1] + 2 * inp_gtdmns_20);
   var_gtdmns_36++;
   }

//ObjectDelete(ind_name+"DM-sell-begin-" + DoubleToStr(sarray[4],0));
//ObjectDelete(ind_name+"DM-buy-begin-" + DoubleToStr(barray[4],0));
//ObjectDelete(ind_name+"DM-sell-price-" + DoubleToStr(sarray[4],0));
//ObjectDelete(ind_name+"DM-buy-price-" + DoubleToStr(barray[4],0));

for (i = barray[3]; i > 0; i--)
   {
   //ObjectDelete(ind_name+"DM-xvost-buy-" + DoubleToStr(i,0) + DoubleToStr(barray[4],0));
   }

for (i = sarray[3]; i > 0; i--)
   {
   ObjectDelete(ind_name+"DM-xvost-sell-" + DoubleToStr(i,0) + DoubleToStr(sarray[4],0));
   }

sarray[0] = var_116;
sarray[1] = 0;
sarray[2] = 0;
sarray[3] = 0;
barray[0] = 0;
barray[1] = 0;
barray[2] = 0;
barray[3] = 0;
var_116 = 0;
var_120++;
return(2);
}

//+------------------------------------------------------------------+

int gt_d_wawe_sell(int& tarray[], double& parray[], int clr, int shift, double inp_gtdws_16, int inp_gtdws_24, int mode, bool inp_gtdws_32, bool inp_gtdws_36)
{
int    i;
int    var_gtdws_44;
int    var_gtdws_48;
int    var_gtdws_52;
double var_gtdws_64;
double var_gtdws_72;
double var_gtdws_80;
double var_gtdws_88;
double low;
double high;
double close;
int    time;

low = Low[shift + 1];
close = Close[shift + 1];
time = Time[shift + 1];
high = High[shift + 1];

while (var_184 == 1)
   {
   switch (mode)
      {
      case 0:
         var_188 = 0;
         var_gtdws_48 = MathCeil(inp_gtdws_24 * 0.618);
         i = MathMod(var_gtdws_48 - 1,2);
         if (i != 0) var_124 = var_gtdws_48 + 1; else var_124 = var_gtdws_48;
         var_gtdws_48 = MathCeil(var_124 * 0.618);
         i = MathMod(var_gtdws_48 - 1,2);
         if (i != 0) var_128 = var_gtdws_48 + 1; else var_128 = var_gtdws_48;
         var_132 = inp_gtdws_24;
         var_136 = var_124;
         var_gtdws_48 = MathCeil(inp_gtdws_24 * 1.618);
         i = MathMod(var_gtdws_48 - 1,2);
         if (i != 0) var_140 = var_gtdws_48 + 1; else var_140 = var_gtdws_48;
         var_144 = inp_gtdws_24;
         var_gtdws_48 = (inp_gtdws_24 - 1) / 2 + 1 + shift;
         var_gtdws_52 = iHighest(NULL,0,MODE_HIGH,inp_gtdws_24,shift);
         if (var_gtdws_52 == var_gtdws_48)
            {
            tarray[0] = Time[var_gtdws_52];
            parray[0] = High[var_gtdws_52];
            gt_move_simvol(0,"T-0 (sell)-",var_192,clr,139,2,tarray[0],parray[0] + inp_gtdws_16 * 6.0);
            return(1);
            }
         if (parray[0] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
         return(0);
         break;
      case 1:
         if ((close > parray[0]) || (var_188 == 1))
            {
            if (parray[1] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            var_188 = 1;
            mode = 0;
            break;
            }
         var_188 = 0;
         for (i = 2; i <= var_124 + 2; i++)
            {
            if (close > Low[shift + i]) break;
            }
         if (i <= var_124 + 2) return(1);
         if ((close < parray[1]) || (parray[1] == 0))
            {
            tarray[1] = time;
            parray[1] = low;
            gt_move_simvol(0,"T-1 (sell)-",var_192,clr,140,2,tarray[1],parray[1] - inp_gtdws_16 * 5.0);
            var_gtdws_80 = parray[0] - (parray[0] - low) * 0.5;
            gt_move_text(0,"Target-3 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_80,Digits),9,"Verdana",time,var_gtdws_80);
            var_gtdws_72 = parray[0] - (parray[0] - low) * 0.382;
            gt_move_text(0,"Target-2 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_72,Digits),9,"Verdana",time,var_gtdws_72);
            var_gtdws_64 = parray[0] - (parray[0] - low) * 0.236;
            gt_move_text(0,"Target-1 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_64,Digits),9,"Verdana",time,var_gtdws_64);
            return(2);
            }
         return(1);
         break;
      case 2:
         if ((close > parray[0]) || (var_188 == 1))
            {
            if (parray[2] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 1;
            var_188 = 1;
            break;
            }
         var_188 = 0;
         if ((close < parray[1]) && (parray[2] == 0))
            {
            if (parray[2] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 1;
            break;
            }
         if ((close < parray[1]) && (parray[2] != 0))
            {
            mode = 3;
            return(3);
            }
         for (i = 2; i <= var_128 + 2; i++)
            {
            if (close < Close[shift + i]) break;
            }
         if (i <= var_128 + 2) return(2);
         if (close > parray[2])
            {
            tarray[2] = time;
            parray[2] = high;
            gt_move_simvol(0,"T-2 (sell)-",var_192,clr,141,2,tarray[2],parray[2] + inp_gtdws_16 * 6.0);
            var_gtdws_64 = parray[0] - (parray[0] - parray[1]) * var_152;
            gt_move_text(0,"Target-1 T3-5 (sell)-",var_192,clr,"Target-1 T3-5 :" + DoubleToStr(var_gtdws_64,Digits),9,"Verdana",tarray[1],var_gtdws_64);
            var_gtdws_72 = parray[0] - (parray[0] - parray[1]) * var_160;
            gt_move_text(0,"Target-2 T3-5 (sell)-",var_192,clr,"Target-2 T3-5 :" + DoubleToStr(var_gtdws_72,Digits),9,"Verdana",tarray[1],var_gtdws_72);
            var_gtdws_80 = parray[0] - (parray[0] - parray[1]) * var_168;
            gt_move_text(0,"Target-3 T3-5 (sell)-",var_192,clr,"Target-3 T3-5 :" + DoubleToStr(var_gtdws_80,Digits),9,"Verdana",tarray[1],var_gtdws_80);
            var_gtdws_88 = parray[0] - (parray[0] - parray[1]) * var_176;
            gt_move_text(0,"Target-4 T3-5 (sell)-",var_192,clr,"Target-4 T3-5 :" + DoubleToStr(var_gtdws_88,Digits),9,"Verdana",tarray[1],var_gtdws_88);
            if (inp_gtdws_32)
               {
               gt_move_fibo_level(0,"MyFibo_sell-",0,clr,2,1,tarray[0],parray[0],tarray[2],var_gtdws_80,Red);
               }
            if (inp_gtdws_36)
               {
               gt_move_line_goriz(0,"Target_down_",3,clr,2,1,tarray[1],var_gtdws_80);
               gt_move_line_goriz(0,"Target_down_",4,clr,2,1,tarray[1],var_gtdws_88);
               }
            }
         return(2);
         break;
      case 3:
         if ((close > parray[0]) || (var_188 == 1))
            {
            if (parray[3] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 2;
            var_188 = 1;
            break;
            }
         var_188 = 0;
         if (close > parray[2])
            {
            if (parray[3] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 2;
            break;
            }
         if ((close > parray[3]) && (parray[3] != 0))
            {
            mode = 4;
            return(4);
            }
         for (i = 2; i <= var_132 + 2; i++)
            {
            if (close > Close[shift + i]) break;
            }
         if (i <= var_132 + 2) return(3);
         if ((close < parray[3]) || (parray[3] == 0))
            {
            tarray[3] = time;
            parray[3] = low;
            gt_move_simvol(0,"T-3 (sell)-",var_192,clr,142,2,tarray[3],parray[3] - inp_gtdws_16 * 5.0);
            return(4);
            }
         return(3);
         break;
      case 4:
         if ((close > parray[0]) || (var_188 == 1))
            {
            if (parray[4] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 3;
            var_188 = 1;
            break;
            }
         var_188 = 0;
         if (close < parray[3])
            {
            if (parray[4] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 3;
            break;
            }
         if ((close < parray[4]) && (parray[4] != 0))
            {
            mode = 5;
            return(5);
            }
         if (high >= parray[2])
            {
            if (parray[4] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 2;
            gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 3;
            gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            var_gtdws_44 = 0;
            i = 1;
            while (Time[shift + i] != tarray[0])
               {
               var_gtdws_44++;
               i++;
               }
            i = iLowest(NULL,0,MODE_LOW,var_gtdws_44,shift);
            tarray[1] = Time[i];
            parray[1] = Low[i];
            gt_move_simvol(0,"T-1 (sell)-",var_192,clr,140,2,tarray[1],parray[1] - inp_gtdws_16 * 5.0);
            var_gtdws_80 = parray[0] - (parray[0] - parray[1]) * 0.5;
            gt_move_text(0,"Target-3 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_80,Digits),9,"Verdana",tarray[1],var_gtdws_80);
            var_gtdws_72 = parray[0] - (parray[0] - parray[1]) * 0.382;
            gt_move_text(0,"Target-2 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_72,Digits),9,"Verdana",tarray[1],var_gtdws_72);
            var_gtdws_64 = parray[0] - (parray[0] - parray[1]) * 0.236;
            gt_move_text(0,"Target-1 T2 (sell)-",var_192,clr,"T2-" + DoubleToStr(var_gtdws_64,Digits),9,"Verdana",tarray[1],var_gtdws_64);
            mode = 2;
            break;
            }
         for (i = 2; i <= var_136 + 2; i++)
            {
            if (close < Close[shift + i]) break;
            }
         if (i <= var_136 + 2) return(4);
         if (close > parray[4])
            {
            tarray[4] = time;
            parray[4] = high;
            gt_move_simvol(0,"T-4 (sell)-",var_192,clr,143,2,tarray[4],parray[4] + inp_gtdws_16 * 6.0);
            return(5);
            }
         return(4);
         break;
      case 5:
         if ((close > parray[0]) || (var_188 == 1))
            {
            if (parray[5] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 4;
            var_188 = 1;
            break;
            }
         var_188 = 0;
         if (close > parray[4])
            {
            if (parray[5] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 4;
            break;
            }
         if ((close > parray[5]) && (parray[5] != 0))
            {
            mode = 6;
            break;
            }
         for (i = 2; i <= var_140 + 2; i++)
            {
            if (low > Low[shift + i]) break;
            }
         if (i <= var_140 + 2) return(5);
         if ((low < parray[5]) || (parray[5] == 0))
            {
            tarray[5] = time;
            parray[5] = low;
            gt_move_simvol(0,"T-5 (sell)-",var_192,clr,144,2,tarray[5],parray[5] - inp_gtdws_16 * 5.0);
            return(6);
            }
         return(5);
         break;
      case 6:
         if (close > parray[0])
            {
            if (parray[6] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 5;
            var_188 = 1;
            break;
            }
         var_188 = 0;
         if (close < parray[5])
            {
            if (parray[6] != 0.0) gt_d_wawe_sell_clear(mode,var_192,parray,inp_gtdws_32,inp_gtdws_36);
            mode = 5;
            break;
            }
         for (i = 2; i <= var_144 + 2; i++)
            {
            if (high < High[shift + i]) break;
            }
         if (i <= var_144 + 2) return(6);
         if ((high > parray[6]) || (parray[6] == 0))
            {
            tarray[6] = time;
            parray[6] = high;
            mode = 8;
            break;
            }
         return(6);
         break;
      case 8:
         for (i = 0; i <= 6; i++)
            {
            tarray[i] = 0;
            parray[i] = 0;
            }
         var_192++;
         return(0);
         break;
      default:
         //Comment("Ekspert : Неверно указан режим работы (Модуль волнового анализа SELL).");
         return(0);
      }
   }
   return(0);
}

//+------------------------------------------------------------------+

int gt_d_wawe_sell_clear(int mode, int inp_gtdwsc_4, double& array[], bool inp_gtdwsc_12, bool inp_gtdwsc_16)
{
switch (mode)
   {
   case 0:
      ObjectDelete(ind_name+"T-0 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      array[0] = 0;
      break;
   case 1:
      ObjectDelete(ind_name+"T-1 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-1 T2 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-2 T2 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-3 T2 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      array[1] = 0;
      break;
   case 2:
      ObjectDelete(ind_name+"T-2 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-1 T3-5 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-2 T3-5 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-3 T3-5 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      ObjectDelete(ind_name+"Target-4 T3-5 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      if (inp_gtdwsc_12)
         {
         ObjectDelete(ind_name+"MyFibo_sell-" + DoubleToStr(0,0));
         }
      if (inp_gtdwsc_16)
         {
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(3,0));
         ObjectDelete(ind_name+"Target_down_" + DoubleToStr(4,0));
         }
      array[2] = 0;
      break;
   case 3:
      ObjectDelete(ind_name+"T-3 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      array[3] = 0;
      break;
   case 4:
      ObjectDelete(ind_name+"T-4 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      array[4] = 0;
      break;
   case 5:
      ObjectDelete(ind_name+"T-5 (sell)-" + DoubleToStr(inp_gtdwsc_4,0));
      array[5] = 0;
      break;
   default:
      //Comment("Ekspert : Неверно указан режим работы (Модуль удаления меток волнового анализа SELL).");
      return(0);
   }
   return(0);
}

//+------------------------------------------------------------------+

int gt_d_wawe_buy(int& tarray[], double& parray[], int clr, int shift, double inp_gtdwb_16, int inp_gtdwb_24, int mode, bool inp_gtdwb_32, bool inp_gtdwb_36)
{
int    i;
int    var_gtdwb_44;
int    var_gtdwb_48;
int    var_gtdwb_52;
double var_gtdwb_64;
double var_gtdwb_72;
double var_gtdwb_80;
double var_gtdwb_88;
double low;
double high;
double close;
int    time;

low = Low[shift + 1];
close = Close[shift + 1];
time = Time[shift + 1];
high = High[shift + 1];

while (var_256 == 1)
   {
   switch (mode)
      {
      case 0:
         var_260 = 0;
         var_gtdwb_48 = MathCeil(inp_gtdwb_24 * 0.618);
         i = MathMod(var_gtdwb_48 - 1,2);
         if (i != 0) var_196 = var_gtdwb_48 + 1; else var_196 = var_gtdwb_48;
         var_gtdwb_48 = MathCeil(var_196 * 0.618);
         i = MathMod(var_gtdwb_48 - 1,2);
         if (i != 0) var_200 = var_gtdwb_48 + 1; else var_200 = var_gtdwb_48;
         var_204 = inp_gtdwb_24;
         var_208 = var_196;
         var_gtdwb_48 = MathCeil(inp_gtdwb_24 * 1.618);
         i = MathMod(var_gtdwb_48 - 1,2);
         if (i != 0) var_212 = var_gtdwb_48 + 1; else var_212 = var_gtdwb_48;
         var_216 = inp_gtdwb_24;
         var_gtdwb_48 = (inp_gtdwb_24 - 1) / 2 + 1 + shift;
         var_gtdwb_52 = iLowest(NULL,0,MODE_LOW,inp_gtdwb_24,shift);
         if (var_gtdwb_52 == var_gtdwb_48)
            {
            tarray[0] = Time[var_gtdwb_52];
            parray[0] = Low[var_gtdwb_52];
            gt_move_simvol(0,"T-0 (buy)-",var_264,clr,139,2,tarray[0],parray[0] - 2 * inp_gtdwb_16);
            return(1);
            }
         if (parray[0] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
         return(0);
      case 1:
         if ((close < parray[0]) || (var_260 == 1))
            {
            if (parray[1] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            var_260 = 1;
            mode = 0;
            break;
            }
         var_260 = 0;
         for (i = 2; i <= var_196 + 2; i++)
            {
            if (close < High[shift + i]) break;
            }
         if (i <= var_196 + 2) return(1);
         if (close > parray[1])
            {
            tarray[1] = time;
            parray[1] = high;
            gt_move_simvol(0,"T-1 (buy)-",var_264,clr,140,2,tarray[1],parray[1] + 3 * inp_gtdwb_16);
            var_gtdwb_80 = parray[0] - (parray[0] - low) * 0.5;
            gt_move_text(0,"Target-3 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_80,Digits),9,"Verdana",time,var_gtdwb_80);
            var_gtdwb_72 = parray[0] - (parray[0] - low) * 0.382;
            gt_move_text(0,"Target-2 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_72,Digits),9,"Verdana",time,var_gtdwb_72);
            var_gtdwb_64 = parray[0] - (parray[0] - low) * 0.236;
            gt_move_text(0,"Target-1 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_64,Digits),9,"Verdana",time,var_gtdwb_64);
            return(2);
            }
         return(1);
      case 2:
         if ((close < parray[0]) || (var_260 == 1))
            {
            if (parray[2] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 1;
            var_260 = 1;
            break;
            }
         var_260 = 0;
         if ((close > parray[1]) && (parray[2] == 0))
            {
            if (parray[2] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 1;
            break;
            }
         if ((close > parray[1]) && (parray[2] != 0))
            {
            mode = 3;
            return(3);
            }
         for (i = 2; i <= var_200 + 2; i++)
            {
            if (close > Close[shift + i]) break;
            }
         if (i <= var_200 + 2) return(2);
         if ((close < parray[2]) || (parray[2] == 0))
            {
            tarray[2] = time;
            parray[2] = low;
            gt_move_simvol(0,"T-2 (buy)-",var_264,clr,141,2,tarray[2],parray[2] - 2 * inp_gtdwb_16);
            var_gtdwb_64 = parray[0] - (parray[0] - parray[1]) * var_224;
            gt_move_text(0,"Target-1 T3-5 (buy)-",var_264,clr,"Target-1 T3-5 :" + DoubleToStr(var_gtdwb_64,Digits),9,"Verdana",tarray[1],var_gtdwb_64);
            var_gtdwb_72 = parray[0] - (parray[0] - parray[1]) * var_232;
            gt_move_text(0,"Target-2 T3-5 (buy)-",var_264,clr,"Target-2 T3-5 :" + DoubleToStr(var_gtdwb_72,Digits),9,"Verdana",tarray[1],var_gtdwb_72);
            var_gtdwb_80 = parray[0] - (parray[0] - parray[1]) * var_240;
            gt_move_text(0,"Target-3 T3-5 (buy)-",var_264,clr,"Target-3 T3-5 :" + DoubleToStr(var_gtdwb_80,Digits),9,"Verdana",tarray[1],var_gtdwb_80);
            var_gtdwb_88 = parray[0] - (parray[0] - parray[1]) * var_248;
            gt_move_text(0,"Target-4 T3-5 (buy)-",var_264,clr,"Target-4 T3-5 :" + DoubleToStr(var_gtdwb_88,Digits),9,"Verdana",tarray[1],var_gtdwb_88);
            if (inp_gtdwb_32)
               {
               gt_move_fibo_level(0,"MyFibo_buy-",0,clr,2,1,tarray[0],parray[0],tarray[2],var_gtdwb_80,Lime);
               }
            if (inp_gtdwb_36)
               {
               gt_move_line_goriz(0,"Target_up_",3,clr,2,1,tarray[1],var_gtdwb_80);
               gt_move_line_goriz(0,"Target_up_",4,clr,2,1,tarray[1],var_gtdwb_88);
               }
            }
         return(2);
      case 3:
         if ((close < parray[0]) || (var_260 == 1))
            {
            if (parray[3] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 2;
            var_260 = 1;
            break;
            }
         var_260 = 0;
         if (close < parray[2])
            {
            if (parray[3] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 2;
            break;
            }
         if ((close < parray[3]) && (parray[3] != 0))
            {
            mode = 4;
            return(4);
            }
         for (i = 2; i <= var_204 + 2; i++)
            {
            if (close < Close[shift + i]) break;
            }
         if (i <= var_204 + 2) return(3);
         if (close > parray[3])
            {
            tarray[3] = time;
            parray[3] = high;
            gt_move_simvol(0,"T-3 (buy)-",var_264,clr,142,2,tarray[3],parray[3] + 3 * inp_gtdwb_16);
            return(4);
            }
         return(3);
      case 4:
         if ((close < parray[0]) || (var_260 == 1))
            {
            if (parray[4] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 3;
            var_260 = 1;
            break;
            }
         var_260 = 0;
         if (close > parray[3])
            {
            if (parray[4] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 3;
            break;
            }
         if ((close > parray[4]) && (parray[4] != 0))
            {
            mode = 5;
            return(5);
            }
         if (low <= parray[2])
            {
            if (parray[4] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 2;
            gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 3;
            gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            var_gtdwb_44 = 0;
            i = 1;
            while (Time[shift + i] != tarray[0])
               {
               var_gtdwb_44++;
               i++;
               }
            i = iHighest(NULL,0,MODE_HIGH,var_gtdwb_44,shift);
            tarray[1] = Time[i];
            parray[1] = High[i];
            gt_move_simvol(0,"T-1 (buy)-",var_264,clr,140,2,tarray[1],parray[1] + 3 * inp_gtdwb_16);
            var_gtdwb_80 = parray[0] - (parray[0] - parray[1]) * 0.5;
            gt_move_text(0,"Target-3 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_80,Digits),9,"Verdana",tarray[1],var_gtdwb_80);
            var_gtdwb_72 = parray[0] - (parray[0] - parray[1]) * 0.382;
            gt_move_text(0,"Target-2 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_72,Digits),9,"Verdana",tarray[1],var_gtdwb_72);
            var_gtdwb_64 = parray[0] - (parray[0] - parray[1]) * 0.236;
            gt_move_text(0,"Target-1 T2 (buy)-",var_264,clr,"T2-" + DoubleToStr(var_gtdwb_64,Digits),9,"Verdana",tarray[1],var_gtdwb_64);
            mode = 2;
            break;
            }
         for (i = 2; i <= var_208 + 2; i++)
            {
            if (close > Close[shift + i]) break;
            }
         if (i <= var_208 + 2) return(4);
         if ((close < parray[4]) || (parray[4] == 0))
            {
            tarray[4] = time;
            parray[4] = low;
            gt_move_simvol(0,"T-4 (buy)-",var_264,clr,143,2,tarray[4],parray[4] - 2 * inp_gtdwb_16);
            return(5);
            }
         return(4);
      case 5:
         if ((close < parray[0]) || (var_260 == 1))
            {
            if (parray[5] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 4;
            var_260 = 1;
            break;
            }
         var_260 = 0;
         if (close < parray[4])
            {
            if (parray[5] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 4;
            break;
            }
         if ((close < parray[5]) && (parray[5] != 0))
            {
            mode = 6;
            break;
            }
         for (i = 2; i <= var_212 + 2; i++)
            {
            if (high < High[shift + i]) break;
            }
         if (i <= var_212 + 2) return(5);
         if (high > parray[5])
            {
            tarray[5] = time;
            parray[5] = high;
            gt_move_simvol(0,"T-5 (buy)-",var_264,clr,144,2,tarray[5],parray[5] + 3 * inp_gtdwb_16);
            return(6);
            }
         return(5);
      case 6:
         if (close < parray[0])
            {
            if (parray[6] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 5;
            var_260 = 1;
            break;
            }
         var_260 = 0;
         if (close > parray[5])
            {
            if (parray[6] != 0.0) gt_d_wawe_buy_clear(mode,var_264,parray,inp_gtdwb_32,inp_gtdwb_36);
            mode = 5;
            break;
            }
         for (i = 2; i <= var_216 + 2; i++)
            {
            if (low > Low[shift + i]) break;
            }
         if (i <= var_216 + 2) return(6);
         if ((low < parray[6]) || (parray[6] == 0))
            {
            tarray[6] = time;
            parray[6] = low;
            mode = 8;
            break;
            }
         return(6);
      case 8:
         for (i = 0; i <= 6; i++)
            {
            tarray[i] = 0;
            parray[i] = 0;
            }
         var_264++;
         return(0);
      default:
         //Comment("Ekspert : Неверно указан режим работы (Модуль волнового анализа buy).");
         return(0);
      }
   }
   return(0);
}

//+------------------------------------------------------------------+

int gt_d_wawe_buy_clear(int mode, int inp_gtdwbc_4, double& arr_gtdwbc_8[], bool inp_gtdwbc_12, bool inp_gtdwbc_16)
{
switch (mode)
   {
   case 0:
      ObjectDelete(ind_name+"T-0 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      arr_gtdwbc_8[0] = 0;
      break;
   case 1:
      ObjectDelete(ind_name+"T-1 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-1 T2 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-2 T2 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-3 T2 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      arr_gtdwbc_8[1] = 0;
      break;
   case 2:
      ObjectDelete(ind_name+"T-2 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-1 T3-5 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-2 T3-5 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-3 T3-5 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      ObjectDelete(ind_name+"Target-4 T3-5 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      if (inp_gtdwbc_12)
         {
         ObjectDelete(ind_name+"MyFibo_buy-" + DoubleToStr(0,0));
         }
      if (inp_gtdwbc_16)
         {
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(3,0));
         ObjectDelete(ind_name+"Target_up_" + DoubleToStr(4,0));
         }
      arr_gtdwbc_8[2] = 0;
      break;
   case 3:
      ObjectDelete(ind_name+"T-3 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      arr_gtdwbc_8[3] = 0;
      break;
   case 4:
      ObjectDelete(ind_name+"T-4 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      arr_gtdwbc_8[4] = 0;
      break;
   case 5:
      ObjectDelete(ind_name+"T-5 (buy)-" + DoubleToStr(inp_gtdwbc_4,0));
      arr_gtdwbc_8[5] = 0;
      break;
   default:
      //Comment("Ekspert : Неверно указан режим работы (Модуль удаления меток волнового анализа buy).");
      return(0);
   }
   return(0);
}

//+------------------------------------------------------------------+

/*int gt_d_wawe_open(int inp_gtdwo_0, int inp_gtdwo_4, int inp_gtdwo_8, int inp_gtdwo_12, int inp_gtdwo_16, int inp_gtdwo_20, int inp_gtdwo_24, int inp_gtdwo_28, int inp_gtdwo_32, int inp_gtdwo_36, int inp_gtdwo_40, int inp_gtdwo_44)
{
double var_gtdwo_48;
return(0);
}*/

//+------------------------------------------------------------------+

int gt_sektor_clear_up(int i)
{
/*ObjectDelete(ind_name+"Sek_up_0-1-2_" + DoubleToStr(i,0));
ObjectDelete(ind_name+"Prc_up1_" + DoubleToStr(i,0));
ObjectDelete(ind_name+"Prc_up2_" + DoubleToStr(i,0));
ObjectDelete(ind_name+"Prc_up3_" + DoubleToStr(i,0));

ObjectDelete(ind_name+"Trend_up_2_" + DoubleToStr(i,0));
ObjectDelete(ind_name+"Trend_up_3_" + DoubleToStr(i,0));
*/
ObjectDelete(ind_name+"Trend_up_" + DoubleToStr(i,0));
return(0);
}

//+------------------------------------------------------------------+

int gt_sektor_clear_down(int i)
{
/*ObjectDelete(ind_name+"Sek_down_0-1-2_" + DoubleToStr(i,0));
ObjectDelete(ind_name+"Prc_dwn1_        

Recommend