/*
   Generated by EX4-TO-MQ4 decompiler V4.0.224.1 []
   Website: http://purebeam.biz
   E-mail : purebeam@gmail.com
*/
#property copyright "Forte928"
#property link      "http://www.metaquotes.net/"

#import "FileMappingMT4.dll"
   int FileMapCreate(int a0, string a1, int a2);
   int FileMapOpen(string a0);
   bool FileMapCloseName(string a0);
   int FileMapWriteDoubleArray(string a0, int a1, double& a2[], int a3);
#import "user32.dll"
   int PostMessageA(int a0, int a1, int a2, int a3);
#import

extern int AutoFrame = 0;
extern int DayBackFast = -1;
extern int DayBackSlow = -1;
extern int DayBackHigh = -1;
extern int CAPeriod = 5;
extern int MAAlpha = 1;
extern int MAPrice = 0;
extern int MAType = 1;
extern bool CAType = FALSE;
extern int StartPeriod = 10;
extern int StopPeriod = 175;
extern int StepPeriod = 5;
extern bool Alerted = TRUE;
extern bool VisualOrder = FALSE;
extern bool SingleOpen = FALSE;
extern int CountOpen = 25;
extern double FirstLot = 0.3;
extern double Lots = 0.1;
extern double MaximumRisk = 0.3;
extern double DecreaseFactor = 3.0;
extern int TakeProfit_1 = 0;
extern int TakeProfit_2 = 0;
extern int TakeProfit_3 = 0;
extern int StopLoss_1 = 35;
extern int StopLoss_2 = -2;
extern int StopLoss_3 = -10;
extern int VisualCount = 1000;
extern int Counter = 1000;
int g_slippage_204 = 3;
int gi_208 = 15128749;
int gi_212 = 8421616;
int gi_unused_216 = 16776960;
int gi_unused_220 = 4678655;
int g_color_224 = Blue;
int g_color_228 = Red;
double gd_unused_232 = 0.0;
int gi_unused_240 = 0;
int gi_244 = 0;
int g_timeframe_248 = 0;
int gi_252 = 0;
int gi_256 = 0;
int gi_260 = 0;
int gi_264 = 0;
int gi_unused_268 = 0;
int gi_unused_272 = 0;
int gia_276[5] = {0, 0, 0, 0, 0};
int gia_280[5] = {0, 0, 0, 0, 0};
int gia_284[5] = {0, 0, 0, 0, 0};
int gi_288 = 0;
int g_count_292 = 0;
double gd_unused_296 = 7.0;
string gs_signal_304 = "Signal";
string gs_unused_312 = "Peding";
string gs_balance_320 = "Balance";
string gs_unused_328 = "fmBalance";
int gia_336[5] = {0, 20, 10, 20, 12};
int gia_340[5] = {0, 140, 10, 20, 12};
int gia_344[5] = {1, 10, 25, 20, 12};
string gs_orders_348 = "Orders";
int gia_356[5] = {0, 10, 30, 20, 12};
double gda_360[];
double gda_364[];
double gda_368[];
double gda_372[];
int g_datetime_376 = 0;
int g_datetime_380 = 0;
double gda_384[13] = {3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987};
double gda_388[];
double gda_392[];
double gda_396[];
double gda_unused_400[];
double gda_404[];
double gda_408[];
double gda_412[];
double gda_unused_416[];
int gia_420[];
int gia_424[];
int gia_428[];
int gia_432[];
double gda_436[];
double gda_440[];
double gda_444[];
double gda_448[];
double gda_452[];
double gda_456[];
double gda_460[];
double gda_464[];
int gi_unused_468 = 0;
int gi_472 = 0;
double gda_476[];
double gda_480[];
double gda_484[];
double gda_488[];
double gda_492[];
double gda_496[];
double gda_500[];
double gda_504[];
double gda_508[];
double gda_512[];
double gda_516[];
string gsa_unused_520[];
int gia_unused_524[];
bool gba_unused_528[];
int gia_unused_532[];
int gi_unused_536 = 0;
string g_symbol_540 = "";
int gi_unused_548 = 0;
string gsa_552[12] = {"M1", "M5", "M15", "M30", "H1", "H4", "D1", "W1", "MN1", "MN4", "MN8", "Y1"};
int gia_556[12] = {1, 5, 15, 30, 60, 240, 1440, 10080, 43200, 172800, 345600, 518400};
bool gba_560[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0};
bool gba_564[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0};
int gia_unused_568[12];
double gda_572[12] = {0.15, 0.3, 0.6, 1.0, 2.0, 4.0, 10.0, 20.0, 50.0, 100.0, 250.0, 500.0};
double gda_576[12] = {0, 0, 0, 0, 0, 0, 0, 3, 12, 48, 96, 144};
double gda_580[12] = {0, 3, 18, 64, 0, 0, 0, 0, 0, 0, 0, 0};

void InitBufferam(int ai_0) {
   ArrayResize(gda_392, ai_0);
   ArrayResize(gda_388, ai_0);
   ArrayResize(gda_396, ai_0);
   ArrayResize(gda_404, ai_0);
   ArrayResize(gda_408, ai_0);
   ArrayResize(gda_412, ai_0);
   ArrayResize(gia_420, ai_0);
   ArrayResize(gia_424, ai_0);
   ArrayResize(gia_428, ai_0);
   ArrayResize(gia_432, ai_0);
   ArrayResize(gda_436, ai_0);
   ArrayResize(gda_440, ai_0);
   ArrayResize(gda_444, ai_0);
   ArrayResize(gda_448, ai_0);
   ArrayResize(gda_452, ai_0);
   ArrayResize(gda_456, ai_0);
   ArrayResize(gda_460, ai_0);
   ArrayResize(gda_464, ai_0);
}

