
#property copyright "© 2013 BJF Trading Group"
#property link      "www.iticsoftware.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Black

extern string _tmp1_ = " --- Common ---";
extern string OptionsDescription = "http://iticsoftware.com/forex-divergence-options";
extern int AccDigits = 0;
extern bool UseOpenBar = FALSE;
extern string _tmp21_ = " --- CCI ---";
extern int CCIperiod = 14;
extern int CCIapplied_price = 5;
extern string _tmp22_ = " --- Momentum ---";
extern int Mom_period = 30;
extern int Mom_applied_price = 0;
extern string _tmp23_ = " --- StdDev ---";
extern int StdDev_period = 20;
extern int StdDev_ma_shift = 0;
extern int StdDev_ma_method = 0;
extern int StdDev_applied_price = 0;
extern string _tmp3_ = " --- Divergence peaks ---";
extern int Chart_LeftTop_BarsL = 4;
extern int Chart_LeftTop_BarsR = 3;
extern int Chart_RightTop_BarsL = 3;
extern int Chart_RightTop_BarsR = 1;
extern int Ind_LeftTop_BarsL = 7;
extern int Ind_LeftTop_BarsR = 3;
extern int Ind_RightTop_BarsL = 3;
extern int Ind_RightTop_BarsR = 1;
extern int LeftTops_MaxBarsDiff = 15;
extern int RightTops_MaxBarsDiff = 5;
extern string _tmp4_ = " --- Levels ---";
extern double CCI_BullishDiv_ResetAbove = 1000.0;
extern double CCI_BearishDiv_ResetBelow = -1000.0;
extern double Mom_BullishDiv_ResetAbove = 102.0;
extern double Mom_BearishDiv_ResetBelow = 98.0;
extern double StdDev_BullishDiv_ResetBelow = 0.0;
extern double StdDev_BearishDiv_ResetBelow = 0.0;
extern string _tmp5_ = " --- Filters ---";
extern int MaxBars = 2000;
extern int DivWidthMinBars = 5;
extern int DivWidthMaxBars = 150;
extern int DivHeightMinPips = 1;
extern int DivHeightMaxPips = 1000;
extern string _tmp6_ = " --- Graphic ---";
extern color clBullishDiv = DeepSkyBlue;
extern color clBearishDiv = OrangeRed;
extern int ChartBullishDivArrowCode1 = 233;
extern int ChartBullishDivArrowCode2 = 32;
extern int ChartBearishDivArrowCode1 = 234;
extern int ChartBearishDivArrowCode2 = 32;
extern int ChartBullishDivArrowSize1 = 1;
extern int ChartBullishDivArrowSize2 = 1;
extern int ChartBearishDivArrowSize1 = 1;
extern int ChartBearishDivArrowSize2 = 1;
extern string ChartArrowshift_all_TF = "5;5;10;10;15;20;70;200;300";
extern string ChartLineshift_all_TF = "0;0;0;0;0;0;0;0;0";
extern int ChartLinestyle = 2;
extern int ChartLinewidth = 1;
extern int IndLinestyle = 0;
extern int IndLinewidth = 1;
double Gda_368[];
double Gda_372[];
double Gda_376[];
double Gda_380[];
double Gda_384[];
double Gda_388[];
double Gda_392[];
double Gda_396[];
int Gia_400[];
int Gia_404[];
string Gs_408;
string Gs_416;
double Gd_424 = 0.236;
int Gi_432 = 0;
datetime Gt_436 = 0;
int Gia_440[][5];
int Gia_444[][5];
int Gia_448[][2];
int Gia_452[][2];
int Gia_456[][2];
int Gia_460[][2];
int Gia_464[][2];
int Gia_468[][2];
int Gi_472 = 0;
int Gi_476 = 0;
int Gi_480 = 0;
int Gi_484 = 0;
int Gi_488 = 0;
int Gi_492 = 0;
int Gi_496 = 0;
int Gi_500 = 0;

