
#property copyright "Under The GNU General Public License"
#property link      "www.gnu.org"

#property indicator_separate_window
#property indicator_minimum -300.0
#property indicator_maximum 300.0
#property indicator_levelcolor SeaGreen
#property indicator_buffers 8
#property indicator_color1 RoyalBlue
#property indicator_color2 MediumOrchid
#property indicator_color3 DarkGray
#property indicator_color4 Gold
#property indicator_color5 Black
#property indicator_color6 GreenYellow
#property indicator_color7 Lime
#property indicator_color8 Red
#property indicator_width1 2
#property indicator_level1 50.0
#property indicator_width2 2
#property indicator_level2 200.0
#property indicator_width3 2
#property indicator_level3 100.0
#property indicator_width4 2
#property indicator_level4 -100.0
#property indicator_width5 3
#property indicator_level5 -200.0
#property indicator_width6 1
#property indicator_level6 -50.0

extern int TrendCCI_Period = 14;
extern int EntryCCI_Period = 6;
extern int LSMAPeriod = 25;
extern int Trend_period = 5;
extern color Panel_TextColor_Normal = Black;
extern color Background_Panel_Color = C'0x73,0x9D,0x7B';
extern int Tickvalue_Alarm = 10;
extern int Horizontal_Offset = 10;
extern int Vertical_Offset = 0;
extern bool SoundAlert = FALSE;
extern int SoundAlertSecondsLeft = 35;
extern string SoundFile = "alert2.wav";
extern int CountBars = 500;
extern int CCISize = 3;
extern int TCCISize = 1;
extern int TrendSize = 4;
extern int NoTrendSize = 4;
extern int LineSize3 = 0;
double gda_152[];
double gda_156[];
double gda_160[];
double gda_164[];
double gda_168[];
double gda_172[];
double gda_176[];
double gda_180[];
double gda_184[];
int gi_188 = 34;
int gi_192 = 0;
double gda_196[];
double gda_200[];
int gi_204;
int gi_208;
int gi_212;
double gd_216;
double gd_224 = 0.0;
double gd_232 = 0.0;
double gd_240 = 0.0;
double gd_248 = 0.0;
double gd_256 = 0.0;
double gd_264 = 0.0;
double gd_272 = 0.0;
double gd_280 = 0.0;
double gd_288 = 0.0;
double gd_296 = 0.0;
double gd_304 = 0.0;
double gd_312;
double gd_320;
double gd_328;
double gd_336;
double gd_344;
double gd_352;
double gd_368;
double gd_376;
double gd_392;
double gd_400;
string gs_408;
string gs_416;
string gs_424;
string gs_dummy_432;
string gs_440;
string gs_448;
string gs_dummy_456;
string gs_464;
string gs_472;
double gd_480;
double gd_488;
double gd_496;
double gd_504 = 0.0;
double gd_512 = 0.0;
double gd_520 = 0.0;
double gda_528[2][6];
int gi_532 = 0;
int gi_536 = 0;
int gi_540 = 0;
int gi_544 = 0;
int gi_548 = 0;
int gi_552 = 0;