void InitTempBuf(int ai_0, int ai_4) {
   if (ai_4 > 6) ai_4 = 6;
   if (ai_4 <= 0) ai_4 = 1;
   gi_unused_468 = ai_4;
   if (ai_0 > 0 && ai_4 > 0) {
      gi_472 = ai_0;
      ArrayResize(gda_476, gi_472);
      ArrayResize(gda_480, gi_472);
      ArrayResize(gda_484, gi_472);
      ArrayResize(gda_488, gi_472);
      ArrayResize(gda_492, gi_472);
      ArrayResize(gda_496, gi_472);
      if (ai_4 >= 1) ArrayResize(gda_500, gi_472);
      if (ai_4 >= 2) ArrayResize(gda_504, gi_472);
      if (ai_4 >= 3) ArrayResize(gda_508, gi_472);
      if (ai_4 >= 4) ArrayResize(gda_512, gi_472);
      if (ai_4 < 5) return;
      ArrayResize(gda_516, gi_472);
      return;
   }
   gi_472 = 0;
}

int TimeFrameShift(int ai_0, int ai_4) {
   int li_ret_8 = ai_0;
   while (ai_4 != 0) {
      switch (li_ret_8) {
      case 1:
         if (ai_4 > 0) li_ret_8 = 5;
         else li_ret_8 = 1;
         break;
      case 5:
         if (ai_4 > 0) li_ret_8 = 15;
         else li_ret_8 = 1;
         break;
      case 15:
         if (ai_4 > 0) li_ret_8 = 30;
         else li_ret_8 = 5;
         break;
      case 30:
         if (ai_4 > 0) li_ret_8 = 60;
         else li_ret_8 = 15;
         break;
      case 60:
         if (ai_4 > 0) li_ret_8 = 240;
         else li_ret_8 = 30;
         break;
      case 240:
         if (ai_4 > 0) li_ret_8 = 1440;
         else li_ret_8 = 60;
         break;
      case 1440:
         if (ai_4 > 0) li_ret_8 = 10080;
         else li_ret_8 = 240;
         break;
      case 10080:
         if (ai_4 > 0) li_ret_8 = 43200;
         else li_ret_8 = 1440;
         break;
      case 43200:
         if (ai_4 > 0) li_ret_8 = 172800;
         else li_ret_8 = 10080;
         break;
      case 172800:
         if (ai_4 > 0) li_ret_8 = 345600;
         else li_ret_8 = 43200;
         break;
      case 345600:
         if (ai_4 > 0) li_ret_8 = 518400;
         else li_ret_8 = 345600;
         break;
      case 518400:
         if (ai_4 > 0) li_ret_8 = 518400;
         else li_ret_8 = 345600;
      }
      if (ai_4 > 0) ai_4--;
      else ai_4++;
   }
   return (li_ret_8);
}

string TimeFrameToString(int ai_0) {
   string ls_ret_4;
   switch (ai_0) {
   case 1:
      ls_ret_4 = "M1";
      break;
   case 5:
      ls_ret_4 = "M5";
      break;
   case 15:
      ls_ret_4 = "M15";
      break;
   case 30:
      ls_ret_4 = "M30";
      break;
   case 60:
      ls_ret_4 = "H1";
      break;
   case 240:
      ls_ret_4 = "H4";
      break;
   case 1440:
      ls_ret_4 = "D1";
      break;
   case 10080:
      ls_ret_4 = "W1";
      break;
   case 43200:
      ls_ret_4 = "MN1";
      break;
   case 172800:
      ls_ret_4 = "MN4";
      break;
   case 345600:
      ls_ret_4 = "MN8";
      break;
   case 518400:
      ls_ret_4 = "Y1";
      break;
   default:
      ls_ret_4 = "--";
   }
   return (ls_ret_4);
}

int TimeFrameToIndex(int ai_0) {
   switch (ai_0) {
   case 1:
      return (0);
   case 5:
      return (1);
   case 15:
      return (2);
   case 30:
      return (3);
   case 60:
      return (4);
   case 240:
      return (5);
   case 1440:
      return (6);
   case 10080:
      return (7);
   case 43200:
      return (8);
   case 172800:
      return (9);
   case 345600:
      return (10);
   case 518400:
      return (11);
   }
   return (-1);
}