// E37F0136AA3FFAF149B351F6A4C948E9
void init() {
   IndicatorBuffers(2);
   SetIndexStyle(0, DRAW_NONE);
   SetIndexStyle(1, DRAW_NONE);
   SetIndexBuffer(0, Gda_368);
   SetIndexBuffer(1, Gda_372);
   Gs_416 = "BJF CCI,Mom,StdDev";
   Comment("\n ", Gs_416);
   Gs_408 = "i-Div3_050713";
   f0_1();
   f0_8(Gia_400, ChartArrowshift_all_TF, ";");
   f0_8(Gia_404, ChartLineshift_all_TF, ";");
   ArraySetAsSeries(Gda_376, TRUE);
   ArraySetAsSeries(Gda_380, TRUE);
   ArraySetAsSeries(Gda_384, TRUE);
   ArraySetAsSeries(Gda_388, TRUE);
   ArraySetAsSeries(Gda_392, TRUE);
   ArraySetAsSeries(Gda_396, TRUE);
}

// 52D46093050F38C27267BCE42543EF60
void deinit() {
   f0_1();
   Comment("");
}

// EA2B2676C28C0DB26D39331A336C6B92
void start() {
   string Ls_36;
   int Li_52;
   int Li_56;
   int Li_60;
   int Li_64;
   int Li_68;
   int Li_72;
   int Li_76;
   double Ld_80;
   double Ld_88;
   int Li_96;
   bool Li_100;
   int Li_104;
   int Li_108;
   int Li_0 = 10;
   if (TimeCurrent() - Gi_432 < Li_0 && Time[0] == Gt_436) return;
   Gi_432 = TimeCurrent();
   Gt_436 = Time[0];
   int Li_4 = ArraySize(Gda_376);
   if (Li_4 < Bars) {
      Li_4 = Bars;
      ArrayResize(Gda_376, Li_4);
      ArrayResize(Gda_380, Li_4);
   }
   Li_4 = ArraySize(Gda_384);
   if (Li_4 < Bars) {
      Li_4 = Bars;
      ArrayResize(Gda_384, Li_4);
      ArrayResize(Gda_388, Li_4);
   }
   Li_4 = ArraySize(Gda_392);
   if (Li_4 < Bars) {
      Li_4 = Bars;
      ArrayResize(Gda_392, Li_4);
      ArrayResize(Gda_396, Li_4);
   }
   Li_4 = ArrayRange(Gia_440, 0);
   if (Li_4 < Bars) {
      Li_4 = Bars;
      ArrayResize(Gia_440, Li_4);
      ArrayResize(Gia_444, Li_4);
      ArrayResize(Gia_448, Li_4);
      ArrayResize(Gia_452, Li_4);
      ArrayResize(Gia_456, Li_4);
      ArrayResize(Gia_460, Li_4);
      ArrayResize(Gia_464, Li_4);
      ArrayResize(Gia_468, Li_4);
   }
   int Li_8 = IndicatorCounted();
   if (Li_8 > 0) Li_8--;
   int Li_12 = Bars - Li_8;
   if (Li_12 > 1) f0_1();
   f0_1();
   for (int Li_16 = 0; Li_16 < Bars; Li_16++) {
      Gda_368[Li_16] = 0.0;
      Gda_372[Li_16] = 0.0;
      Gda_376[Li_16] = 0.0;
      Gda_380[Li_16] = 0.0;
      Gda_384[Li_16] = 0.0;
      Gda_388[Li_16] = 0.0;
      Gda_392[Li_16] = 0.0;
      Gda_396[Li_16] = 0.0;
   }
   Li_12 = MaxBars;
   for (Li_16 = 0; Li_16 < Li_12; Li_16++) {
      Gda_368[Li_16] = f0_10(1, Chart_RightTop_BarsL, Chart_RightTop_BarsR, Li_16);
      Gda_372[Li_16] = f0_10(1, Chart_LeftTop_BarsL, Chart_LeftTop_BarsR, Li_16);
      Gda_376[Li_16] = f0_18(1, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_380[Li_16] = f0_18(1, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
      Gda_384[Li_16] = f0_14(1, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_388[Li_16] = f0_14(1, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
      Gda_392[Li_16] = f0_6(1, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_396[Li_16] = f0_6(1, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
   }
   Gi_476 = 0;
   for (int Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_368[Li_44] != 0.0) {
         for (int Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_0(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               if (Li_96 == 0) {
                  Gia_444[Gi_476][0] = Li_48;
                  Gia_444[Gi_476][1] = Li_44;
                  Gia_444[Gi_476][2] = -1;
                  Gia_444[Gi_476][3] = -1;
                  Gia_444[Gi_476][4] = -1;
                  Gi_476++;
               }
            }
         }
      }
   }
   Gi_484 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_376[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_2(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (int Li_24 = 0; Li_24 < Gi_476; Li_24++) {
                  if (MathAbs(Gia_444[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_444[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_444[Li_24][2] = Gi_484;
                     }
                  }
               }
               if (Li_100) {
                  Gia_452[Gi_484][0] = Li_48;
                  Gia_452[Gi_484][1] = Li_44;
                  Gi_484++;
               }
            }
         }
      }
   }
   Gi_492 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_384[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_7(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (Li_24 = 0; Li_24 < Gi_476; Li_24++) {
                  if (MathAbs(Gia_444[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_444[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_444[Li_24][3] = Gi_492;
                     }
                  }
               }
               if (Li_100) {
                  Gia_460[Gi_492][0] = Li_48;
                  Gia_460[Gi_492][1] = Li_44;
                  Gi_492++;
               }
            }
         }
      }
   }
   Gi_500 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_392[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_12(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (Li_24 = 0; Li_24 < Gi_476; Li_24++) {
                  if (MathAbs(Gia_444[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_444[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_444[Li_24][4] = Gi_500;
                     }
                  }
               }
               if (Li_100) {
                  Gia_468[Gi_500][0] = Li_48;
                  Gia_468[Gi_500][1] = Li_44;
                  Gi_500++;
               }
            }
         }
      }
   }
   for (Li_16 = 0; Li_16 < Gi_476; Li_16++) {
      if (Gia_444[Li_16][2] == -1 && 1) continue;
      if (Gia_444[Li_16][3] == -1 && 1) continue;
      if (Gia_444[Li_16][4] == -1 && 1) continue;
      Li_52 = Gia_444[Li_16][1] - Chart_RightTop_BarsR - 1;
      Li_104 = Gia_444[Li_16][2];
      Li_52 = MathMin(Li_52, Gia_452[Li_104][1] - Ind_RightTop_BarsR - 1);
      Li_104 = Gia_444[Li_16][3];
      Li_52 = MathMin(Li_52, Gia_460[Li_104][1] - Ind_RightTop_BarsR - 1);
      Li_104 = Gia_444[Li_16][4];
      Li_52 = MathMin(Li_52, Gia_468[Li_104][1] - Ind_RightTop_BarsR - 1);
      if (UseOpenBar) Li_52++;
      if (Li_52 >= 0) {
         Li_64 = Gia_444[Li_16][0];
         Li_56 = Gia_444[Li_16][1];
         Ls_36 = Gs_408 + "_chart_ua1_" + Time[Li_52];
         Li_72 = Time[Li_52];
         Ld_80 = High[Li_52] + 1.3 * Gia_400[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_ARROW, 0, Li_72, Ld_80);
         else ObjectMove(Ls_36, 0, Li_72, Ld_80);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartBearishDivArrowSize1);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_ARROWCODE, ChartBearishDivArrowCode1);
         Ls_36 = Gs_408 + "_chart_ua2_" + Time[Li_64];
         Li_72 = Time[Li_64];
         Ld_80 = High[Li_64] + 1.3 * Gia_400[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_ARROW, 0, Li_72, Ld_80);
         else ObjectMove(Ls_36, 0, Li_72, Ld_80);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartBearishDivArrowSize2);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_ARROWCODE, ChartBearishDivArrowCode2);
         Ls_36 = Gs_408 + "_chart_ul_" + Time[Li_64] + "_" + Time[Li_56];
         Li_72 = Time[Li_64];
         Ld_80 = High[Li_64] + Gia_404[f0_5(Period())] * f0_4();
         Li_76 = Time[Li_56];
         Ld_88 = High[Li_56] + Gia_404[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, 0, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, ChartLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartLinewidth);
      }
   }
   for (int Li_20 = 0; Li_20 < Gi_484; Li_20++) {
      Li_108 = 1;
      Li_68 = Gia_452[Li_20][0];
      Li_60 = Gia_452[Li_20][1];
      Ls_36 = Gs_408 + "_ind1_ul_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_380[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_376[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
   for (Li_20 = 0; Li_20 < Gi_492; Li_20++) {
      Li_108 = 2;
      Li_68 = Gia_460[Li_20][0];
      Li_60 = Gia_460[Li_20][1];
      Ls_36 = Gs_408 + "_ind2_ul_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_388[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_384[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
   for (Li_20 = 0; Li_20 < Gi_500; Li_20++) {
      Li_108 = 3;
      Li_68 = Gia_468[Li_20][0];
      Li_60 = Gia_468[Li_20][1];
      Ls_36 = Gs_408 + "_ind3_ul_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_396[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_392[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBearishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
   for (Li_16 = 0; Li_16 < Bars; Li_16++) {
      Gda_368[Li_16] = 0.0;
      Gda_372[Li_16] = 0.0;
      Gda_376[Li_16] = 0.0;
      Gda_380[Li_16] = 0.0;
      Gda_384[Li_16] = 0.0;
      Gda_388[Li_16] = 0.0;
      Gda_392[Li_16] = 0.0;
      Gda_396[Li_16] = 0.0;
   }
   Li_12 = MaxBars;
   for (Li_16 = 0; Li_16 < Li_12; Li_16++) {
      Gda_368[Li_16] = f0_10(2, Chart_RightTop_BarsL, Chart_RightTop_BarsR, Li_16);
      Gda_372[Li_16] = f0_10(2, Chart_LeftTop_BarsL, Chart_LeftTop_BarsR, Li_16);
      Gda_376[Li_16] = f0_18(2, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_380[Li_16] = f0_18(2, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
      Gda_384[Li_16] = f0_14(2, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_388[Li_16] = f0_14(2, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
      Gda_392[Li_16] = f0_6(1, Ind_RightTop_BarsL, Ind_RightTop_BarsR, Li_16);
      Gda_396[Li_16] = f0_6(1, Ind_LeftTop_BarsL, Ind_LeftTop_BarsR, Li_16);
   }
   Gi_472 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_368[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_3(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               if (Li_96 == 0) {
                  Gia_440[Gi_472][0] = Li_48;
                  Gia_440[Gi_472][1] = Li_44;
                  Gia_440[Gi_472][2] = -1;
                  Gia_440[Gi_472][3] = -1;
                  Gia_440[Gi_472][4] = -1;
                  Gi_472++;
               }
            }
         }
      }
   }
   Gi_480 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_376[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_13(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (Li_24 = 0; Li_24 < Gi_472; Li_24++) {
                  if (MathAbs(Gia_440[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_440[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_440[Li_24][2] = Gi_480;
                     }
                  }
               }
               if (Li_100) {
                  Gia_448[Gi_480][0] = Li_48;
                  Gia_448[Gi_480][1] = Li_44;
                  Gi_480++;
               }
            }
         }
      }
   }
   Gi_488 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_384[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_16(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (Li_24 = 0; Li_24 < Gi_472; Li_24++) {
                  if (MathAbs(Gia_440[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_440[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_440[Li_24][3] = Gi_488;
                     }
                  }
               }
               if (Li_100) {
                  Gia_456[Gi_488][0] = Li_48;
                  Gia_456[Gi_488][1] = Li_44;
                  Gi_488++;
               }
            }
         }
      }
   }
   Gi_496 = 0;
   for (Li_44 = 0; Li_44 < Li_12; Li_44++) {
      if (Gda_392[Li_44] != 0.0) {
         for (Li_48 = Li_44 + DivWidthMinBars; Li_48 < Li_12 + DivWidthMaxBars; Li_48++) {
            if (Li_48 >= Bars) break;
            Li_96 = f0_11(Li_48, Li_44);
            if (Li_96 < 0) break;
            if (Li_96 <= 0) {
               Li_100 = FALSE;
               for (Li_24 = 0; Li_24 < Gi_472; Li_24++) {
                  if (MathAbs(Gia_440[Li_24][0] - Li_48) <= LeftTops_MaxBarsDiff) {
                     if (MathAbs(Gia_440[Li_24][1] - Li_44) <= RightTops_MaxBarsDiff) {
                        Li_100 = TRUE;
                        Gia_440[Li_24][4] = Gi_496;
                     }
                  }
               }
               if (Li_100) {
                  Gia_464[Gi_496][0] = Li_48;
                  Gia_464[Gi_496][1] = Li_44;
                  Gi_496++;
               }
            }
         }
      }
   }
   for (Li_16 = 0; Li_16 < Gi_472; Li_16++) {
      if (Gia_440[Li_16][2] == -1 && 1) continue;
      if (Gia_440[Li_16][3] == -1 && 1) continue;
      if (Gia_440[Li_16][4] == -1 && 1) continue;
      Li_52 = Gia_440[Li_16][1] - Chart_RightTop_BarsR - 1;
      Li_104 = Gia_440[Li_16][2];
      Li_52 = MathMin(Li_52, Gia_448[Li_104][1] - Ind_RightTop_BarsR - 1);
      Li_104 = Gia_440[Li_16][3];
      Li_52 = MathMin(Li_52, Gia_456[Li_104][1] - Ind_RightTop_BarsR - 1);
      Li_104 = Gia_440[Li_16][4];
      Li_52 = MathMin(Li_52, Gia_464[Li_104][1] - Ind_RightTop_BarsR - 1);
      if (UseOpenBar) Li_52++;
      if (Li_52 >= 0) {
         Li_64 = Gia_440[Li_16][0];
         Li_56 = Gia_440[Li_16][1];
         Ls_36 = Gs_408 + "_chart_la1_" + Time[Li_52];
         Li_72 = Time[Li_52];
         Ld_80 = Low[Li_52] - 1.0 * Gia_400[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_ARROW, 0, Li_72, Ld_80);
         else ObjectMove(Ls_36, 0, Li_72, Ld_80);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartBullishDivArrowSize1);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_ARROWCODE, ChartBullishDivArrowCode1);
         Ls_36 = Gs_408 + "_chart_la2_" + Time[Li_64];
         Li_72 = Time[Li_64];
         Ld_80 = Low[Li_64] - 1.0 * Gia_400[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_ARROW, 0, Li_72, Ld_80);
         else ObjectMove(Ls_36, 0, Li_72, Ld_80);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartBullishDivArrowSize2);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_ARROWCODE, ChartBullishDivArrowCode2);
         Ls_36 = Gs_408 + "_chart_ll_" + Time[Li_64] + "_" + Time[Li_56];
         Li_72 = Time[Li_64];
         Ld_80 = Low[Li_64] - Gia_404[f0_5(Period())] * f0_4();
         Li_76 = Time[Li_56];
         Ld_88 = Low[Li_56] - Gia_404[f0_5(Period())] * f0_4();
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, 0, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, ChartLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, ChartLinewidth);
      }
   }
   for (Li_20 = 0; Li_20 < Gi_480; Li_20++) {
      Li_108 = 1;
      Li_68 = Gia_448[Li_20][0];
      Li_60 = Gia_448[Li_20][1];
      Ls_36 = Gs_408 + "_ind1_ll_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_380[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_376[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
   for (Li_20 = 0; Li_20 < Gi_488; Li_20++) {
      Li_108 = 2;
      Li_68 = Gia_456[Li_20][0];
      Li_60 = Gia_456[Li_20][1];
      Ls_36 = Gs_408 + "_ind2_ll_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_388[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_384[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
   for (Li_20 = 0; Li_20 < Gi_496; Li_20++) {
      Li_108 = 3;
      Li_68 = Gia_464[Li_20][0];
      Li_60 = Gia_464[Li_20][1];
      Ls_36 = Gs_408 + "_ind3_ll_" + Time[Li_68] + "_" + Time[Li_60];
      Li_72 = Time[Li_68];
      Ld_80 = Gda_396[Li_68];
      Li_76 = Time[Li_60];
      Ld_88 = Gda_392[Li_60];
      if (Li_108 != -1 && Li_108 < WindowsTotal()) {
         if (ObjectFind(Ls_36) == -1) ObjectCreate(Ls_36, OBJ_TREND, Li_108, Li_72, Ld_80, Li_76, Ld_88);
         else {
            ObjectMove(Ls_36, 0, Li_72, Ld_80);
            ObjectMove(Ls_36, 1, Li_76, Ld_88);
         }
         ObjectSet(Ls_36, OBJPROP_RAY, FALSE);
         ObjectSet(Ls_36, OBJPROP_COLOR, clBullishDiv);
         ObjectSet(Ls_36, OBJPROP_STYLE, IndLinestyle);
         ObjectSet(Ls_36, OBJPROP_WIDTH, IndLinewidth);
      }
   }
}

// 003AEA789D600FF8C046285880E2F191
int f0_0(int Ai_0, int Ai_4) {
   double Ld_52;
   if (Gda_368[Ai_4] == 0.0) return (-1);
   if (Gda_372[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (MathAbs(High[Ai_0] - High[Ai_4]) < DivHeightMinPips * f0_4()) return (5);
   if (MathAbs(High[Ai_0] - High[Ai_4]) > DivHeightMaxPips * f0_4()) return (-6);
   if (Gda_368[Ai_4] <= Gda_372[Ai_0]) return (7);
   int Li_8 = Ai_0;
   double Ld_16 = High[Li_8];
   int Li_12 = Ai_4;
   double Ld_24 = High[Li_12];
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   for (int Li_48 = Ai_4; Li_48 <= Ai_0; Li_48++) {
      if (High[Li_48] > MathMax(High[Ai_0], High[Ai_4]) + 1.0 * f0_4()) return (8);
      Ld_52 = Ld_32 * Li_48 + Ld_40;
      if (High[Li_48] > Ld_52 + Gd_424 * MathAbs(Ld_24 - Ld_16)) return (9);
   }
   return (0);
}

// 17982662FA5D8267AC886D82B0BAF154
int f0_3(int Ai_0, int Ai_4) {
   double Ld_52;
   if (Gda_368[Ai_4] == 0.0) return (-1);
   if (Gda_372[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (MathAbs(Low[Ai_0] - Low[Ai_4]) < DivHeightMinPips * f0_4()) return (5);
   if (MathAbs(Low[Ai_0] - Low[Ai_4]) > DivHeightMaxPips * f0_4()) return (-6);
   if (Gda_368[Ai_4] >= Gda_372[Ai_0]) return (7);
   int Li_8 = Ai_0;
   double Ld_16 = Low[Li_8];
   int Li_12 = Ai_4;
   double Ld_24 = Low[Li_12];
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   for (int Li_48 = Ai_4; Li_48 <= Ai_0; Li_48++) {
      if (Low[Li_48] < MathMin(Low[Ai_0], Low[Ai_4]) - 1.0 * f0_4()) return (8);
      Ld_52 = Ld_32 * Li_48 + Ld_40;
      if (Low[Li_48] < Ld_52 - Gd_424 * MathAbs(Ld_24 - Ld_16)) return (9);
   }
   return (0);
}

// 030C78103BD28A7748A279D5E1A88588
int f0_2(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_376[Ai_4] == 0.0) return (-1);
   if (Gda_380[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_376[Ai_4] >= Gda_380[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_9(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_9(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMax(f0_9(Ai_0), f0_9(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_9(Li_56);
      if (Ld_60 < CCI_BearishDiv_ResetBelow) return (-6);
      if (Ld_60 > Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 > Ld_68 + Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// C5B84840C2FCA3F94175F113DC29BBC0
int f0_13(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_376[Ai_4] == 0.0) return (-1);
   if (Gda_380[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_376[Ai_4] <= Gda_380[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_9(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_9(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMin(f0_9(Ai_0), f0_9(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_9(Li_56);
      if (Ld_60 > CCI_BullishDiv_ResetAbove) return (-6);
      if (Ld_60 < Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 < Ld_68 - Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// 7D54CB43B58EC5F99A509219EFD146DA
int f0_7(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_384[Ai_4] == 0.0) return (-1);
   if (Gda_388[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_384[Ai_4] >= Gda_388[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_15(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_15(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMax(f0_15(Ai_0), f0_15(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_15(Li_56);
      if (Ld_60 < Mom_BearishDiv_ResetBelow) return (-6);
      if (Ld_60 > Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 > Ld_68 + Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// DBA678833A7BD826396F529BC41A221D
int f0_16(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_384[Ai_4] == 0.0) return (-1);
   if (Gda_388[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_384[Ai_4] <= Gda_388[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_15(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_15(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMin(f0_15(Ai_0), f0_15(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_15(Li_56);
      if (Ld_60 > Mom_BullishDiv_ResetAbove) return (-6);
      if (Ld_60 < Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 < Ld_68 - Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// B4F33EBC05892A2B9A745F003CCF1F81
int f0_12(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_392[Ai_4] == 0.0) return (-1);
   if (Gda_396[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_392[Ai_4] >= Gda_396[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_17(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_17(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMax(f0_17(Ai_0), f0_17(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_17(Li_56);
      if (Ld_60 < StdDev_BearishDiv_ResetBelow) return (-6);
      if (Ld_60 > Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 > Ld_68 + Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// B25B390F4DC42623470D155AD0DB3B4A
int f0_11(int Ai_0, int Ai_4) {
   double Ld_60;
   double Ld_68;
   if (Gda_392[Ai_4] == 0.0) return (-1);
   if (Gda_396[Ai_0] == 0.0) return (2);
   if (Ai_0 - Ai_4 < DivWidthMinBars) return (3);
   if (Ai_0 - Ai_4 > DivWidthMaxBars) return (-4);
   if (Gda_392[Ai_4] >= Gda_396[Ai_0]) return (5);
   int Li_8 = Ai_0;
   double Ld_16 = f0_17(Li_8);
   int Li_12 = Ai_4;
   double Ld_24 = f0_17(Li_12);
   double Ld_32 = (Ld_24 - Ld_16) / (Li_12 - Li_8);
   double Ld_40 = Ld_16 - Ld_32 * Li_8;
   double Ld_48 = MathMax(f0_17(Ai_0), f0_17(Ai_4));
   for (int Li_56 = Ai_4; Li_56 <= Ai_0; Li_56++) {
      Ld_60 = f0_17(Li_56);
      if (Ld_60 < StdDev_BullishDiv_ResetBelow) return (-6);
      if (Ld_60 > Ld_48) return (7);
      Ld_68 = Ld_32 * Li_56 + Ld_40;
      if (Ld_60 > Ld_68 + Gd_424 * MathAbs(Ld_24 - Ld_16)) return (8);
   }
   return (0);
}

// 88D57BF9205BECBACC9B62516B98091A
double f0_9(int Ai_0) {
   double Ld_4;
   Ld_4 = iCCI(NULL, 0, CCIperiod, CCIapplied_price, Ai_0);
   return (Ld_4);
}

// D1288E61F8D99BF1797FD2773FA93E02
double f0_15(int Ai_0) {
   double Ld_4;
   Ld_4 = iMomentum(NULL, 0, Mom_period, Mom_applied_price, Ai_0);
   return (Ld_4);
}

// E00F4FB2B85D530F53840C45DBCCD5EA
double f0_17(int Ai_0) {
   double Ld_4;
   Ld_4 = iStdDev(NULL, 0, StdDev_period, StdDev_ma_shift, StdDev_ma_method, StdDev_applied_price, Ai_0);
   return (Ld_4);
}

// 01BC6F8EFA4202821E95F4FDF6298B30
void f0_1() {
   string Ls_8;
   int Li_0 = ObjectsTotal();
   for (int Li_4 = Li_0 - 1; Li_4 >= 0; Li_4--) {
      Ls_8 = ObjectName(Li_4);
      if (StringFind(Ls_8, Gs_408) == 0) ObjectDelete(Ls_8);
   }
}

// A2ABEAC7B0AF24CA935874201D9815E6
double f0_10(int Ai_0, int Ai_4, int Ai_8, int Ai_12) {
   int Li_16 = 0;
   int Li_20 = 0;
   if (Ai_0 == 1) {
      for (int Li_24 = 1; Li_24 <= Ai_4; Li_24++) {
         if (Ai_12 + Li_24 >= Bars) break;
         if (High[Ai_12 + Li_24] <= High[Ai_12]) Li_16++;
      }
      for (Li_24 = 1; Li_24 <= Ai_8; Li_24++) {
         if (Ai_12 - Li_24 < 0) break;
         if (High[Ai_12 - Li_24] < High[Ai_12]) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (High[Ai_12]);
   }
   if (Ai_0 == 2) {
      for (Li_24 = 1; Li_24 <= Ai_4; Li_24++) {
         if (Ai_12 + Li_24 >= Bars) break;
         if (Low[Ai_12 + Li_24] >= Low[Ai_12]) Li_16++;
      }
      for (Li_24 = 1; Li_24 <= Ai_8; Li_24++) {
         if (Ai_12 - Li_24 < 0) break;
         if (Low[Ai_12 - Li_24] > Low[Ai_12]) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Low[Ai_12]);
   }
   return (0);
}

// E6659B91F1DC6A85F9BA3A3A6543BB77
double f0_18(int Ai_0, int Ai_4, int Ai_8, int Ai_12) {
   double Ld_32;
   double Ld_40;
   int Li_16 = 0;
   int Li_20 = 0;
   double Ld_24 = f0_9(Ai_12);
   if (Ai_0 == 1) {
      for (int Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_9(Ai_12 + Li_48);
         if (Ld_32 <= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_9(Ai_12 - Li_48);
         if (Ld_40 < Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   if (Ai_0 == 2) {
      for (Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_9(Ai_12 + Li_48);
         if (Ld_32 >= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_9(Ai_12 - Li_48);
         if (Ld_40 > Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   return (0);
}

// C9BA3FA392587EABDFA0E151E37CD1E4
double f0_14(int Ai_0, int Ai_4, int Ai_8, int Ai_12) {
   double Ld_32;
   double Ld_40;
   int Li_16 = 0;
   int Li_20 = 0;
   double Ld_24 = f0_15(Ai_12);
   if (Ai_0 == 1) {
      for (int Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_15(Ai_12 + Li_48);
         if (Ld_32 <= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_15(Ai_12 - Li_48);
         if (Ld_40 < Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   if (Ai_0 == 2) {
      for (Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_15(Ai_12 + Li_48);
         if (Ld_32 >= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_15(Ai_12 - Li_48);
         if (Ld_40 > Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   return (0);
}

// 52AAC1BBEEA9FD64288F70F23A853854
double f0_6(int Ai_0, int Ai_4, int Ai_8, int Ai_12) {
   double Ld_32;
   double Ld_40;
   int Li_16 = 0;
   int Li_20 = 0;
   double Ld_24 = f0_17(Ai_12);
   if (Ai_0 == 1) {
      for (int Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_17(Ai_12 + Li_48);
         if (Ld_32 <= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_17(Ai_12 - Li_48);
         if (Ld_40 < Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   if (Ai_0 == 2) {
      for (Li_48 = 1; Li_48 <= Ai_4; Li_48++) {
         if (Ai_12 + Li_48 >= Bars) break;
         Ld_32 = f0_17(Ai_12 + Li_48);
         if (Ld_32 >= Ld_24) Li_16++;
      }
      for (Li_48 = 1; Li_48 <= Ai_8; Li_48++) {
         if (Ai_12 - Li_48 < 0) break;
         Ld_40 = f0_17(Ai_12 - Li_48);
         if (Ld_40 > Ld_24) Li_20++;
      }
      if (Li_16 == Ai_4 && Li_20 == Ai_8) return (Ld_24);
   }
   return (0);
}

// 87C8317F4D1EE57205CB8BAAEB09290B
void f0_8(int &Aia_0[], string As_4, string As_12) {
   string Ls_20;
   int Li_28;
   int Li_32;
   ArrayResize(Aia_0, 0);
   int Li_36 = StringLen(As_4);
   for (int Li_40 = 0; Li_40 < Li_36; Li_40 = Li_28 + 1) {
      Li_28 = StringFind(As_4, As_12, Li_40);
      if (Li_28 == -1) Li_28 = Li_36;
      Ls_20 = StringSubstr(As_4, Li_40, Li_28 - Li_40);
      Ls_20 = StringTrimLeft(Ls_20);
      Ls_20 = StringTrimRight(Ls_20);
      Li_32 = ArraySize(Aia_0);
      ArrayResize(Aia_0, Li_32 + 1);
      Aia_0[Li_32] = StrToInteger(Ls_20);
   }
}

// 252711ADFFEAD90D3F06220616D7D33D
double f0_4() {
   if (AccDigits == 0) {
      if (Digits == 2 || Digits == 4) return (Point);
      if (!(Digits == 3 || Digits == 5)) return (Point);
      return (10.0 * Point);
   }
   if (AccDigits == 4) return (Point);
   if (AccDigits == 5) return (10.0 * Point);
   return (Point);
}

// 46C5CE7EF698E99275A964D39E2DA41B
int f0_5(int Ai_0) {
   if (Ai_0 == 1) return (0);
   if (Ai_0 == 5) return (1);
   if (Ai_0 == 15) return (2);
   if (Ai_0 == 30) return (3);
   if (Ai_0 == 60) return (4);
   if (Ai_0 == 240) return (5);
   if (Ai_0 == 1440) return (6);
   if (Ai_0 == 10080) return (7);
   if (Ai_0 == 43200) return (8);
   return (4);
}