int init() {
   SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, CCISize);
   SetIndexBuffer(4, gda_152);
   SetIndexLabel(4, "TrendCCI");
   SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID, TrendSize);
   SetIndexBuffer(0, gda_160);
   SetIndexLabel(0, NULL);
   SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID, TrendSize);
   SetIndexBuffer(1, gda_164);
   SetIndexLabel(1, NULL);
   SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID, NoTrendSize);
   SetIndexBuffer(2, gda_168);
   SetIndexLabel(2, NULL);
   SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID, NoTrendSize);
   SetIndexBuffer(3, gda_172);
   SetIndexLabel(3, NULL);
   SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, TCCISize);
   SetIndexBuffer(5, gda_156);
   SetIndexLabel(5, "EntryCCI");
   SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, LineSize3);
   SetIndexBuffer(6, gda_184);
   SetIndexLabel(6, NULL);
   SetIndexArrow(6, 59);
   SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, LineSize3);
   SetIndexBuffer(7, gda_180);
   SetIndexArrow(7, 59);
   SetIndexLabel(7, NULL);
   gi_212 = MarketInfo(Symbol(), MODE_DIGITS);
   gd_216 = MarketInfo(Symbol(), MODE_TICKSIZE);
   gd_312 = 0;
   gd_320 = 0;
   gd_328 = 0;
   gd_480 = 0;
   gd_488 = 0;
   gd_496 = 0;
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double ld_20;
   double ld_28;
   double ld_36;
   double ld_44;
   int li_56;
   int li_60;
   double ld_64;
   double ld_72;
   double ld_80;
   double ld_88;
   double ld_96;
   double ld_104;
   double ld_112;
   double ld_120;
   double ld_128;
   double ld_136;
   double ld_144;
   double ld_152;
   double ld_160;
   double ld_168;
   double ld_176;
   string ls_184;
   int li_192;
   double ld_204;
   double ld_212;
   double ld_220;
   double ld_228;
   int li_16 = IndicatorCounted();
   if (li_16 < 0) return (-1);
   if (li_16 > 0) li_16--;
   int li_0 = Bars;
   SetIndexDrawBegin(0, Bars - CountBars);
   SetIndexDrawBegin(1, Bars - CountBars);
   SetIndexDrawBegin(2, Bars - CountBars);
   SetIndexDrawBegin(3, Bars - CountBars);
   SetIndexDrawBegin(4, Bars - CountBars);
   SetIndexDrawBegin(5, Bars - CountBars);
   SetIndexDrawBegin(6, Bars - CountBars);
   SetIndexDrawBegin(7, Bars - CountBars);
   int li_8 = TrendCCI_Period;
   int li_12 = EntryCCI_Period;
   for (int li_4 = li_0; li_4 >= 0; li_4--) {
      gda_168[li_4] = 0;
      gda_164[li_4] = 0;
      gda_172[li_4] = 0;
      gda_160[li_4] = 0;
      gda_176[li_4] = 0;
      gda_152[li_4] = iCCI(NULL, 0, li_8, PRICE_TYPICAL, li_4);
      gda_156[li_4] = iCCI(NULL, 0, li_12, PRICE_TYPICAL, li_4);
      if (gda_152[li_4] > 0.0 && gda_152[li_4 + 1] < 0.0)
         if (gi_208 > Trend_period) gi_204 = 0;
      if (gda_152[li_4] > 0.0) {
         if (gi_204 < Trend_period) {
            gda_168[li_4] = gda_152[li_4];
            gi_204++;
         }
         if (gi_204 == Trend_period) {
            gda_172[li_4] = gda_152[li_4];
            gi_204++;
         }
         if (gi_204 > Trend_period) gda_160[li_4] = gda_152[li_4];
      }
      if (gda_152[li_4] < 0.0 && gda_152[li_4 + 1] > 0.0)
         if (gi_204 > Trend_period) gi_208 = 0;
      if (gda_152[li_4] < 0.0) {
         if (gi_208 < Trend_period) {
            gda_168[li_4] = gda_152[li_4];
            gi_208++;
         }
         if (gi_208 == Trend_period) {
            gda_172[li_4] = gda_152[li_4];
            gi_208++;
         }
         if (gi_208 > Trend_period) gda_164[li_4] = gda_152[li_4];
      }
   }
   if (li_16 >= 0) {
      if (li_16 > 0) li_16--;
      li_16 = Bars - li_16;
      for (int li_52 = 0; li_52 < li_16; li_52++) {
         gda_200[li_52] = -gi_192;
         gda_196[li_52] = -gi_192;
         ld_64 = iMA(NULL, 0, gi_188, 0, MODE_EMA, PRICE_TYPICAL, li_52);
         if (Close[li_52] > ld_64) gda_196[li_52] = EMPTY_VALUE;
         if (Close[li_52] < ld_64) gda_200[li_52] = EMPTY_VALUE;
      }
      li_56 = Bars - LSMAPeriod - 5;
      li_60 = li_56 - LSMAPeriod - 1;
      for (li_52 = li_60; li_52 >= 0; li_52--) {
         ld_20 = 0;
         for (li_4 = LSMAPeriod; li_4 >= 1; li_4--) {
            ld_28 = LSMAPeriod + 1;
            ld_28 /= 3.0;
            ld_36 = 0;
            ld_36 = (li_4 - ld_28) * (Close[LSMAPeriod - li_4 + li_52]);
            ld_20 += ld_36;
         }
         ld_44 = 6.0 * ld_20 / (LSMAPeriod * (LSMAPeriod + 1));
         gda_180[li_52] = 0;
         gda_184[li_52] = 0;
         if (ld_44 > Close[li_52]) gda_184[li_52] = EMPTY_VALUE;
         if (ld_44 < Close[li_52]) gda_180[li_52] = EMPTY_VALUE;
      }
      IndicatorShortName("Woodie CCI Panel");
      ObjectOnce(Background_Panel_Color, 1);
      ld_72 = iClose(Symbol(), Period(), 0);
      ld_80 = iClose(Symbol(), Period(), 1);
      ld_88 = iMA(Symbol(), PERIOD_D1, 1, 0, MODE_SMMA, PRICE_HIGH, 0);
      ld_96 = iMA(Symbol(), PERIOD_D1, 1, 0, MODE_EMA, PRICE_LOW, 0);
      ld_104 = iMA(Symbol(), PERIOD_D1, 1, 0, MODE_SMMA, PRICE_HIGH, 1);
      ld_112 = iMA(Symbol(), PERIOD_D1, 1, 0, MODE_EMA, PRICE_LOW, 1);
      gd_392 = MathRound((ld_88 - ld_72) / gd_216);
      if (gd_392 > 0.0) gs_464 = "+";
      else gs_464 = "";
      gd_400 = MathRound((ld_96 - ld_72) / gd_216);
      if (gd_400 > 0.0) gs_472 = "+";
      else gs_472 = "";
      ObjectCreate("DayHigh", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (MathAbs(gd_392) < Tickvalue_Alarm) ObjectSetText("DayHigh", "DH: " + DoubleToStr(ld_88, gi_212) + " " + gs_464 + DoubleToStr(gd_392, 0), 9, "Verdana", Yellow);
      else ObjectSetText("DayHigh", "DH: " + DoubleToStr(ld_88, gi_212) + " " + gs_464 + DoubleToStr(gd_392, 0), 8, "Verdana", Panel_TextColor_Normal);
      ObjectSet("DayHigh", OBJPROP_CORNER, 1);
      ObjectSet("DayHigh", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("DayHigh", OBJPROP_YDISTANCE, Vertical_Offset + 8);
      ObjectCreate("DayLow", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (MathAbs(gd_400) < Tickvalue_Alarm) ObjectSetText("DayLow", "DL: " + DoubleToStr(ld_96, gi_212) + " " + gs_472 + DoubleToStr(gd_400, 0), 9, "Verdana", Yellow);
      else ObjectSetText("DayLow", "DL: " + DoubleToStr(ld_96, gi_212) + " " + gs_472 + DoubleToStr(gd_400, 0), 8, "Verdana", Panel_TextColor_Normal);
      ObjectSet("DayLow", OBJPROP_CORNER, 1);
      ObjectSet("DayLow", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("DayLow", OBJPROP_YDISTANCE, Vertical_Offset + 250);
      ld_120 = MathRound(gda_152[1] - gda_152[2]);
      ld_128 = MathRound(gda_152[0] - gda_152[1]);
      ObjectCreate("CCIDiff_Last_Bar", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (MathAbs(ld_120) > 0.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial ", Gainsboro);
      if (MathAbs(ld_120) > 10.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial Black", Gainsboro);
      if (MathAbs(ld_120) > 15.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial Black", Lime);
      if (MathAbs(ld_120) > 30.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial Black", Yellow);
      if (MathAbs(ld_120) > 50.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial Black", DarkOrange);
      if (MathAbs(ld_120) > 100.0) ObjectSetText("CCIDiff_Last_Bar", DoubleToStr(ld_120, 0), 12, "Arial Black", Red);
      ObjectSet("CCIDiff_Last_Bar", OBJPROP_CORNER, 1);
      ObjectSet("CCIDiff_Last_Bar", OBJPROP_XDISTANCE, Horizontal_Offset + 64);
      ObjectSet("CCIDiff_Last_Bar", OBJPROP_YDISTANCE, Vertical_Offset + 21);
      ObjectCreate("CCIDiff_Last_Bar_Value", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("CCIDiff_Last_Bar_Value", DoubleToStr(gda_152[1], 2), 10, "Verdana", Panel_TextColor_Normal);
      ObjectSet("CCIDiff_Last_Bar_Value", OBJPROP_CORNER, 1);
      ObjectSet("CCIDiff_Last_Bar_Value", OBJPROP_XDISTANCE, Horizontal_Offset + 64);
      ObjectSet("CCIDiff_Last_Bar_Value", OBJPROP_YDISTANCE, Vertical_Offset + 45);
      ObjectCreate("CCIDiff_Current_Bar", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (MathAbs(ld_128) > 0.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial ", Gainsboro);
      if (MathAbs(ld_128) > 10.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial Black", Gainsboro);
      if (MathAbs(ld_128) > 15.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial Black", Lime);
      if (MathAbs(ld_128) > 30.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial Black", Yellow);
      if (MathAbs(ld_128) > 50.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial Black", DarkOrange);
      if (MathAbs(ld_128) > 100.0) ObjectSetText("CCIDiff_Current_Bar", DoubleToStr(ld_128, 0), 12, "Arial Black", Red);
      ObjectSet("CCIDiff_Current_Bar", OBJPROP_CORNER, 1);
      ObjectSet("CCIDiff_Current_Bar", OBJPROP_XDISTANCE, Horizontal_Offset + 1);
      ObjectSet("CCIDiff_Current_Bar", OBJPROP_YDISTANCE, Vertical_Offset + 21);
      ObjectCreate("CCIDiff_Current_Bar_Value", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("CCIDiff_Current_Bar_Value", DoubleToStr(gda_152[0], 2), 10, "Verdana", Yellow);
      ObjectSet("CCIDiff_Current_Bar_Value", OBJPROP_CORNER, 1);
      ObjectSet("CCIDiff_Current_Bar_Value", OBJPROP_XDISTANCE, Horizontal_Offset + 1);
      ObjectSet("CCIDiff_Current_Bar_Value", OBJPROP_YDISTANCE, Vertical_Offset + 45);
      ObjectCreate("Prev_Close", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("Prev_Close", "PC: " + DoubleToStr(ld_80, gi_212), 7, "Verdana", Panel_TextColor_Normal);
      ObjectSet("Prev_Close", OBJPROP_CORNER, 1);
      ObjectSet("Prev_Close", OBJPROP_XDISTANCE, Horizontal_Offset + 1);
      ObjectSet("Prev_Close", OBJPROP_YDISTANCE, Vertical_Offset + 67);
      ld_136 = iHigh(Symbol(), Period(), 1);
      ld_144 = iHigh(Symbol(), Period(), 0);
      ObjectCreate("High_Previous_Bar", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("High_Previous_Bar", DoubleToStr(ld_136, gi_212) + "  " + DoubleToStr(ld_144, gi_212), 8, "Verdana", YellowGreen);
      ObjectSet("High_Previous_Bar", OBJPROP_CORNER, 1);
      ObjectSet("High_Previous_Bar", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("High_Previous_Bar", OBJPROP_YDISTANCE, Vertical_Offset + 112);
      if (ld_72 > ld_136) {
         ObjectCreate("High_Previous_Bar_Signal", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
         ObjectSetText("High_Previous_Bar_Signal", "__", 59, "Verdana", Lime);
         ObjectSet("High_Previous_Bar_Signal", OBJPROP_CORNER, 1);
         ObjectSet("High_Previous_Bar_Signal", OBJPROP_XDISTANCE, Horizontal_Offset);
         ObjectSet("High_Previous_Bar_Signal", OBJPROP_YDISTANCE, Vertical_Offset + 22);
      }
      if (ld_72 <= ld_136 && ObjectFind("High_Previous_Bar_Signal") == 1) ObjectDelete("High_Previous_Bar_Signal");     
      ObjectCreate("CurrentBar", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("CurrentBar", DoubleToStr(ld_72, gi_212), 15, "Arial Black", Panel_TextColor_Normal);
      ObjectSet("CurrentBar", OBJPROP_CORNER, 1);
      ObjectSet("CurrentBar", OBJPROP_XDISTANCE, Horizontal_Offset + 1);
      ObjectSet("CurrentBar", OBJPROP_YDISTANCE, Vertical_Offset + 124);
      ld_152 = iLow(Symbol(), Period(), 1);
      ld_160 = iLow(Symbol(), Period(), 0);
      ObjectCreate("Low_Previous_Bar", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      ObjectSetText("Low_Previous_Bar", DoubleToStr(ld_152, gi_212) + "  " + DoubleToStr(ld_160, gi_212), 8, "Verdana", FireBrick);
      ObjectSet("Low_Previous_Bar", OBJPROP_CORNER, 1);
      ObjectSet("Low_Previous_Bar", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("Low_Previous_Bar", OBJPROP_YDISTANCE, Vertical_Offset + 150);
      if (ld_72 < ld_152) {
         ObjectCreate("Low_Previous_Bar_Signal", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
         ObjectSetText("Low_Previous_Bar_Signal", "__", 59, "Verdana", Red);
         ObjectSet("Low_Previous_Bar_Signal", OBJPROP_CORNER, 1);
         ObjectSet("Low_Previous_Bar_Signal", OBJPROP_XDISTANCE, Horizontal_Offset);
         ObjectSet("Low_Previous_Bar_Signal", OBJPROP_YDISTANCE, Vertical_Offset + 78);
      }
      if (ld_72 >= ld_152 && ObjectFind("Low_Previous_Bar_Signal") == 1) ObjectDelete("Low_Previous_Bar_Signal");
      ld_168 = MathAbs(MathRound(gda_152[0]));
      if (ld_168 > 200.0) {
         ObjectCreate("HFE_Alert", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
         ObjectSetText("HFE_Alert", "HFE", 14, "Arial Black", Yellow);
         ObjectSet("HFE_Alert", OBJPROP_CORNER, 1);
         ObjectSet("HFE_Alert", OBJPROP_XDISTANCE, Horizontal_Offset + 20);
         ObjectSet("HFE_Alert", OBJPROP_YDISTANCE, Vertical_Offset + 170);
      }
      if (ld_168 < 200.0 && ObjectFind("HFE_Alert") == 1) ObjectDelete("HFE_Alert");
      li_192 = Time[0] + 60 * Period() - TimeCurrent();
      ld_176 = li_192 / 60.0;
      ls_184 = li_192 % 60;
      li_192 = (li_192 - li_192 % 60) / 60;
      if (li_192 > 0 && StringLen(ls_184) < 2) ls_184 = "0" + ls_184;
      else ls_184 = "" + ls_184;
      if (SoundAlert) {
         if (li_192 < 1)
            if (StrToInteger(ls_184) < SoundAlertSecondsLeft) AlertOnce(SoundFile, 1);
      }
      ObjectCreate("time", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (li_192 < 1) ObjectSetText("time", ls_184 + "s", 14, "Arial Black", Yellow);
      else ObjectSetText("time", li_192 + ":" + ls_184 + " Min", 14, "Tahoma", Panel_TextColor_Normal);
      ObjectSet("time", OBJPROP_CORNER, 1);
      ObjectSet("time", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("time", OBJPROP_YDISTANCE, Vertical_Offset + 198);
      if (Period() > PERIOD_D1) {
         Print("Error - Chart period is greater than 1 day.");
         return (-1);
      }
      ArrayCopyRates(gda_528, Symbol(), PERIOD_D1);
      gd_264 = gda_528[1][4];
      gd_248 = gda_528[1][1];
      gd_272 = gda_528[0][1];
      gd_240 = gda_528[1][3];
      gd_256 = gda_528[1][2];
      gd_224 = gda_528[0][3];
      gd_232 = gda_528[0][2];
      gd_520 = gd_224 - gd_232;
      gd_304 = gd_240 - gd_256;
      gd_296 = (gd_240 + gd_256 + gd_264) / 3.0;
      gd_312 = 2.0 * gd_296 - gd_256;
      gd_480 = 2.0 * gd_296 - gd_240;
      gd_320 = gd_296 + (gd_240 - gd_256);
      gd_488 = gd_296 - (gd_240 - gd_256);
      gd_328 = 2.0 * gd_296 + (gd_240 - 2.0 * gd_256);
      gd_496 = 2.0 * gd_296 - (2.0 * gd_240 - gd_256);
      if (gd_304 > 5.0) gd_504 = gd_304;
      else gd_504 = 10000.0 * gd_304;
      if (gd_520 > 5.0) gd_512 = gd_520;
      else gd_512 = 10000.0 * gd_520;
      gd_336 = MathRound((gd_296 - ld_72) / gd_216);
      if (gd_336 > 0.0) gs_408 = "+";
      else gs_408 = "-";
      gd_368 = MathRound((gd_480 - ld_72) / gd_216);
      if (gd_368 > 0.0) gs_440 = "+";
      else gs_440 = "-";
      gd_376 = MathRound((gd_488 - ld_72) / gd_216);
      if (gd_376 > 0.0) gs_448 = "+";
      else gs_448 = "-";
      gd_344 = MathRound((gd_312 - ld_72) / gd_216);
      if (gd_344 > 0.0) gs_416 = "+";
      else gs_416 = "-";
      gd_352 = MathRound((gd_320 - ld_72) / gd_216);
      if (gd_352 > 0.0) gs_424 = "+";
      else gs_424 = "-";
      ld_204 = MathMin(MathAbs(gd_336), MathAbs(gd_368));
      ld_212 = MathMin(MathAbs(gd_368), MathAbs(gd_376));
      ld_220 = MathMin(MathAbs(ld_204), MathAbs(ld_212));
      ObjectCreate("Bottom_Pivot_Point", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (ld_220 == MathAbs(gd_336)) {
         if (MathAbs(gd_336) < Tickvalue_Alarm) ObjectSetText("Bottom_Pivot_Point", "PP " + gs_408 + DoubleToStr(ld_220, 0), 10, "Verdana", Yellow);
         else ObjectSetText("Bottom_Pivot_Point", "PP " + gs_408 + DoubleToStr(ld_220, 0), 8, "Verdana", Panel_TextColor_Normal);
      }
      if (ld_220 == MathAbs(gd_368)) {
         if (MathAbs(gd_368) < Tickvalue_Alarm) ObjectSetText("Bottom_Pivot_Point", "S1 " + gs_440 + DoubleToStr(ld_220, 0), 10, "Verdana", Yellow);
         else ObjectSetText("Bottom_Pivot_Point", "S1 " + gs_440 + DoubleToStr(ld_220, 0), 8, "Verdana", Panel_TextColor_Normal);
      }
      if (ld_220 == MathAbs(gd_376)) {
         if (MathAbs(gd_376) < Tickvalue_Alarm) ObjectSetText("Bottom_Pivot_Point", "S2 " + gs_448 + DoubleToStr(ld_220, 0), 10, "Verdana", Yellow);
         else ObjectSetText("Bottom_Pivot_Point", "S2 " + gs_448 + DoubleToStr(ld_220, 0), 8, "Verdana", Panel_TextColor_Normal);
      }
      ObjectSet("Bottom_Pivot_Point", OBJPROP_CORNER, 1);
      ObjectSet("Bottom_Pivot_Point", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("Bottom_Pivot_Point", OBJPROP_YDISTANCE, Vertical_Offset + 232);
      ld_228 = MathMin(MathAbs(gd_344), MathAbs(gd_352));
      ObjectCreate("Upper_Pivot_Point", OBJ_LABEL, WindowFind("Woodie CCI Panel"), 0, 0);
      if (ld_228 == MathAbs(gd_344)) {
         if (MathAbs(gd_344) < Tickvalue_Alarm) ObjectSetText("Upper_Pivot_Point", "R1 " + gs_416 + DoubleToStr(ld_228, 0), 10, "Verdana", Yellow);
         else ObjectSetText("Upper_Pivot_Point", "R1 " + gs_416 + DoubleToStr(ld_228, 0), 8, "Verdana", Panel_TextColor_Normal);
      }
      if (ld_228 == MathAbs(gd_352)) {
         if (MathAbs(gd_352) < Tickvalue_Alarm) ObjectSetText("Upper_Pivot_Point", "R2 " + gs_424 + DoubleToStr(ld_228, 0), 10, "Verdana", Yellow);
         else ObjectSetText("Upper_Pivot_Point", "R2 " + gs_424 + DoubleToStr(ld_228, 0), 8, "Verdana", Panel_TextColor_Normal);
      }
      ObjectSet("Upper_Pivot_Point", OBJPROP_CORNER, 1);
      ObjectSet("Upper_Pivot_Point", OBJPROP_XDISTANCE, Horizontal_Offset);
      ObjectSet("Upper_Pivot_Point", OBJPROP_YDISTANCE, Vertical_Offset + 90);
   }
   return (0);
}

int AlertOnce(string as_0, int ai_8) {
   switch (ai_8) {
   case 1:
      if (gi_536 == 0 || gi_536 < Bars) {
         PlaySound(as_0);
         gi_536 = Bars;
         return (1);
      }
      break;
   case 2:
      if (gi_540 == 0 || gi_540 < Bars) {
         PlaySound(as_0);
         gi_540 = Bars;
         return (1);
      }
      break;
   case 3:
      if (gi_544 == 0 || gi_544 < Bars) {
         PlaySound(as_0);
         gi_544 = Bars;
         return (1);
      }
      break;
   case 4:
      if (gi_548 == 0 || gi_548 < Bars) {
         PlaySound(as_0);
         gi_548 = Bars;
         return (1);
      }
      break;
   }
   return (0);
}

void ObjectOnce(color ai_0, int ai_4) {
   double ld_12;
   double ld_20;
   int li_28;
   int li_32;
   int li_36;
   int li_8 = ai_4;
   if (li_8 == 1) {
      if (gi_552 == 0 || gi_552 < Bars) {
         if (ObjectFind("Background_Color_Panel") == 1) ObjectDelete("Background_Color_Panel");
         ld_12 = WindowPriceMax(WindowFind("Woodie CCI Panel"));
         ld_20 = WindowPriceMin(WindowFind("Woodie CCI Panel"));
         li_28 = Time[WindowFirstVisibleBar()];
         li_32 = WindowFirstVisibleBar() - WindowBarsPerChart();
         if (li_32 < 0) li_32 = 0;
         li_36 = Time[li_32] + 60 * Period();
         ObjectCreate("Background_Color_Panel", OBJ_RECTANGLE, 1, li_36, ld_12, li_36 + 60 * (30 * Period()), ld_20);
         ObjectSet("Background_Color_Panel", OBJPROP_BACK, TRUE);
         ObjectSet("Background_Color_Panel", OBJPROP_COLOR, ai_0);
         ObjectsRedraw();
         gi_552 = Bars;
         return;
      }
   }
}