void CopySeriesCount(double &ada_0[], int a_timeframe_4, int ai_8, int ai_12, int ai_16) {
   for (int l_index_20 = 0; l_index_20 < ai_16; l_index_20++) {
      switch (ai_8) {
      case 0:
         ada_0[l_index_20] = iOpen(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 1:
         ada_0[l_index_20] = iLow(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 2:
         ada_0[l_index_20] = iHigh(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 3:
         ada_0[l_index_20] = iClose(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 4:
         ada_0[l_index_20] = iVolume(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 5:
         ada_0[l_index_20] = iTime(NULL, a_timeframe_4, l_index_20 + ai_12);
         break;
      case 6:
         ada_0[l_index_20] = (iHigh(NULL, a_timeframe_4, l_index_20 + ai_12) + iLow(NULL, a_timeframe_4, l_index_20 + ai_12)) / 2.0;
         break;
      case 7:
         ada_0[l_index_20] = (iHigh(NULL, a_timeframe_4, l_index_20 + ai_12) + iLow(NULL, a_timeframe_4, l_index_20 + ai_12) + iClose(NULL, a_timeframe_4, l_index_20 + ai_12)) / 3.0;
         break;
      case 8:
         ada_0[l_index_20] = (iHigh(NULL, a_timeframe_4, l_index_20 + ai_12) + iLow(NULL, a_timeframe_4, l_index_20 + ai_12) + iOpen(NULL, a_timeframe_4, l_index_20 + ai_12) +
            iClose(NULL, a_timeframe_4, l_index_20 + ai_12)) / 4.0;
      }
   }
}

void MAOnArray(double ada_0[], double ada_4[], int ai_8, int ai_12, int ai_16) {
   if (ai_8 < 5 && ai_8 >= 0) {
      switch (ai_8) {
      case 0:
         SMAOnArray(ada_0, ada_4, ai_12, ai_16);
         return;
      case 1:
         EMAOnArray(ada_0, ada_4, ai_12, ai_16);
         return;
      case 2:
         LWMAOnArray(ada_0, ada_4, ai_12, ai_16);
         return;
      case 3:
         SqrWMAOnArray(ada_0, ada_4, ai_12, ai_16);
         return;
      case 4:
         SineWMAOnArray(ada_0, ada_4, ai_12, ai_16);
         return;
      }
   }
   HMAOnArray(ada_0, ada_4, ai_8, ai_12, ai_16);
}

void SMAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   double ld_20;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   for (int li_16 = ai_12 - 1 - ai_8; li_16 >= 0; li_16--) {
      ld_20 = 0;
      for (int li_28 = ai_8 - 1; li_28 >= 0; li_28--) ld_20 += ada_0[li_16 + li_28];
      ada_4[li_16] = ld_20 / ai_8;
   }
}

void EMAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   ArrayInitialize(ada_4, EMPTY_VALUE);
   double ld_16 = 2 / (1.0 * ai_8 + 1.0);
   ada_4[ai_12 - 1] = 0;
   for (int li_24 = ai_12 - 2; li_24 >= 0; li_24--) ada_4[li_24] = ada_4[li_24 + 1] + ld_16 * (ada_0[li_24] - (ada_4[li_24 + 1]));
}

void LWMAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   double ld_20;
   double ld_28;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   for (int li_16 = ai_12 - 1 - ai_8; li_16 >= 0; li_16--) {
      ld_20 = 0;
      ld_28 = 0;
      for (int l_count_36 = 0; l_count_36 < ai_8; l_count_36++) {
         ld_28 += ai_8 - l_count_36;
         ld_20 += (ada_0[li_16 + l_count_36]) * (ai_8 - l_count_36);
      }
      if (ld_28 > 0.0) ada_4[li_16] = ld_20 / ld_28;
      else ada_4[li_16] = 0;
   }
}

void SqrWMAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   double ld_20;
   double ld_28;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   for (int li_16 = ai_12 - 1 - ai_8; li_16 >= 0; li_16--) {
      ld_20 = 0;
      ld_28 = 0;
      for (int l_count_36 = 0; l_count_36 < ai_8; l_count_36++) {
         ld_28 += ai_8 - l_count_36;
         ld_20 += (ada_0[li_16 + l_count_36]) * (ada_0[li_16 + l_count_36]) * (ai_8 - l_count_36);
      }
      if (ld_28 > 0.0) ada_4[li_16] = MathSqrt(ld_20 / ld_28);
      else ada_4[li_16] = 0;
   }
}

void SineWMAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   double ld_20;
   double ld_28;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   for (int li_16 = ai_12 - 1; li_16 >= 0; li_16--) {
      ld_20 = 0;
      ld_28 = 0;
      for (int l_count_36 = 0; l_count_36 < ai_8; l_count_36++) {
         ld_28 += MathSin(3.1415926536 * (l_count_36 + 1) / (ai_8 + 1));
         ld_20 += (ada_0[li_16 + l_count_36]) * MathSin(3.1415926536 * (l_count_36 + 1) / (ai_8 + 1));
      }
      if (ld_28 > 0.0) ada_4[li_16] = ld_20 / ld_28;
      else ada_4[li_16] = 0;
   }
}

void HMAOnArray(double ada_0[], double ada_4[], int ai_8, int ai_12, int ai_16) {
   int li_20 = MathMod(ai_8, 5);
   ArrayInitialize(ada_4, EMPTY_VALUE);
   MAOnArray(ada_0, gda_476, li_20, MathFloor(ai_12 / 2), ai_16);
   MAOnArray(ada_0, gda_480, li_20, ai_12, ai_16);
   for (int li_24 = ai_16 - 1; li_24 >= 0; li_24--) gda_476[li_24] = 2.0 * gda_476[li_24] - gda_480[li_24];
   MAOnArray(gda_476, ada_4, li_20, MathFloor(MathSqrt(ai_12)), ai_16);
}

void HPFilter(double ada_0[], double &ada_4[], int ai_8, int ai_12) {
   double lda_16[];
   double lda_20[];
   double lda_24[];
   double ld_28;
   double ld_36;
   double ld_44;
   double ld_52;
   double ld_60;
   double ld_68;
   double ld_76;
   double ld_84;
   double ld_100;
   double ld_108;
   double ld_116;
   double ld_124;
   ArrayResize(lda_16, ai_12);
   ArrayResize(lda_20, ai_12);
   ArrayResize(lda_24, ai_12);
   lda_16[0] = ai_8 + 1.0;
   lda_20[0] = -2.0 * ai_8;
   lda_24[0] = ai_8;
   for (int l_index_132 = 1; l_index_132 < ai_12 - 2; l_index_132++) {
      lda_16[l_index_132] = 6.0 * ai_8 + 1.0;
      lda_20[l_index_132] = -4.0 * ai_8;
      lda_24[l_index_132] = ai_8;
   }
   lda_16[1] = 5.0 * ai_8 + 1.0;
   lda_16[ai_12 - 1] = ai_8 + 1.0;
   lda_16[ai_12 - 2] = 5.0 * ai_8 + 1.0;
   lda_20[ai_12 - 2] = -2.0 * ai_8;
   lda_20[ai_12 - 1] = 0.0;
   lda_24[ai_12 - 2] = 0.0;
   lda_24[ai_12 - 1] = 0.0;
   for (l_index_132 = 0; l_index_132 < ai_12; l_index_132++) {
      ld_124 = lda_16[l_index_132] - ld_52 * ld_28 - ld_100 * ld_76;
      ld_108 = lda_20[l_index_132];
      ld_68 = ld_28;
      ld_28 = (ld_108 - ld_52 * ld_36) / ld_124;
      lda_20[l_index_132] = ld_28;
      ld_116 = lda_24[l_index_132];
      ld_76 = ld_36;
      ld_36 = ld_116 / ld_124;
      lda_24[l_index_132] = ld_36;
      lda_16[l_index_132] = (ada_0[l_index_132] - ld_84 * ld_100 - ld_44 * ld_52) / ld_124;
      ld_84 = ld_44;
      ld_44 = lda_16[l_index_132];
      ld_52 = ld_108 - ld_60 * ld_68;
      ld_100 = ld_60;
      ld_60 = ld_116;
   }
   ld_36 = 0;
   ld_28 = lda_16[ai_12 - 1];
   ada_4[ai_12 - 1] = ld_28;
   for (l_index_132 = ai_12 - 2; l_index_132 >= 0; l_index_132--) {
      ada_4[l_index_132] = lda_16[l_index_132] - lda_20[l_index_132] * ld_28 - lda_24[l_index_132] * ld_36;
      ld_36 = ld_28;
      ld_28 = ada_4[l_index_132];
   }
}

void StdDevOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12, int a_arr_size_16) {
   double ld_24;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   if (a_arr_size_16 == 0) a_arr_size_16 = ArraySize(ada_0);
   MAOnArray(ada_0, ada_4, ai_8, ai_12, a_arr_size_16);
   for (int l_index_20 = 0; l_index_20 < a_arr_size_16 - ai_12; l_index_20++) {
      ld_24 = 0;
      for (int l_count_32 = 0; l_count_32 < ai_12; l_count_32++) ld_24 += (ada_0[l_index_20 + l_count_32] - ada_4[l_index_20]) * (ada_0[l_index_20 + l_count_32] - ada_4[l_index_20]);
      ada_4[l_index_20] = MathSqrt(ld_24 / ai_12);
   }
}

void CAOnArray(double ada_0[], double &ada_4[], int ai_8, int ai_12, int ai_16) {
   double ld_20;
   double ld_28;
   double ld_36;
   MAOnArray(ada_0, gda_484, ai_8, ai_12, ai_16);
   StdDevOnArray(ada_0, gda_488, ai_8, ai_12, ai_16);
   ada_4[ai_16 - 1] = gda_484[ai_16 - 1];
   for (int li_44 = ai_16 - 1; li_44 >= 0; li_44--) {
      ld_20 = MathPow(gda_488[li_44], 2);
      ld_28 = MathPow(ada_4[li_44 + 1] - gda_484[li_44], 2);
      ld_36 = 0;
      if (ld_28 < ld_20 || ld_28 == 0.0) ld_36 = 0;
      else ld_36 = 1 - ld_20 / ld_28;
      ada_4[li_44] = ada_4[li_44 + 1] + ld_36 * (gda_484[li_44] - (ada_4[li_44 + 1]));
   }
}

int TimeHighStart(int ai_0, int ai_4) {
   int li_ret_8;
   int l_day_of_week_16;
   if (ai_4 >= 1440) li_ret_8 = 60.0 * (1440.0 * MathFloor(ai_0 / 1440 / 60));
   else li_ret_8 = 60.0 * (MathFloor(ai_0 / ai_4 / 60) * ai_4);
   switch (ai_4) {
   case 10080:
      l_day_of_week_16 = TimeDayOfWeek(li_ret_8);
      if (l_day_of_week_16 == 0) l_day_of_week_16 = 7;
      li_ret_8 -= 86400 * (l_day_of_week_16 - 1);
      break;
   case 43200:
      li_ret_8 -= 86400 * (TimeDay(ai_0) - 1);
      break;
   case 172800:
      li_ret_8 -= 86400 * (TimeDay(ai_0) - 1);
      li_ret_8 = li_ret_8 - 60.0 * (38880.0 * MathMod(TimeMonth(li_ret_8) - 1, 4));
      li_ret_8 -= 86400 * (TimeDay(li_ret_8) - 1);
      break;
   case 345600:
      li_ret_8 -= 86400 * (TimeDay(ai_0) - 1);
      li_ret_8 = li_ret_8 - 60.0 * (38880.0 * MathMod(TimeMonth(li_ret_8) - 1, 8));
      li_ret_8 -= 86400 * (TimeDay(li_ret_8) - 1);
   }
   return (li_ret_8);
}

int ConvertZeroActiveToHighFrame(double ada_0[], double &ada_4[], int a_timeframe_8, int ai_12, int ai_16, int ai_20) {
   if (a_timeframe_8 == ai_12) {
      ArrayCopy(ada_4, ada_0, 0, 0, ai_20);
      return (ai_20);
   }
   ArrayInitialize(ada_4, EMPTY_VALUE);
   bool li_24 = FALSE;
   int l_index_28 = 0;
   int li_32 = MathFloor(ai_12 / a_timeframe_8);
   if (li_32 == 0) return (l_index_28);
   double ld_36 = 0;
   if (ai_12 == 30) li_32 = (ai_12 - 15 * ai_16) / a_timeframe_8;
   if (ai_12 == 60) li_32 = (ai_12 - 30 * ai_16) / a_timeframe_8;
   if (ai_12 == 240) li_32 = (ai_12 - 60 * ai_16) / a_timeframe_8;
   if (ai_12 == 1440) li_32 = (ai_12 - 240 * ai_16) / a_timeframe_8;
   if (ai_12 == 10080) li_32 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   if (ai_12 == 43200) li_32 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   if (ai_12 >= 172800) li_32 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   int l_datetime_44 = iTime(NULL, a_timeframe_8, 0);
   int li_48 = TimeHighStart(l_datetime_44, ai_12);
   int l_count_52 = 0;
   int li_56 = li_32;
   double ld_60 = 0;
   for (int li_68 = 0; li_68 < ai_20; li_68++) {
      if (l_index_28 == 0) {
         l_datetime_44 = iTime(NULL, a_timeframe_8, li_68);
         if (li_48 > l_datetime_44) l_index_28++;
         else l_count_52++;
         ld_36 = 0;
      } else {
         li_24 = MathMod(li_68 - l_count_52, li_32);
         if (li_24 == FALSE) {
            ada_4[l_index_28] = ld_36 / li_32;
            ld_36 = 0;
            l_index_28++;
         }
      }
      ld_36 += ada_0[li_68];
      if (li_56 > 0) {
         ld_60 += ada_0[li_68];
         li_56--;
      }
   }
   ada_4[0] = ld_60 / li_32;
   return (l_index_28);
}

int ConvertZeroHighToActiveFrame(double ada_0[], double &ada_4[], int a_timeframe_8, int ai_12, int ai_16, int ai_20, int ai_24, int ai_28) {
   int li_unused_64;
   if (a_timeframe_8 == ai_12) {
      ArrayCopy(ada_4, ada_0, 0, 0, ai_28);
      return (ai_28);
   }
   ArrayInitialize(ada_4, EMPTY_VALUE);
   ArrayInitialize(gda_476, EMPTY_VALUE);
   bool li_32 = FALSE;
   int l_index_36 = 0;
   int li_40 = MathFloor(ai_12 / a_timeframe_8);
   int l_datetime_44 = iTime(NULL, a_timeframe_8, 0);
   int li_48 = TimeHighStart(l_datetime_44, ai_12);
   int l_count_52 = 0;
   if (li_40 == 0) return (l_index_36);
   if (ai_12 == 30) li_40 = (ai_12 - 15 * ai_16) / a_timeframe_8;
   if (ai_12 == 60) li_40 = (ai_12 - 30 * ai_16) / a_timeframe_8;
   if (ai_12 == 240) li_40 = (ai_12 - 60 * ai_16) / a_timeframe_8;
   if (ai_12 == 1440) li_40 = (ai_12 - 240 * ai_16) / a_timeframe_8;
   if (ai_12 == 10080) li_40 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   if (ai_12 == 43200) li_40 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   if (ai_12 >= 172800) li_40 = (ai_12 - 1440 * ai_16) / a_timeframe_8;
   int li_ret_56 = 0;
   for (int li_60 = 0; li_60 < ai_28; li_60++) {
      if (l_index_36 == 0) {
         l_datetime_44 = iTime(NULL, a_timeframe_8, li_60);
         if (li_48 > l_datetime_44) l_index_36++;
         else l_count_52++;
      }
      if (l_index_36 > 0) {
         li_32 = MathMod(li_60 - l_count_52, li_40);
         if (li_32 == FALSE) {
            if (l_index_36 >= ai_24) li_ret_56 = li_60;
            gda_476[li_60 - l_count_52 + li_40] = ada_0[l_index_36];
            l_index_36++;
         }
      }
   }
   gda_476[0] = ada_0[0];
   LinearKnot(gda_476, gda_480, ai_28);
   if (ai_20 == 1) {
      li_unused_64 = MathExp((TimeFrameToIndex(ai_12) - TimeFrameToIndex(a_timeframe_8)) * 2);
      ArrayCopy(ada_4, gda_480, 0, li_40 - l_count_52, li_ret_56);
   } else {
      ArrayCopy(ada_4, gda_476, 0, li_40 - l_count_52, li_ret_56);
      ada_4[0] = gda_480[li_40 - l_count_52];
   }
   return (li_ret_56);
}

void LinearKoeff(double ad_0, double ad_8, double ad_16, double ad_24, double &ad_32, double &ad_40) {
   ad_40 = (ad_24 - ad_16) / (ad_8 - ad_0);
   ad_32 = (ad_16 * ad_8 - ad_24 * ad_0) / (ad_8 - ad_0);
}

void LinearKnot(double ada_0[], double &ada_4[], int ai_8) {
   double ld_24;
   double ld_32;
   ArrayInitialize(ada_4, EMPTY_VALUE);
   int li_12 = -1;
   int li_16 = -1;
   for (int l_index_20 = 0; l_index_20 < ai_8; l_index_20++) {
      if (ada_0[l_index_20] != EMPTY_VALUE) {
         li_16 = li_12;
         li_12 = l_index_20;
         if (li_16 >= 0) {
            LinearKoeff(li_12, li_16, ada_0[li_12], ada_0[li_16], ld_24, ld_32);
            for (int li_40 = li_12; li_40 >= li_16; li_40--) ada_4[li_40] = ld_24 + li_40 * ld_32;
         }
      }
   }
}

int CalculateTradeSignal(string as_0 = "") {
   if (as_0 == "") as_0 = Symbol();
   CopySeriesCount(gda_396, g_timeframe_248, MAPrice, 0, gi_244);
   CalcTSIRankFrame(gda_396, gda_436, g_timeframe_248, gi_252, gi_264, MAAlpha, MAType, CAType, gi_244);
   DrawLineSignal(0, gda_436, gi_244);
   if (gia_276[0] != NormalizeDouble(gda_436[0], 0)) {
      if (gda_436[0] == gda_436[0] && gda_436[0] == gda_436[0]) {
         gia_276[0] = gda_436[0];
         gia_280[0] = 1;
      }
   }
   CaptionSignal(0, gia_276[0]);
   CaptionPeding(0, gia_280[0]);
   if (gia_276[1] != NormalizeDouble(gda_440[0], 0)) {
      if (gda_440[0] == gda_440[0] && gda_440[0] == gda_440[0]) {
         gia_276[1] = gda_440[0];
         gia_280[1] = 1;
      }
   }
   if (gia_276[2] != NormalizeDouble(gda_444[0], 0)) {
      if (gda_444[0] == gda_444[0] && gda_444[0] == gda_444[0]) {
         gia_276[2] = gda_444[0];
         gia_280[2] = 1;
      }
   }
   return (0);
}

void CalcTSIRankFrame(double ada_0[], double &ada_4[], int ai_8, int ai_12, int ai_16, int ai_20, int ai_24, int ai_28, int ai_32) {
   int li_44;
   ArrayInitialize(ada_4, 0.0);
   int li_unused_36 = 0;
   int li_40 = ConvertZeroActiveToHighFrame(ada_0, gda_404, ai_8, ai_12, ai_16, ai_32);
   if (li_40 <= 30) {
      if (Alerted == TRUE) {
         Alert("недостаточно данных для расчета ", TimeFrameToString(ai_12), "(", li_40, ") на ", TimeFrameToString(ai_8));
         Alert(Symbol(), ",", TimeFrameToString(ai_8), "  ", "gexHighWay");
      }
   } else {
      li_44 = MathExp((TimeFrameToIndex(ai_12) - TimeFrameToIndex(ai_8)) * 2);
      CAOnArray(gda_404, ada_4, 7, CAPeriod, li_40);
      HPFilter(ada_4, gda_492, ai_20, li_40);
      TSIOnArray(gda_404, gda_496, g_symbol_540, ai_24, ai_28, StartPeriod, StopPeriod, StepPeriod, li_40);
      li_40 -= 25;
      ConvertZeroHighToActiveFrame(gda_496, gda_484, ai_8, ai_12, ai_16, 1, li_40, ai_32);
      HPFilter(gda_484, gda_476, li_44, ai_32);
      for (int li_48 = gi_244 - 1; li_48 >= 0; li_48--) {
         if (gda_476[li_48] > 0.0) ada_4[li_48] = 1;
         if (gda_476[li_48] < 0.0) ada_4[li_48] = -1;
      }
   }
}

void TSIOnArray(double ada_0[], double &ada_4[], string a_symbol_8, int ai_16, int ai_20, int ai_24, int ai_28, int ai_32, int ai_36) {
   double l_point_40 = MarketInfo(a_symbol_8, MODE_POINT);
   int li_48 = 1;
   switch (MarketInfo(a_symbol_8, MODE_DIGITS)) {
   case 2.0:
      li_48 = 1;
      break;
   case 4.0:
      li_48 = 1;
      break;
   case 3.0:
      li_48 = 10;
      break;
   case 5.0:
      li_48 = 10;
      break;
   default:
      li_48 = 1;
   }
   int li_60 = ai_24;
   MAOnArray(ada_0, gda_500, ai_16, li_60, ai_36);
   if (ai_20 == 1) CAOnArray(ada_0, gda_500, ai_16, li_60, ai_36);
   else MAOnArray(ada_0, gda_500, ai_16, li_60, ai_36);
   ArrayInitialize(ada_4, 0.0);
   while (li_60 < ai_28) {
      li_60 += ai_32;
      if (ai_20 == 1) CAOnArray(ada_0, gda_504, ai_16, li_60, ai_36);
      else MAOnArray(ada_0, gda_504, ai_16, li_60, ai_36);
      for (int li_64 = ai_36 - 1; li_64 >= 0; li_64--) {
         ada_4[li_64] += (gda_500[li_64] - gda_504[li_64]);
         gda_500[li_64] = gda_504[li_64];
      }
   }
   for (li_64 = ai_36 - 1; li_64 >= 0; li_64--) ada_4[li_64] = ada_4[li_64] / l_point_40 / li_48;
}

void DrawLineSignal(int ai_0, double ada_4[], int ai_8) {
   ObjectsDeleteByPrefix("Line" + ai_0);
   for (int li_12 = ai_8 - 1; li_12 >= 0; li_12--) {
      if (ada_4[li_12] > 0.0) ObjectBar("Line" + ai_0 + li_12, 0, Time[li_12], Close[li_12], Lime);
      else ObjectBar("Line" + ai_0 + li_12, 0, Time[li_12], Close[li_12], Red);
   }
}

void ObjectBar(string a_name_0, int a_window_8, int a_datetime_12, double a_price_16, color a_color_24) {
   if (ObjectFind(a_name_0) < 0) {
      ObjectCreate(a_name_0, OBJ_ARROW, a_window_8, a_datetime_12, a_price_16);
      ObjectSet(a_name_0, OBJPROP_COLOR, a_color_24);
      ObjectSet(a_name_0, OBJPROP_ARROWCODE, 115);
   }
   ObjectSet(a_name_0, OBJPROP_TIME1, a_datetime_12);
   ObjectSet(a_name_0, OBJPROP_PRICE1, a_price_16);
}

int ObjectsDeleteByPrefix(string as_0) {
   string l_name_20;
   int l_str_len_8 = StringLen(as_0);
   int li_12 = 0;
   bool li_ret_16 = FALSE;
   while (li_12 < ObjectsTotal()) {
      l_name_20 = ObjectName(li_12);
      if (StringSubstr(l_name_20, 0, l_str_len_8) != as_0) {
         li_12++;
         continue;
      }
      li_ret_16 = TRUE;
      ObjectDelete(l_name_20);
   }
   return (li_ret_16);
}

void init() {
   g_symbol_540 = Symbol();
   g_timeframe_248 = Period();
   InitTempBuf(Counter + 100, 6);
   InitBufferam(Counter + 100);
   ArrayResize(gda_360, VisualCount);
   ArrayResize(gda_364, VisualCount);
   ArrayResize(gda_368, VisualCount);
   ArrayResize(gda_372, VisualCount);
   ArrayInitialize(gda_360, AccountBalance());
   ArrayInitialize(gda_364, AccountEquity());
   ArrayInitialize(gda_368, 0);
   ArrayInitialize(gda_372, 0);
   gi_252 = TimeFrameShift(g_timeframe_248, AutoFrame);
   gi_256 = TimeFrameShift(gi_252, 1);
   gi_260 = TimeFrameShift(gi_256, 1);
   gi_264 = DayBackFast;
   gi_unused_268 = DayBackSlow;
   gi_unused_272 = DayBackHigh;
   if (DayBackFast < 0) gi_264 = gda_576[TimeFrameToIndex(gi_252)];
   if (DayBackSlow < 0) gi_unused_268 = gda_576[TimeFrameToIndex(gi_256)];
   if (DayBackHigh < 0) gi_unused_272 = gda_576[TimeFrameToIndex(gi_260)];
   Comment("Минимальный размер лота : ", MarketInfo(g_symbol_540, MODE_MINLOT), 
      "\n", "Шаг изменения размера лота : ", MarketInfo(g_symbol_540, MODE_LOTSTEP), 
      "\n", "Максимальный размер лота : ", MarketInfo(g_symbol_540, MODE_MAXLOT), 
   "\n");
}

void start() {
   int l_cmd_4;
   g_datetime_376 = iTime(NULL, g_timeframe_248, 0);
   if (g_datetime_376 != g_datetime_380) {
      g_datetime_380 = g_datetime_376;
      if (Bars < Counter || IsTradeAllowed() == FALSE) return;
      gi_244 = Counter + 100;
      ManagerPositionsGrider();
      for (int l_pos_0 = VisualCount - 1; l_pos_0 >= 0; l_pos_0--) {
         gda_360[l_pos_0 + 1] = gda_360[l_pos_0];
         gda_364[l_pos_0 + 1] = gda_364[l_pos_0];
         gda_368[l_pos_0 + 1] = gda_368[l_pos_0];
         gda_372[l_pos_0 + 1] = gda_372[l_pos_0];
      }
      gda_360[l_pos_0] = AccountBalance();
      gda_364[l_pos_0] = AccountEquity();
      gda_368[l_pos_0] = 0;
      gda_372[l_pos_0] = 0;
      for (l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) {
         if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) {
            l_cmd_4 = OrderType();
            if (l_cmd_4 == OP_BUY) gda_368[l_pos_0] += OrderProfit();
            if (l_cmd_4 == OP_SELL) gda_372[l_pos_0] += OrderProfit();
         }
      }
      CaptionBalance();
      if (VisualOrder == TRUE) DrawVisualOrder();
   }
}

void ManagerPositionsGrider() {
   double ld_28;
   double ld_0 = 0;
   double ld_8 = 0;
   int li_16 = 0;
   CalculateTradeSignal();
   int li_20 = GetTradeSignal(li_16);
   int li_24 = GetTradeSignal(li_16 + 1);
   if (li_20 == 1 && gi_288 == -1) {
      while (ExistPositions("", OP_SELL) == 1) ClosePositions("", OP_SELL);
      gi_288 = 0;
      g_count_292 = 0;
   }
   if (li_20 == -1 && gi_288 == 1) {
      while (ExistPositions("", OP_BUY) == 1) ClosePositions("", OP_BUY);
      gi_288 = 0;
      g_count_292 = 0;
   }
   if (CountOpen > 0)
      if (g_count_292 > CountOpen) return;
   if (li_20 == 1 && li_20 == 1) {
      if (StopLoss_1 != 0) ld_0 = Ask - StopLoss_1 * Point;
      if (TakeProfit_1 != 0) ld_8 = Ask + TakeProfit_1 * Point;
      if (g_count_292 == 0) ld_28 = FirstLot;
      else ld_28 = Lots;
      OpenPositionLot("", OP_BUY, ld_28, ld_0, ld_8);
      if (SingleOpen == TRUE) gia_280[li_16] = 0;
      gi_288 = 1;
      g_count_292++;
   }
   if (li_20 == -1 && li_20 == -1) {
      if (StopLoss_1 != 0) ld_0 = Bid + StopLoss_1 * Point;
      if (TakeProfit_1 != 0) ld_8 = Bid - TakeProfit_1 * Point;
      if (g_count_292 == 0) ld_28 = FirstLot;
      else ld_28 = Lots;
      OpenPositionLot("", OP_SELL, ld_28, ld_0, ld_8);
      if (SingleOpen == TRUE) gia_280[li_16] = 0;
      gi_288 = -1;
      g_count_292++;
   }
}

int GetTradeSignal(int ai_0 = 0) {
   bool li_ret_4 = FALSE;
   li_ret_4 = gia_276[ai_0] * MathAbs(gia_280[ai_0]);
   return (li_ret_4);
}

int OpenPositionLot(string a_symbol_0 = "", int a_cmd_8 = -1, double a_lots_12 = 0.0, double a_price_20 = 0.0, double a_price_28 = 0.0) {
   color l_color_36;
   double l_price_40;
   int l_ticket_48;
   if (a_cmd_8 < OP_BUY) return (0);
   if (a_symbol_0 == "") a_symbol_0 = Symbol();
   if (a_cmd_8 == OP_BUY) {
      l_color_36 = gi_208;
      l_price_40 = Ask;
   }
   if (a_cmd_8 == OP_SELL) {
      l_color_36 = gi_212;
      l_price_40 = Bid;
   }
   l_ticket_48 = OrderSend(a_symbol_0, a_cmd_8, a_lots_12, l_price_40, g_slippage_204, a_price_20, a_price_28, "", 0, 0, l_color_36);
   return (l_ticket_48);
}

int ClosePositions(string as_0 = "", int a_cmd_8 = -1, int ai_12 = -1) {
   int l_ord_total_16 = OrdersTotal();
   int li_ret_20 = -1;
   if (as_0 == "") as_0 = Symbol();
   for (int l_pos_24 = 0; l_pos_24 < l_ord_total_16; l_pos_24++) {
      if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0 && a_cmd_8 < OP_BUY || OrderType() == a_cmd_8) {
            if (OrderTicket() == ai_12 || ai_12 < 0) {
               if (OrderType() == OP_BUY)
                  if (OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, g_color_224) == 1) li_ret_20 = ai_12;
               if (OrderType() == OP_SELL)
                  if (OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, g_color_228) == 1) li_ret_20 = ai_12;
            }
         }
      }
   }
   return (li_ret_20);
}

int ExistPositions(string as_0 = "", int a_cmd_8 = -1, int a_magic_12 = -1) {
   int l_ord_total_16 = OrdersTotal();
   if (as_0 == "") as_0 = Symbol();
   for (int l_pos_20 = 0; l_pos_20 < l_ord_total_16; l_pos_20++) {
      if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderSymbol() == as_0) {
            if (OrderType() == OP_BUY || OrderType() == OP_SELL) {
               if (a_cmd_8 < OP_BUY || OrderType() == a_cmd_8)
                  if (a_magic_12 < 0 || OrderMagicNumber() == a_magic_12) return (1);
            }
         }
      }
   }
   return (0);
}

void DrawVisualOrder() {
   int l_digits_4;
   string ls_8;
   int l_ord_total_0 = OrdersTotal();
   for (int l_pos_16 = 0; l_pos_16 < 15; l_pos_16++) {
      ls_8 = "";
      if (l_pos_16 < l_ord_total_0) {
         if (OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES) == TRUE) {
            l_digits_4 = MarketInfo(OrderSymbol(), MODE_DIGITS);
            ls_8 = l_pos_16 + "   " + OrderTicket() + "   " + TimeToStr(OrderOpenTime(), TIME_DATE|TIME_MINUTES) + "   " + CaptionTypeOrder(OrderType()) + "  " + DoubleToStr(OrderStopLoss(), l_digits_4) + "   " + DoubleToStr(OrderTakeProfit(), l_digits_4) + "   " + DoubleToStr(OrderProfit(), l_digits_4);
         }
      }
      ObjectDrawCaption(gs_orders_348 + l_pos_16, ls_8, 0, gia_356[0], gia_356[1], gia_356[2] + gia_356[4] * l_pos_16, Gold, 1);
   }
}

string CaptionTypeOrder(int ai_0) {
   switch (ai_0) {
   case 0:
      return ("BUY       ");
   case 1:
      return ("SELL      ");
   case 2:
      return ("BUY_Limit ");
   case 3:
      return ("SELL_Limit");
   case 4:
      return ("BUY_Stop  ");
   case 5:
      return ("SELL_Stop ");
   }
   return ("");
}

void CaptionSignal(int ai_0, int ai_4) {
   string ls_8 = "Signal(" + ai_0 + ") : " + ai_4;
   ObjectDrawCaption(gs_signal_304 + ai_0, ls_8, 0, gia_336[0], gia_336[1] + 15, gia_336[2] + gia_336[4] * ai_0, SpringGreen, 1);
}

void CaptionPeding(int ai_0, int ai_4) {
   string ls_8 = "Peding(" + ai_0 + ") : " + ai_4;
   ObjectDrawCaption(gs_signal_304 + ai_0, ls_8, 0, gia_340[0], gia_340[1] + 15, gia_340[2] + gia_340[4] * ai_0, SpringGreen, 1);
}

void CaptionBalance() {
   int li_24;
   int li_28;
   int li_32;
   int li_0 = 10;
   string ls_4 = "Arial";
   int li_12 = 15;
   int li_16 = 55;
   int li_20 = 13499135;
   int li_unused_36 = 42495;
   int li_unused_40 = 42495;
   int li_unused_44 = 16777215;
   if (AccountProfit() > 0.0) {
      li_24 = 65280;
      li_32 = 65280;
      li_28 = 65280;
   }
   if (AccountProfit() < 0.0) {
      li_24 = 255;
      li_32 = 255;
      li_28 = 255;
   }
   if (AccountProfit() == 0.0) {
      li_24 = 16777215;
      li_32 = 16777215;
      li_28 = 55295;
   }
   VisualText(gs_balance_320 + 0, "Balance", li_0, ls_4, li_20, gia_344[0], gia_344[1] + li_16, gia_344[2] + gia_344[4]);
   VisualText(gs_balance_320 + 1, DoubleToStr(AccountBalance(), 2), li_0, "Arial Bold", li_28, gia_344[0], gia_344[1], gia_344[2] + gia_344[4]);
   VisualText(gs_balance_320 + 2, "Equity", li_0, ls_4, li_20, gia_344[0], gia_344[1] + li_16, gia_344[2] + gia_344[4] + 1 * li_12);
   VisualText(gs_balance_320 + 3, DoubleToStr(AccountEquity(), 2), li_0, "Arial Bold", li_24, gia_344[0], gia_344[1], gia_344[2] + gia_344[4] + 1 * li_12);
   VisualText(gs_balance_320 + 4, "Free margin", li_0, ls_4, li_20, gia_344[0], gia_344[1] + li_16, gia_344[2] + gia_344[4] + li_12 * 2);
   VisualText(gs_balance_320 + 5, DoubleToStr(AccountFreeMargin(), 2), li_0, "Arial Bold", li_32, gia_344[0], gia_344[1], gia_344[2] + gia_344[4] + li_12 * 2);
   VisualText(gs_balance_320 + 6, "Margin", li_0, ls_4, li_20, gia_344[0], gia_344[1] + li_16, gia_344[2] + gia_344[4] + 3 * li_12);
   VisualText(gs_balance_320 + 7, DoubleToStr(AccountMargin(), 2), li_0, "Arial Bold", li_20, gia_344[0], gia_344[1], gia_344[2] + gia_344[4] + 3 * li_12);
   VisualText(gs_balance_320 + 8, DoubleToStr(AccountProfit(), 2), 15, ls_4, li_24, gia_344[0], gia_344[1] + 25, gia_344[2] + gia_344[4] + 5 * li_12);
   VisualText(gs_balance_320 + 9, "Р.Е.", 8, ls_4, li_20, gia_344[0], gia_344[1], gia_344[2] + gia_344[4] + 6 * li_12 - 5);
}

void ObjectDrawCaption(string a_name_0, string a_text_8, int a_window_16, int a_corner_20, int a_x_24, int a_y_28, color a_color_32, int ai_36) {
   if (ObjectFind(a_name_0) < 0) {
      ObjectCreate(a_name_0, OBJ_LABEL, a_window_16, 0, 0);
      ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_20);
      ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_24);
      ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_28);
      ObjectSetText(a_name_0, a_text_8, 9, "Times New Roman");
      ObjectSet(a_name_0, OBJPROP_COLOR, a_color_32);
      return;
   }
   if (ai_36 == 1) {
      ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_24);
      ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_28);
      ObjectSetText(a_name_0, a_text_8, 9, "Times New Roman");
      ObjectSet(a_name_0, OBJPROP_COLOR, a_color_32);
   }
}

void VisualText(string a_name_0, string a_text_8, int a_fontsize_16, string a_fontname_20, color a_color_28, int a_corner_32, int a_x_36, int a_y_40) {
   if (ObjectFind(a_name_0) < 0) {
      ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0);
      ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_32);
      ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_36);
      ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_40);
      ObjectSetText(a_name_0, a_text_8, a_fontsize_16, a_fontname_20, a_color_28);
      return;
   }
   ObjectSetText(a_name_0, a_text_8, a_fontsize_16, a_fontname_20, a_color_28);
}
