Navigation:Home > Content >

THV4_Trix_V1.0-.mq4

Time: 2018-12-23 | Download file:THV4_Trix_V1.0-.mq4

/*
   Generated by ex4-to-mq4 decompiler FREEWARE 4.0.451.7
   Website:  h t T P : // W WW .M e t aQ U O teS .n e T
   E-mail :  S U pp oRt @ Me taqUO Te s.NeT
*/
#property copyright "basic Trix formula by Luis Damiani, all mods by Cobraforex, forbidden to distribute without permission of Cobraforex"
#property link      "www.cobraforex.com"

#property indicator_separate_window
#property indicator_buffers 6
#property indicator_color1 Green
#property indicator_color2 Crimson
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Red

string Gs_unused_76 = "Hey, if you see this message you used either a decompiler or got";
string Gs_unused_84 = "this indi on another ilegal source, my decision is not to share the mq4";
string Gs_unused_92 = "and you should respect that, I will get really pissed off if I see my";
string Gs_unused_100 = "work copied somewhere else.";
string Gs_unused_108 = "I can be your best friend but also you worst enemy, you choose.";
string Gs_unused_116 = " - Cobra -";
extern int Fast_Trix_period = 20;
extern int Slow_Trix_period = 35;
string Gs_unused_132 = "===Trix level colors===";
int Gi_140 = 2237106;
int Gi_144 = 255;
int Gi_148 = 6908265;
int Gi_152 = 25600;
int Gi_156 = 65280;
int Gi_160 = 2;
int Gi_164 = 0;
extern string note2 = "===Cobra Label===";
int G_window_176 = 0;
int Gi_unused_180 = 30583;
int Gi_unused_184 = 30583;
int G_color_188 = Green;
int Gi_192 = 10;
int Gi_196 = 35;
extern color Chart_Color = C'0x23,0x23,0x23';
string Gs_unused_204 = "===OB/OS level colors===";
int G_color_212 = C'0x28,0x00,0x00';
int G_color_216 = C'0x3C,0x00,0x00';
int G_color_220 = C'0x00,0x28,0x00';
int G_color_224 = C'0x00,0x3C,0x00';
extern string note3 = "===== Alert Settings =====";
extern bool MsgAlerts = FALSE;
extern bool SoundAlerts = FALSE;
extern bool eMailAlerts = FALSE;
extern bool Alerts_on_OB_OS = TRUE;
extern bool Alert_On_Trix_Zero_Cross = TRUE;
extern bool Alert_On_Fast_Slow_Trix_Cross = TRUE;
extern bool Alert_On_Fast_Trix_Color_Change = TRUE;
extern string note4 = "===Sound files user defined===";
extern string Sound_On_Fast_Trix_Color_Change = "analyze exit.wav";
extern string AnalyseBuySound = "analyze buy.wav";
extern string AnalyseSellSound = "analyze sell.wav";
extern string Sound_On_Fast_Trix_Zero_Cross = "trixcross.wav";
extern string OSsound = "TrixOS.wav";
extern string OBsound = "TrixOB.wav";
extern string note5 = "=Where to place the alarm labels=";
extern int AnalyzeBoxWindow = 1;
extern int AnalyzeBoxCorner = 1;
extern bool Trix_back = TRUE;
int Gi_unused_340 = 0;
double Gd_344 = 0.0;
extern string note6 = "=How many Trix bars in history=";
extern int Max_Trix_Bars_Back = 750;
int Gi_364 = 0;
int Gi_368 = 0;
double Gd_372 = 1.2;
double G_ibuf_380[];
double G_ibuf_384[];
double G_ibuf_388[];
double G_ibuf_392[];
double G_ibuf_396[];
double G_ibuf_400[];
double Gd_404;
double Gd_412;
int G_bars_420;
string Gs_424;
string Gs_432;
datetime G_time_440;
datetime G_time_444;
extern string note7 = "*** Divergence Settings ***";
extern int Max_Divergence_Bars = 500;
extern bool drawPriceTrendLines = FALSE;
extern bool drawIndicatorTrendLines = FALSE;
extern bool ShowIn1MChart = FALSE;
extern string note8 = "--- Divergence Alert Settings ---";
extern bool EnableAlerts = FALSE;
extern string _Info1 = "";
extern string _Info2 = "------------------------------------";
extern string _Info3 = "SoundAlertOnDivergence only works";
extern string _Info4 = "when EnableAlerts is true.";
extern string _Info5 = "";
extern string _Info6 = "If SoundAlertOnDivergence is true,";
extern string _Info7 = "then sound alert will be generated,";
extern string _Info8 = "otherwise a pop-up alert will be";
extern string _Info9 = "generated.";
extern string _Info10 = "------------------------------------";
extern string _Info11 = "";
extern bool SoundAlertOnDivergence = FALSE;
extern bool EmailDivergenceAlerts = FALSE;
extern string note9 = "--- Divergence Color Settings ---";
extern color BullishDivergenceColor = DodgerBlue;
extern color BearishDivergenceColor = FireBrick;
extern string note10 = "--- Divergence Sound Files ---";
extern string ClassicBullDivSound = "CBullishDiv.wav";
extern string ReverseBullDivSound = "RBullishDiv.wav";
extern string ClassicBearDivSound = "CBearishDiv.wav";
extern string ReverseBearDivSound = "RBearishDiv.wav";
double G_ibuf_636[];
double G_ibuf_640[];
extern color BoxColor = C'0x23,0x23,0x23';
extern color BoxColor2 = C'0x23,0x23,0x23';
extern color BoxColor3 = C'0x23,0x23,0x23';
int G_x_656 = 1;
int G_y_660 = 1;
extern string note11 = "=Market Hours Settings=";
extern int YourBroker_GMT_TimeZone = 0;
extern bool Show_Countdown = TRUE;
extern int Session_Close_Alarm_Minutes = 10;
extern string Trading_Times = "Just change above, no need to change below";
string Gs_unused_692 = "";
extern string London_Settings = "<<< London settings >>>";
extern int LondonOpen_GMT = 7;
extern int LondonClose_GMT = 16;
extern color LondonColor = Orange;
string Gs_unused_720 = "";
extern string NewYork_Settings = "<<< New York settings >>>";
extern int NewYorkOpen_GMT = 13;
extern int NewYorkClose_GMT = 22;
extern color NewYorkColor = Green;
string Gs_unused_748 = "";
extern string Sydney_Settings = "<<< Sydney settings >>>";
extern int SydneyOpen_GMT = 1;
extern int SydneyClose_GMT = 8;
extern color SydneyColor = FireBrick;
string Gs_unused_776 = "";
extern string Tokyo_Settings = "<<< Tokyo settings >>>";
extern int TokyoOpen_GMT = 0;
extern int TokyoClose_GMT = 9;
extern color TokyoColor = C'0x53,0x53,0xFF';
string Gs_unused_804 = "";
string Gs_unused_812 = "<<< Market Session Settings >>>";
int Gi_820 = 5;
int Gi_824 = 5;
int G_fontsize_828 = 9;
string G_fontname_832 = "Arial Bold";
int Gi_840 = 0;
int Gi_844 = 0;
int Gi_848 = 0;
int Gi_852 = 0;
int Gi_856 = 0;
int Gi_860 = 0;
int Gi_864 = 0;
int Gi_868 = 0;
int Gi_872 = 0;
double Gd_unused_876 = 0.0;
string Gs_unused_884 = "Change pRICE font colors automatically? True = Yes";
bool Gi_892 = TRUE;
string Gs_unused_896 = "Default Font Color";
int G_color_904 = Black;
int G_fontsize_908 = 14;
string G_fontname_912 = "Arial Bold";
int Gi_unused_920 = 3;
int Gi_unused_924 = 1;
int Gi_unused_928 = 20;
double G_bid_932;
double Gd_940;
double Gd_948;
bool Gi_956 = FALSE;
bool Gi_960 = FALSE;
bool Gi_964 = FALSE;
bool Gi_968 = FALSE;
extern bool Basic_Info = FALSE;
extern bool Show_Divergence_Arrows = TRUE;
extern bool Show_Price = TRUE;
bool Gi_984 = TRUE;
int G_color_988 = CLR_NONE;
color G_color_992;
color G_color_996;
color G_color_1000;
int G_color_1004 = Orange;
int G_color_1008 = Green;
int G_color_1012 = FireBrick;
int G_color_1016 = C'0x00,0x28,0x00';
int G_color_1020 = C'0x28,0x00,0x00';
int Gi_1024;
extern int CandleToUse = 0;
int G_timeframe_1032 = PERIOD_M5;
extern string Signal = " === THV Signal settings ===";
extern bool Trade_GLD_Oil = FALSE;
extern bool Signal_Sound = TRUE;
extern bool Scalp_mode = TRUE;
int Gi_unused_1056 = 6;
extern bool Use_Coral_1M = TRUE;
extern bool Coral_next_TF = TRUE;
extern bool ChangeChartColor = TRUE;
extern bool Intro = TRUE;
int G_x_1076 = 1;
int G_y_1080 = 1;
string G_text_1084;

int init() {
   Gi_840 = LondonOpen_GMT + YourBroker_GMT_TimeZone;
   if (Gi_840 >= 24) Gi_840 -= 24;
   if (Gi_840 < 0) Gi_840 += 24;
   Gi_844 = LondonClose_GMT + YourBroker_GMT_TimeZone;
   if (Gi_844 >= 24) Gi_844 -= 24;
   if (Gi_844 < 0) Gi_844 += 24;
   Gi_848 = NewYorkOpen_GMT + YourBroker_GMT_TimeZone;
   if (Gi_848 >= 24) Gi_848 -= 24;
   if (Gi_848 < 0) Gi_848 += 24;
   Gi_852 = NewYorkClose_GMT + YourBroker_GMT_TimeZone;
   if (Gi_852 >= 24) Gi_852 -= 24;
   if (Gi_852 < 0) Gi_852 += 24;
   Gi_856 = SydneyOpen_GMT + YourBroker_GMT_TimeZone;
   if (Gi_856 >= 24) Gi_856 -= 24;
   if (Gi_856 < 0) Gi_856 += 24;
   Gi_860 = SydneyClose_GMT + YourBroker_GMT_TimeZone;
   if (Gi_860 >= 24) Gi_860 -= 24;
   if (Gi_860 < 0) Gi_860 += 24;
   Gi_864 = TokyoOpen_GMT + YourBroker_GMT_TimeZone;
   if (Gi_864 >= 24) Gi_864 -= 24;
   if (Gi_864 < 0) Gi_864 += 24;
   Gi_868 = TokyoClose_GMT + YourBroker_GMT_TimeZone;
   if (Gi_868 >= 24) Gi_868 -= 24;
   if (Gi_868 < 0) Gi_868 += 24;
   IndicatorBuffers(8);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, G_ibuf_384);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexBuffer(1, G_ibuf_388);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexBuffer(2, G_ibuf_396);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexBuffer(3, G_ibuf_400);
   if (Show_Divergence_Arrows == TRUE) {
      SetIndexBuffer(4, G_ibuf_636);
      SetIndexBuffer(5, G_ibuf_640);
   }
   SetIndexStyle(4, DRAW_ARROW);
   SetIndexStyle(5, DRAW_ARROW);
   SetIndexArrow(4, 233);
   SetIndexArrow(5, 234);
   SetIndexDrawBegin(5, 9);
   IndicatorDigits(Digits + 2);
   SetIndexBuffer(6, G_ibuf_392);
   SetIndexBuffer(7, G_ibuf_380);
   Gs_424 = "THV4 Trix V" + "1" + "." + "0";
   Gs_432 = Gs_424;
   IndicatorShortName(Gs_424);
   return (0);
}

int deinit() {
   DeleteObjects("Trix_");
   Comment("");
   return (0);
}

void drawLine(string A_name_0, double A_price_8, color A_color_16, int A_style_20) {
   ObjectDelete(A_name_0);
   ObjectCreate(A_name_0, OBJ_HLINE, WindowFind(Gs_424), Time[0], A_price_8);
   ObjectSet(A_name_0, OBJPROP_STYLE, A_style_20);
   ObjectSet(A_name_0, OBJPROP_COLOR, A_color_16);
   ObjectSet(A_name_0, OBJPROP_WIDTH, 1);
   ObjectSet(A_name_0, OBJPROP_BACK, TRUE);
}

void DeleteObjects(string As_0) {
   string name_12;
   for (int Li_8 = ObjectsTotal() - 1; Li_8 >= 0; Li_8--) {
      name_12 = ObjectName(Li_8);
      if (StringFind(name_12, As_0) > -1) ObjectDelete(name_12);
   }
   ObjectDelete("TrixBoxb");
   ObjectDelete("aTrixBox");
   ObjectDelete("cobratext1");
   ObjectDelete("cobratext2");
   ObjectDelete("cobratext3");
   ObjectDelete("Trix_Market_Price_Label");
   ObjectDelete("user_name");
   ObjectDelete("Exit_Label" + Time[0]);
   ObjectDelete("Order_Crossing_Label");
   ObjectDelete("aTrix_Label_back");
   ObjectDelete("aTrix_Label_backa");
   ObjectDelete("aTrix_Label_backb");
   ObjectDelete("aTrix_Label_backc");
   ObjectDelete("aTrix_Label_backd");
   ObjectDelete("aTrix_Label_backe");
   ObjectDelete("THVPair");
   ObjectDelete("THVTF");
   ObjectDelete("CobraCom");
   ObjectDelete("LWMAlabel");
   ObjectDelete("Cloud_Box");
   ObjectDelete("Coral5_Box");
   ObjectDelete("Trix_Box");
   ObjectDelete("Coral_Box");
   ObjectDelete("aChart_Box");
   ObjectDelete("aChart_Boxd");
   ObjectDelete("Coral_Error");
   ObjectDelete("Intro_Box");
   ObjectDelete("xintro");
   ObjectDelete("xintro1");
   ObjectDelete("xintro2");
   ObjectDelete("xintro3");
   ObjectDelete("xintro4");
   ObjectDelete("xintro5");
   ObjectDelete("xintro6");
   ObjectDelete("xintro7");
   ObjectDelete("xintro8");
}

int start() {
   if (Intro == TRUE) {
      ObjectCreate("Intro_Box", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("Intro_Box", "g", 1500, "Webdings");
      ObjectSet("Intro_Box", OBJPROP_CORNER, 1);
      ObjectSet("Intro_Box", OBJPROP_XDISTANCE, 1);
      ObjectSet("Intro_Box", OBJPROP_YDISTANCE, 1);
      ObjectSet("Intro_Box", OBJPROP_COLOR, Black);
      ObjectSet("Intro_Box", OBJPROP_BACK, FALSE);
      ObjectCreate("xintro", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro", "Before you Start:", 16, "Arial Black", FireBrick);
      ObjectSet("xintro", OBJPROP_BACK, FALSE);
      ObjectSet("xintro", OBJPROP_XDISTANCE, 300);
      ObjectSet("xintro", OBJPROP_YDISTANCE, 30);
      ObjectCreate("xintro1", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro1", "Make sure you studied enough about THV trading.", 14, "Arial Black", Gray);
      ObjectSet("xintro1", OBJPROP_BACK, FALSE);
      ObjectSet("xintro1", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro1", OBJPROP_YDISTANCE, 90);
      ObjectCreate("xintro2", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro2", "This indicator gives scalp signals, but you need to have good ", 14, "Arial Black", Gray);
      ObjectSet("xintro2", OBJPROP_BACK, FALSE);
      ObjectSet("xintro2", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro2", OBJPROP_YDISTANCE, 130);
      ObjectCreate("xintro3", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro3", "additional reasons to take a signal trade like bounce from S&R,", 14, "Arial Black", Gray);
      ObjectSet("xintro3", OBJPROP_BACK, FALSE);
      ObjectSet("xintro3", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro3", OBJPROP_YDISTANCE, 170);
      ObjectCreate("xintro4", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro4", "Pivots, Divergence etc.", 14, "Arial Black", Gray);
      ObjectSet("xintro4", OBJPROP_BACK, FALSE);
      ObjectSet("xintro4", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro4", OBJPROP_YDISTANCE, 210);
      ObjectCreate("xintro5", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro5", "Analyse first on your 15M and higher chart to trigger the Trend", 14, "Arial Black", Gray);
      ObjectSet("xintro5", OBJPROP_BACK, FALSE);
      ObjectSet("xintro5", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro5", OBJPROP_YDISTANCE, 270);
      ObjectCreate("xintro6", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro6", "    Practice on demo before you risk you equity, please !!!", 14, "Arial Black", Orange);
      ObjectSet("xintro6", OBJPROP_BACK, FALSE);
      ObjectSet("xintro6", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro6", OBJPROP_YDISTANCE, 340);
      ObjectCreate("xintro7", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro7", "Go to THV4 Trix properties and set \'Intro\' to false to begin.", 14, "Arial Black", Gray);
      ObjectSet("xintro7", OBJPROP_BACK, FALSE);
      ObjectSet("xintro7", OBJPROP_XDISTANCE, 100);
      ObjectSet("xintro7", OBJPROP_YDISTANCE, 430);
      ObjectCreate("xintro8", OBJ_LABEL, 0, 0, 0, 0, 0);
      ObjectSetText("xintro8", "Cobra", 17, "Arial italic", Gray);
      ObjectSet("xintro8", OBJPROP_BACK, FALSE);
      ObjectSet("xintro8", OBJPROP_XDISTANCE, 350);
      ObjectSet("xintro8", OBJPROP_YDISTANCE, 470);
   }
   int Li_0 = 20;
   int Li_4 = 0;
   int count_8 = 0;
   int Li_12 = 0;
   int Li_16 = 0;
   if (Basic_Info) Gd_948 = -70;
   if (isMarketOpen(Gi_840, Gi_844, Time[0])) {
      count_8++;
      Li_4 = (count_8 - 1) * Li_0;
      if (Gi_872 > 1) G_text_1084 = "London        (" + Gi_872 + " hours left)";
      else {
         Li_12 = 60 - TimeMinute(TimeCurrent());
         if (Li_12 > 1) {
            G_text_1084 = "London (" + Li_12 + " minutes left)";
            if (Li_12 <= Session_Close_Alarm_Minutes && (!Gi_956)) {
               Alert("London closing in " + Li_12 + " minutes time.");
               Gi_956 = TRUE;
            }
         } else {
            Li_16 = 60 - TimeSeconds(TimeCurrent());
            if (!Gi_956) {
               Alert("London closing in " + Li_16 + " seconds time.");
               Gi_956 = TRUE;
            }
            G_text_1084 = "London Session (" + Li_16 + " seconds left)";
         }
      }
      if (!Show_Countdown) G_text_1084 = "London";
      ObjectDelete("LondonLabel");
      ObjectCreate("LondonLabel", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("LondonLabel", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("LondonLabel", OBJPROP_XDISTANCE, Gi_820 + 6);
      ObjectSet("LondonLabel", OBJPROP_YDISTANCE, Gi_824 + Li_4 + Gd_948);
      ObjectSet("LondonLabel", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("LondonLabel", G_text_1084, G_fontsize_828, G_fontname_832, LondonColor);
   } else {
      ObjectDelete("LondonLabel");
      Gi_956 = FALSE;
   }
   if (isMarketOpen(Gi_848, Gi_852, Time[0])) {
      count_8++;
      Li_4 = (count_8 - 1) * Li_0;
      if (Gi_872 > 1) G_text_1084 = "New York    (" + Gi_872 + " hours left)";
      else {
         Li_12 = 60 - TimeMinute(TimeCurrent());
         if (Li_12 > 1) {
            G_text_1084 = "New York  (" + Li_12 + " minutes left)";
            if (Li_12 <= Session_Close_Alarm_Minutes && (!Gi_960)) {
               Alert("New York  closing in " + Li_12 + " minutes time.");
               Gi_960 = TRUE;
            }
         } else {
            Li_16 = 60 - TimeSeconds(TimeCurrent());
            if (!Gi_960) {
               Alert("New York  closing in " + Li_16 + " seconds time.");
               Gi_960 = TRUE;
            }
            G_text_1084 = "New York  (" + Li_16 + " seconds left)";
         }
      }
      if (!Show_Countdown) G_text_1084 = "New York";
      ObjectDelete("NewYorkLabel");
      ObjectCreate("NewYorkLabel", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("NewYorkLabel", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("NewYorkLabel", OBJPROP_XDISTANCE, Gi_820 + 6);
      ObjectSet("NewYorkLabel", OBJPROP_YDISTANCE, Gi_824 + Li_4 + Gd_948);
      ObjectSet("NewYorkLabel", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("NewYorkLabel", G_text_1084, G_fontsize_828, G_fontname_832, NewYorkColor);
   } else {
      ObjectDelete("NewYorkLabel");
      Gi_960 = FALSE;
   }
   if (isMarketOpen(Gi_856, Gi_860, Time[0])) {
      count_8++;
      Li_4 = (count_8 - 1) * Li_0;
      if (Gi_872 > 1) G_text_1084 = "Sydney        (" + Gi_872 + " hours left)";
      else {
         Li_12 = 60 - TimeMinute(TimeCurrent());
         if (Li_12 > 1) {
            G_text_1084 = "Sydney  (" + Li_12 + " minutes left)";
            if (Li_12 <= Session_Close_Alarm_Minutes && (!Gi_964)) {
               Alert("Sydney closing in " + Li_12 + " minutes time.");
               Gi_964 = TRUE;
            }
         } else {
            Li_16 = 60 - TimeSeconds(TimeCurrent());
            if (!Gi_964) {
               Alert("Sydney  closing in " + Li_16 + " seconds time.");
               Gi_964 = TRUE;
            }
            G_text_1084 = "Sydney    (" + Li_16 + " seconds left)";
         }
      }
      if (!Show_Countdown) G_text_1084 = "Sydney";
      ObjectDelete("SydneyLabel");
      ObjectCreate("SydneyLabel", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("SydneyLabel", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("SydneyLabel", OBJPROP_XDISTANCE, Gi_820 + 6);
      ObjectSet("SydneyLabel", OBJPROP_YDISTANCE, Gi_824 + Li_4 + Gd_948);
      ObjectSet("SydneyLabel", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("SydneyLabel", G_text_1084, G_fontsize_828, G_fontname_832, SydneyColor);
   } else {
      ObjectDelete("SydneyLabel");
      Gi_964 = FALSE;
   }
   if (isMarketOpen(Gi_864, Gi_868, Time[0])) {
      count_8++;
      Li_4 = (count_8 - 1) * Li_0;
      if (Gi_872 > 1) G_text_1084 = "Tokyo           (" + Gi_872 + " hours left)";
      else {
         Li_12 = 60 - TimeMinute(TimeCurrent());
         if (Li_12 > 1) {
            G_text_1084 = "Tokyo    (" + Li_12 + " minutes left)";
            if (Li_12 <= Session_Close_Alarm_Minutes && (!Gi_968)) {
               Alert("Tokyo  closing in " + Li_12 + " minutes time.");
               Gi_968 = TRUE;
            }
         } else {
            Li_16 = 60 - TimeSeconds(TimeCurrent());
            if (!Gi_968) {
               Alert("Tokyo closing in " + Li_16 + " seconds time.");
               Gi_968 = TRUE;
            }
            G_text_1084 = "Tokyo (" + Li_16 + " seconds left)";
         }
      }
      if (!Show_Countdown) G_text_1084 = "Tokyo";
      ObjectDelete("TokyoLabel");
      ObjectCreate("TokyoLabel", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("TokyoLabel", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("TokyoLabel", OBJPROP_XDISTANCE, Gi_820 + 6);
      ObjectSet("TokyoLabel", OBJPROP_YDISTANCE, Gi_824 + Li_4 + Gd_948);
      ObjectSet("TokyoLabel", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("TokyoLabel", G_text_1084, G_fontsize_828, G_fontname_832, TokyoColor);
   } else {
      ObjectDelete("TokyoLabel");
      Gi_968 = FALSE;
   }
   return (0);
}

int isMarketOpen(int Ai_0, int Ai_4, int Ai_8) {
   int Li_16;
   double Ld_56;
   double Ld_80;
   string Ls_484;
   string text_508;
   string text_516;
   string text_524;
   string text_532;
   string text_540;
   int Li_552;
   double icustom_616;
   double icustom_624;
   double ichimoku_632;
   double ichimoku_640;
   double icustom_648;
   double icustom_656;
   int hour_12 = TimeHour(Ai_8);
   Gi_872 = 0;
   if (hour_12 < Ai_4) Gi_872 = Ai_4 - hour_12;
   if (hour_12 > Ai_4) Gi_872 = Ai_4 + 24 - hour_12;
   if (Ai_0 < Ai_4 && (hour_12 >= Ai_0 && hour_12 < Ai_4)) return (1);
   if (Ai_0 > Ai_4 && hour_12 >= Ai_0 || hour_12 < Ai_4) return (1);
   if (Gi_892 == TRUE) {
      if (Bid > G_bid_932) G_color_904 = LawnGreen;
      if (Bid < G_bid_932) G_color_904 = Red;
      G_bid_932 = Bid;
   }
   string Ls_20 = StringSubstr(Symbol(), 3, 3);
   if (Ls_20 == "JPY") Li_16 = 2;
   else Li_16 = 4;
   string dbl2str_28 = DoubleToStr(Bid, Li_16);
   if (Show_Price == TRUE) {
      ObjectCreate("Trix_Market_Price_Label", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSetText("Trix_Market_Price_Label", dbl2str_28, G_fontsize_908, G_fontname_912, G_color_904);
      ObjectSet("Trix_Market_Price_Label", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Market_Price_Label", OBJPROP_XDISTANCE, Gi_196 + 10);
      ObjectSet("Trix_Market_Price_Label", OBJPROP_YDISTANCE, Gi_192 + 65 + Gd_948);
   }
   int Li_unused_36 = 20;
   int Li_unused_40 = 0;
   int Li_unused_44 = 0;
   int Li_unused_48 = 0;
   int Li_unused_52 = 0;
   if (AnalyzeBoxWindow == 0) G_window_176 = 1;
   ObjectCreate("cobratext1", OBJ_LABEL, G_window_176, 0, 0);
   ObjectSetText("cobratext1", "THV V 4", 14, "Arial Black", DimGray);
   ObjectSet("cobratext1", OBJPROP_CORNER, 1);
   ObjectSet("cobratext1", OBJPROP_XDISTANCE, Gi_196 + 13);
   ObjectSet("cobratext1", OBJPROP_YDISTANCE, Gi_192 + 1);
   ObjectSet("cobratext1", OBJPROP_BACK, FALSE);
   ObjectCreate("cobratext3", OBJ_LABEL, G_window_176, 0, 0);
   ObjectSetText("cobratext3", "© By Cobraforex", 8, "Arial", G_color_188);
   ObjectSet("cobratext3", OBJPROP_CORNER, 1);
   ObjectSet("cobratext3", OBJPROP_XDISTANCE, Gi_196 + 13);
   ObjectSet("cobratext3", OBJPROP_YDISTANCE, Gi_192 + 25);
   ObjectCreate("THVPair", OBJ_LABEL, G_window_176, 0, 0);
   ObjectSet("THVPair", OBJPROP_XDISTANCE, Gi_196 + 10);
   ObjectSet("THVPair", OBJPROP_YDISTANCE, Gi_192 + 50);
   ObjectSetText("THVPair", Symbol(), 13, "Neuropol", Gray);
   ObjectSet("THVPair", OBJPROP_CORNER, 1);
   ObjectSet("THVPair", OBJPROP_BACK, FALSE);
   ObjectCreate("THVTF", OBJ_LABEL, G_window_176, 0, 0);
   ObjectSet("THVTF", OBJPROP_XDISTANCE, Gd_940 + Gi_196 + 18.0);
   ObjectSet("THVTF", OBJPROP_YDISTANCE, Gi_192 + 76);
   ObjectSetText("THVTF", Period() + " M", 14, "Neuropol", Gray);
   ObjectSet("THVTF", OBJPROP_CORNER, 1);
   ObjectSet("THVTF", OBJPROP_BACK, FALSE);
   ObjectCreate("CobraCom", OBJ_LABEL, WindowFind(Gs_432), 0, 0);
   ObjectSet("CobraCom", OBJPROP_XDISTANCE, 280);
   ObjectSet("CobraCom", OBJPROP_YDISTANCE, 145);
   ObjectSetText("CobraCom", "www.cobraforex.com", 9, "Arial Bold", Black);
   ObjectSet("CobraCom", OBJPROP_CORNER, 0);
   ObjectSet("CobraCom", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_back", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_back", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_back", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_back", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_back", OBJPROP_YDISTANCE, G_y_660);
   ObjectSet("aTrix_Label_back", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_back", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_backa", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_backa", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_backa", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_backa", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_backa", OBJPROP_YDISTANCE, G_y_660 + 160);
   ObjectSet("aTrix_Label_backa", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_backa", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_backb", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_backb", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_backb", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_backb", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_backb", OBJPROP_YDISTANCE, G_y_660 + 320);
   ObjectSet("aTrix_Label_backb", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_backb", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_backc", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_backc", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_backc", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_backc", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_backc", OBJPROP_YDISTANCE, G_y_660 + 480);
   ObjectSet("aTrix_Label_backc", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_backc", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_backd", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_backd", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_backd", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_backd", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_backd", OBJPROP_YDISTANCE, G_y_660 + 540);
   ObjectSet("aTrix_Label_backd", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_backd", OBJPROP_BACK, FALSE);
   ObjectCreate("aTrix_Label_backe", OBJ_LABEL, G_window_176, 0, 0, 0, 0);
   ObjectSetText("aTrix_Label_backe", "g", 125, "Webdings");
   ObjectSet("aTrix_Label_backe", OBJPROP_CORNER, 1);
   ObjectSet("aTrix_Label_backe", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("aTrix_Label_backe", OBJPROP_YDISTANCE, G_y_660 + 700);
   ObjectSet("aTrix_Label_backe", OBJPROP_COLOR, Chart_Color);
   ObjectSet("aTrix_Label_backe", OBJPROP_BACK, FALSE);
   if (Period() == PERIOD_M1) Gd_940 = 18;
   if (Period() == PERIOD_M5) Gd_940 = 11;
   if (Period() == PERIOD_M15) Gd_940 = 10;
   if (Period() == PERIOD_M30) Gd_940 = 5;
   if (Period() == PERIOD_H1) Gd_940 = 5;
   if (Period() == PERIOD_H4) Gd_940 = -3;
   if (Period() == PERIOD_D1) Gd_940 = -5;
   if (Period() == PERIOD_W1) Gd_940 = -10;
   if (Period() == PERIOD_MN1) Gd_940 = -15;
   if (Trix_back) {
      ObjectCreate("Trix_backa", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_backa", "g", 160, "Webdings");
      ObjectSet("Trix_backa", OBJPROP_CORNER, 1);
      ObjectSet("Trix_backa", OBJPROP_XDISTANCE, G_x_656);
      ObjectSet("Trix_backa", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_backa", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_backa", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back", "g", 160, "Webdings");
      ObjectSet("Trix_back", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back", OBJPROP_XDISTANCE, G_x_656 + 200);
      ObjectSet("Trix_back", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back1", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back1", "g", 160, "Webdings");
      ObjectSet("Trix_back1", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back1", OBJPROP_XDISTANCE, G_x_656 + 400);
      ObjectSet("Trix_back1", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back1", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back1", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back2", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back2", "g", 160, "Webdings");
      ObjectSet("Trix_back2", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back2", OBJPROP_XDISTANCE, G_x_656 + 600);
      ObjectSet("Trix_back2", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back2", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back2", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back3", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back3", "g", 160, "Webdings");
      ObjectSet("Trix_back3", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back3", OBJPROP_XDISTANCE, G_x_656 + 800);
      ObjectSet("Trix_back3", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back3", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back3", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back4", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back4", "g", 160, "Webdings");
      ObjectSet("Trix_back4", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back4", OBJPROP_XDISTANCE, G_x_656 + 1000);
      ObjectSet("Trix_back4", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back4", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back4", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back5", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back5", "g", 160, "Webdings");
      ObjectSet("Trix_back5", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back5", OBJPROP_XDISTANCE, G_x_656 + 1200);
      ObjectSet("Trix_back5", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back5", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back5", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back6", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back6", "g", 160, "Webdings");
      ObjectSet("Trix_back6", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back6", OBJPROP_XDISTANCE, G_x_656 + 1400);
      ObjectSet("Trix_back6", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back6", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back6", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back7", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back7", "g", 160, "Webdings");
      ObjectSet("Trix_back7", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back7", OBJPROP_XDISTANCE, G_x_656 + 1600);
      ObjectSet("Trix_back7", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back7", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back7", OBJPROP_BACK, TRUE);
      ObjectCreate("Trix_back8", OBJ_LABEL, WindowFind(Gs_432), 0, 0, 0, 0);
      ObjectSetText("Trix_back8", "g", 160, "Webdings");
      ObjectSet("Trix_back8", OBJPROP_CORNER, 1);
      ObjectSet("Trix_back8", OBJPROP_XDISTANCE, G_x_656 + 1800);
      ObjectSet("Trix_back8", OBJPROP_YDISTANCE, G_y_660 - 1);
      ObjectSet("Trix_back8", OBJPROP_COLOR, BoxColor);
      ObjectSet("Trix_back8", OBJPROP_BACK, TRUE);
   }
   if (Gi_984) ObjectCreate("TrixBoxb", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
   ObjectSetText("TrixBoxb", "g", 125, "Webdings");
   ObjectSet("TrixBoxb", OBJPROP_CORNER, AnalyzeBoxCorner);
   ObjectSet("TrixBoxb", OBJPROP_XDISTANCE, G_x_656);
   ObjectSet("TrixBoxb", OBJPROP_YDISTANCE, G_y_660 - 1);
   ObjectSet("TrixBoxb", OBJPROP_COLOR, BoxColor2);
   ObjectSet("TrixBoxb", OBJPROP_BACK, TRUE);
   if (Gi_984) ObjectCreate("aTrixBox", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
   ObjectSetText("aTrixBox", "g", 122, "Webdings", BoxColor3);
   ObjectSet("aTrixBox", OBJPROP_CORNER, AnalyzeBoxCorner);
   ObjectSet("aTrixBox", OBJPROP_XDISTANCE, G_x_656 + 2);
   ObjectSet("aTrixBox", OBJPROP_YDISTANCE, G_y_660 + 1);
   ObjectSet("aTrixBox", OBJPROP_COLOR, BoxColor3);
   ObjectSet("aTrixBox", OBJPROP_BACK, FALSE);
   if (Period() == PERIOD_M1) Ld_56 = 0.00018;
   if (Period() == PERIOD_M5) Ld_56 = 0.00025;
   if (Period() == PERIOD_M15) Ld_56 = 0.0005;
   if (Period() == PERIOD_M30) Ld_56 = 0.001;
   if (Period() == PERIOD_H1) Ld_56 = 0.0009;
   if (Period() == PERIOD_H4) Ld_56 = 0.003;
   if (Period() == PERIOD_D1) Ld_56 = 0.005;
   if (Period() == PERIOD_W1) Ld_56 = 0.08;
   if (Period() == PERIOD_MN1) Ld_56 = 0.015;
   if (Trade_GLD_Oil == TRUE) {
      if (Period() == PERIOD_M1) Ld_56 = 0.0004;
      if (Period() == PERIOD_M5) Ld_56 = 0.0006;
      if (Period() == PERIOD_M15) Ld_56 = 0.0011;
      if (Period() == PERIOD_M30) Ld_56 = 0.002;
      if (Period() == PERIOD_H1) Ld_56 = 0.003;
      if (Period() == PERIOD_H4) Ld_56 = 0.005;
      if (Period() == PERIOD_D1) Ld_56 = 0.016;
      if (Period() == PERIOD_W1) Ld_56 = 0.04;
      if (Period() == PERIOD_MN1) Ld_56 = 0.08;
   }
   if (Gd_344 > 0.0) Ld_56 = Gd_344;
   double Ld_64 = Ld_56;
   double Ld_72 = -1.0 * Ld_56;
   drawLine("Trix_" + "OVERBOUGHT", Ld_64, Gi_140, Gi_160);
   drawLine("Trix_" + "ZERO_LINE", 0, Gi_148, Gi_160);
   drawLine("Trix_" + "OVERSOLD", Ld_72, Gi_152, Gi_160);
   if (Period() == PERIOD_M1) Ld_80 = 0.0003;
   if (Period() == PERIOD_M5) Ld_80 = 0.0005;
   if (Period() == PERIOD_M15) Ld_80 = 0.0008;
   if (Period() == PERIOD_M30) Ld_80 = 0.0015;
   if (Period() == PERIOD_H1) Ld_80 = 0.0013;
   if (Period() == PERIOD_H4) Ld_80 = 0.004;
   if (Period() == PERIOD_D1) Ld_80 = 0.006;
   if (Period() == PERIOD_W1) Ld_80 = 0.1;
   if (Period() == PERIOD_MN1) Ld_80 = 0.02;
   if (Trade_GLD_Oil == TRUE) {
      if (Period() == PERIOD_M1) Ld_80 = 0.0008;
      if (Period() == PERIOD_M5) Ld_80 = 0.001;
      if (Period() == PERIOD_M15) Ld_80 = 0.002;
      if (Period() == PERIOD_M30) Ld_80 = 0.003;
      if (Period() == PERIOD_H1) Ld_80 = 0.005;
      if (Period() == PERIOD_H4) Ld_80 = 0.008;
      if (Period() == PERIOD_D1) Ld_80 = 0.024;
      if (Period() == PERIOD_W1) Ld_80 = 0.06;
      if (Period() == PERIOD_MN1) Ld_80 = 0.1;
      ObjectDelete("Trix_WTI_GLD");
      ObjectCreate("Trix_WTI_GLD", OBJ_LABEL, 0, 0, 0);
      ObjectSet("Trix_WTI_GLD", OBJPROP_CORNER, 1);
      ObjectSet("Trix_WTI_GLD", OBJPROP_XDISTANCE, 25);
      ObjectSet("Trix_WTI_GLD", OBJPROP_YDISTANCE, 10);
      ObjectSet("Trix_WTI_GLD", OBJPROP_ANGLE, 90);
      ObjectSet("Trix_WTI_GLD", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("Trix_WTI_GLD", "OIL - GLD only", 10, "Arial Bold", LimeGreen);
   }
   if (Gd_344 > 0.0) Ld_80 = Gd_344;
   double Ld_88 = Ld_80;
   double Ld_96 = -1.0 * Ld_80;
   drawLine("Trix_" + "EXTREME_OVERBOUGHT", Ld_88, Gi_144, Gi_164);
   drawLine("Trix_" + "EXTREME_OVERSOLD", Ld_96, Gi_156, Gi_164);
   int Li_104 = 0;
   double Ld_108 = 0;
   double Ld_116 = 0;
   double Ld_unused_124 = 0;
   double Ld_132 = 0;
   double Ld_140 = 0;
   double Ld_148 = 0;
   double Ld_156 = 0;
   double Ld_164 = 0;
   double Ld_172 = 0;
   double Ld_180 = 0;
   double Ld_188 = 0;
   double Ld_196 = 0;
   double Ld_204 = 0;
   double Ld_212 = 0;
   double Ld_220 = 0;
   double Ld_228 = 0;
   double Ld_236 = 0;
   double Ld_244 = 0;
   double Ld_252 = 0;
   double Ld_260 = 0;
   double Ld_268 = 0;
   double Ld_276 = 0;
   double Ld_284 = 0;
   double Ld_292 = 0;
   double Ld_300 = 0;
   double Ld_308 = 0;
   double Ld_316 = 0;
   double Ld_324 = 0;
   double Ld_332 = 0;
   double Ld_340 = 0;
   double Ld_348 = 0;
   double Ld_356 = 0;
   double Ld_364 = 0;
   double Ld_372 = 0;
   double Ld_380 = 0;
   double Ld_388 = 0;
   double Ld_396 = 0;
   double Ld_404 = 0;
   double Ld_412 = 0;
   double Ld_420 = 0;
   double Ld_428 = 1;
   double Ld_436 = 0;
   double bars_444 = 0;
   double Ld_452 = 0;
   double Ld_460 = 0;
   double Ld_468 = 0;
   double Ld_476 = 0;
   string Ls_492 = "nonono";
   int ind_counted_500 = IndicatorCounted();
   bool Li_504 = TRUE;
   Ld_460 = Max_Trix_Bars_Back + Fast_Trix_period + Gi_364 + Slow_Trix_period + Gi_368 + Gd_372;
   if (Ld_460 == Ld_468 && Ls_492 == Symbol() && Ld_476 == Time[4] - Time[5] && Bars - bars_444 < 2.0) Ld_452 = Bars - bars_444;
   else Ld_452 = -1;
   Ls_492 = Symbol();
   Ld_476 = Time[4] - Time[5];
   bars_444 = Bars;
   Ld_468 = Ld_460;
   if (Ld_452 == 1.0 || Ld_452 == 0.0) Ld_436 = Ld_452;
   else Ld_428 = 1;
   if (!ShowIn1MChart && Period() == PERIOD_M1) Li_504 = FALSE;
   if (Ld_428 == 1.0) {
      Ld_412 = Gd_372 * Gd_372;
      Ld_420 = Ld_412 * Gd_372;
      Ld_196 = -Ld_420;
      Ld_204 = 3.0 * (Ld_412 + Ld_420);
      Ld_212 = -3.0 * (2.0 * Ld_412 + Gd_372 + Ld_420);
      Ld_220 = 3.0 * Gd_372 + 1.0 + Ld_420 + 3.0 * Ld_412;
      Ld_372 = Fast_Trix_period;
      if (Ld_372 < 1.0) Ld_372 = 1;
      Ld_372 = (Ld_372 - 1.0) / 2.0 + 1.0;
      Ld_380 = 2 / (Ld_372 + 1.0);
      Ld_388 = 1 - Ld_380;
      Ld_372 = Slow_Trix_period;
      if (Ld_372 < 1.0) Ld_372 = 1;
      Ld_372 = (Ld_372 - 1.0) / 2.0 + 1.0;
      Ld_396 = 2 / (Ld_372 + 1.0);
      Ld_404 = 1 - Ld_396;
      G_ibuf_380[Max_Trix_Bars_Back - 1] = 0;
      Ld_324 = 0;
      Ld_332 = 0;
      Ld_340 = 0;
      Ld_348 = 0;
      Ld_356 = 0;
      Ld_364 = 0;
      G_ibuf_392[Max_Trix_Bars_Back - 1] = 0;
      Ld_228 = 0;
      Ld_236 = 0;
      Ld_244 = 0;
      Ld_252 = 0;
      Ld_260 = 0;
      Ld_268 = 0;
      Ld_436 = Max_Trix_Bars_Back - 2;
      Ld_428 = 0;
   }
   if (Gd_412 > Ld_64) BoxColor = G_color_212;
   if (Gd_412 < Ld_64 && Gd_412 > Ld_72) BoxColor = C'0x23,0x23,0x23';
   if (Gd_412 < Ld_72) BoxColor = G_color_220;
   if (Gd_412 > Ld_88) BoxColor = G_color_216;
   if (Gd_412 < Ld_96) BoxColor = G_color_224;
   for (Li_104 = Ld_436; Li_104 >= 0; Li_104--) {
      if (Gi_364 == 1) Ld_276 = Ld_380 * Open[Li_104] + Ld_388 * Ld_324;
      else Ld_276 = Ld_380 * Close[Li_104] + Ld_388 * Ld_324;
      Ld_284 = Ld_380 * Ld_276 + Ld_388 * Ld_332;
      Ld_292 = Ld_380 * Ld_284 + Ld_388 * Ld_340;
      Ld_300 = Ld_380 * Ld_292 + Ld_388 * Ld_348;
      Ld_308 = Ld_380 * Ld_300 + Ld_388 * Ld_356;
      Ld_316 = Ld_380 * Ld_308 + Ld_388 * Ld_364;
      Ld_108 = Ld_196 * Ld_316 + Ld_204 * Ld_308 + Ld_212 * Ld_300 + Ld_220 * Ld_292;
      if ((Ld_452 == 1.0 && Li_104 == 1) || Ld_452 == -1.0) {
         Ld_324 = Ld_276;
         Ld_332 = Ld_284;
         Ld_340 = Ld_292;
         Ld_348 = Ld_300;
         Ld_356 = Ld_308;
         Ld_364 = Ld_316;
      }
      Ld_148 = Ld_396 * Close[Li_104] + Ld_404 * Ld_228;
      Ld_156 = Ld_396 * Ld_148 + Ld_404 * Ld_236;
      Ld_164 = Ld_396 * Ld_156 + Ld_404 * Ld_244;
      Ld_172 = Ld_396 * Ld_164 + Ld_404 * Ld_252;
      Ld_180 = Ld_396 * Ld_172 + Ld_404 * Ld_260;
      Ld_188 = Ld_396 * Ld_180 + Ld_404 * Ld_268;
      Ld_132 = Ld_196 * Ld_188 + Ld_204 * Ld_180 + Ld_212 * Ld_172 + Ld_220 * Ld_164;
      if (Gi_368 == 1) {
         G_ibuf_380[Li_104] = (Ld_108 - Ld_116) / Ld_116 + (Ld_132 - Ld_140) / Ld_140;
         G_ibuf_392[Li_104] = (Ld_108 - Ld_116) / Ld_116;
         Gd_412 = G_ibuf_392[Li_104];
      } else {
         if (Ld_140 > 0.0 && Ld_116 > 0.0) {
            G_ibuf_380[Li_104] = (Ld_132 - Ld_140) / Ld_140;
            G_ibuf_392[Li_104] = (Ld_108 - Ld_116) / Ld_116;
            Gd_412 = G_ibuf_392[Li_104];
         }
      }
      G_ibuf_384[Li_104] = EMPTY_VALUE;
      G_ibuf_388[Li_104] = EMPTY_VALUE;
      if (G_ibuf_380[Li_104 + 1] < G_ibuf_380[Li_104]) {
         if (G_ibuf_384[Li_104 + 1] == EMPTY_VALUE) G_ibuf_384[Li_104 + 1] = G_ibuf_380[Li_104 + 1];
         G_ibuf_384[Li_104] = G_ibuf_380[Li_104];
      } else {
         if (G_ibuf_380[Li_104 + 1] > G_ibuf_380[Li_104]) {
            if (G_ibuf_388[Li_104 + 1] == EMPTY_VALUE) G_ibuf_388[Li_104 + 1] = G_ibuf_380[Li_104 + 1];
            G_ibuf_388[Li_104] = G_ibuf_380[Li_104];
         }
      }
      G_ibuf_396[Li_104] = EMPTY_VALUE;
      G_ibuf_400[Li_104] = EMPTY_VALUE;
      if (G_ibuf_392[Li_104 + 1] < G_ibuf_392[Li_104]) {
         if (G_ibuf_396[Li_104 + 1] == EMPTY_VALUE) G_ibuf_396[Li_104 + 1] = G_ibuf_392[Li_104 + 1];
         G_ibuf_396[Li_104] = G_ibuf_392[Li_104];
      } else {
         if (G_ibuf_392[Li_104 + 1] > G_ibuf_392[Li_104]) {
            if (G_ibuf_400[Li_104 + 1] == EMPTY_VALUE) G_ibuf_400[Li_104 + 1] = G_ibuf_392[Li_104 + 1];
            G_ibuf_400[Li_104] = G_ibuf_392[Li_104];
         }
      }
      if ((Ld_452 == 1.0 && Li_104 == 1) || Ld_452 == -1.0) {
         Ld_116 = Ld_108;
         Ld_140 = Ld_132;
         Ld_228 = Ld_148;
         Ld_236 = Ld_156;
         Ld_244 = Ld_164;
         Ld_252 = Ld_172;
         Ld_260 = Ld_180;
         Ld_268 = Ld_188;
      }
      if (Li_104 <= Max_Divergence_Bars && Li_504) {
         CatchBullishDivergence(Li_104 + 2);
         CatchBearishDivergence(Li_104 + 2);
      }
   }
   if (Gd_412 > Ld_64) BoxColor = C'0x32,0x00,0x00';
   if (Gd_412 < Ld_64 && Gd_412 > Ld_72) BoxColor = C'0x23,0x23,0x23';
   if (Gd_412 < Ld_72) BoxColor = C'0x00,0x32,0x00';
   if (Gd_412 > Ld_88) BoxColor = C'0x50,0x00,0x00';
   if (Gd_412 < Ld_96) BoxColor = C'0x00,0x50,0x00';
   if (Gd_412 > Ld_64 && G_bars_420 < Bars) {
      if (Gi_984) text_516 = "Overbought";
      ObjectDelete("Trix_OB");
      ObjectCreate("Trix_OB", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_OB", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_OB", OBJPROP_XDISTANCE, 160);
      ObjectSet("Trix_OB", OBJPROP_YDISTANCE, Gd_948 + 85.0);
      ObjectSet("Trix_OB", OBJPROP_ANGLE, 90);
      ObjectSet("Trix_OB", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("Trix_OB", text_516, 9, "Arial Bold", LimeGreen);
      G_bars_420 = Bars;
      if (Alerts_on_OB_OS) PlaySound(OBsound);
   }
   if (Gd_412 < Ld_72 && G_bars_420 < Bars) {
      if (Gi_984) text_516 = "OverSold";
      ObjectDelete("Trix_OB");
      ObjectCreate("Trix_OB", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_OB", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_OB", OBJPROP_XDISTANCE, 160);
      ObjectSet("Trix_OB", OBJPROP_YDISTANCE, Gd_948 + 85.0);
      ObjectSet("Trix_OB", OBJPROP_ANGLE, 90);
      ObjectSet("Trix_OB", OBJPROP_COLOR, Red);
      ObjectSetText("Trix_OB", text_516, 9, "Arial Bold", Red);
      G_bars_420 = Bars;
      if (Alerts_on_OB_OS) PlaySound(OSsound);
   }
   if (Gd_412 > Ld_72 && Gd_412 < Ld_64)
      if (Gi_984) ObjectDelete("Trix_OB");
   if (Gd_412 < Ld_96)
      if (Gi_984) ObjectDelete("Trix_OB");
   if (Gd_412 > Ld_88)
      if (Gi_984) ObjectDelete("Trix_OB");
   if (Gd_412 > Ld_88) {
      if (Gi_984) text_540 = "Extreme Overbought";
      ObjectDelete("Trix_OB-E");
      ObjectCreate("Trix_OB-E", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_OB-E", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_OB-E", OBJPROP_XDISTANCE, 160);
      ObjectSet("Trix_OB-E", OBJPROP_YDISTANCE, Gd_948 + 75.0);
      ObjectSet("Trix_OB-E", OBJPROP_ANGLE, 90);
      ObjectSet("Trix_OB-E", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("Trix_OB-E", text_540, 9, "Arial Bold", LimeGreen);
   }
   if (Gd_412 < Ld_96) {
      if (Gi_984) text_540 = "Extreme OverSold";
      ObjectDelete("Trix_OB-E");
      ObjectCreate("Trix_OB-E", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_OB-E", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_OB-E", OBJPROP_XDISTANCE, 160);
      ObjectSet("Trix_OB-E", OBJPROP_YDISTANCE, Gd_948 + 48.0);
      ObjectSet("Trix_OB-E", OBJPROP_COLOR, Red);
      ObjectSet("Trix_OB-E", OBJPROP_ANGLE, 90);
      ObjectSetText("Trix_OB-E", text_540, 9, "Arial Bold", Red);
   }
   if (Gd_412 > Ld_96 && Gd_412 < Ld_88)
      if (Gi_984) ObjectDelete("Trix_OB-E");
   if (Gd_412 > 0.0) {
      if (Gi_984) text_508 = "Bull";
      ObjectDelete("Trix_Crossing_Label");
      ObjectCreate("Trix_Crossing_Label", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_Crossing_Label", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Crossing_Label", OBJPROP_XDISTANCE, 12);
      ObjectSet("Trix_Crossing_Label", OBJPROP_YDISTANCE, Gd_948 + 95.0);
      ObjectSet("Trix_Crossing_Label", OBJPROP_COLOR, LimeGreen);
      ObjectSetText("Trix_Crossing_Label", text_508, 9, "Arial Bold", LimeGreen);
   }
   if (Gd_412 < 0.0) {
      if (Gi_984) text_508 = "Bear";
      ObjectDelete("Trix_Crossing_Label");
      ObjectCreate("Trix_Crossing_Label", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_Crossing_Label", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Crossing_Label", OBJPROP_XDISTANCE, 10);
      ObjectSet("Trix_Crossing_Label", OBJPROP_YDISTANCE, Gd_948 + 95.0);
      ObjectSet("Trix_Crossing_Label", OBJPROP_COLOR, Red);
      ObjectSetText("Trix_Crossing_Label", text_508, 9, "Arial Bold", Red);
   }
   if (Gd_404 < 0.0 && Gd_412 > 0.0) {
      if (Alert_On_Trix_Zero_Cross)
         if (SoundAlerts) PlaySound(Sound_On_Fast_Trix_Zero_Cross);
   }
   Gd_404 = Gd_412;
   if (Gi_984) {
      ObjectDelete("Trix_Trend");
      ObjectCreate("Trix_Trend", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_Trend", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Trend", OBJPROP_XDISTANCE, 70);
      ObjectSet("Trix_Trend", OBJPROP_YDISTANCE, Gd_948 + 95.0);
      ObjectSetText("Trix_Trend", "Trix Cross  :", 9, "Arial", Gray);
   }
   if (Gi_984) {
      ObjectDelete("Trix_Option");
      ObjectCreate("Trix_Option", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_Option", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Option", OBJPROP_XDISTANCE, 70);
      ObjectSet("Trix_Option", OBJPROP_YDISTANCE, Gd_948 + 110.0);
      ObjectSetText("Trix_Option", "Option        :", 9, "Arial", Gray);
   }
   if (Gi_984) {
      ObjectDelete("Trix_Action");
      ObjectCreate("Trix_Action", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_Action", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_Action", OBJPROP_XDISTANCE, 70);
      ObjectSet("Trix_Action", OBJPROP_YDISTANCE, Gd_948 + 125.0);
      ObjectSetText("Trix_Action", "Action         :", 9, "Arial", Gray);
   }
   string Ls_unused_568 = "  ";
   string Ls_unused_576 = "  ";
   int Li_564 = Time[0] + 60 * Period() - TimeCurrent();
   int Li_560 = Li_564 % 60;
   string Ls_584 = Li_560;
   if (Li_560 < 10) Ls_584 = "0" + Ls_584;
   int Li_556 = (Li_564 - Li_564 % 60) / 60;
   for (int count_548 = 0; count_548 < 24; count_548++) {
      if (Li_556 >= 60) {
         Li_556 -= 60;
         Li_552++;
      }
   }
   string Ls_592 = Li_556;
   if (Li_556 < 10) Ls_592 = "0" + Ls_592;
   string Ls_600 = Li_552;
   if (Li_552 < 10) Ls_600 = "0" + Ls_600;
   string text_608 = Ls_592 + ":" + Ls_584;
   if (Li_552 >= 1) text_608 = Ls_600 + ":" + Ls_592 + ":" + Ls_584;
   if (Scalp_mode) {
      icustom_616 = iCustom(NULL, 0, "THV4 Trix called", 2, CandleToUse);
      icustom_624 = iCustom(NULL, 0, "THV4 Trix called", 3, CandleToUse);
      if (icustom_624 == EMPTY_VALUE) G_color_1004 = G_color_1008;
      if (icustom_616 == EMPTY_VALUE) G_color_1004 = G_color_1012;
      ObjectDelete("Trix_Box");
      ObjectCreate("Trix_Box", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
      ObjectSetText("Trix_Box", "0", 36, "Webdings");
      ObjectSet("Trix_Box", OBJPROP_CORNER, 1);
      ObjectSet("Trix_Box", OBJPROP_XDISTANCE, G_x_1076 + 5);
      ObjectSet("Trix_Box", OBJPROP_YDISTANCE, G_y_1080 + 26 + Gd_948);
      ObjectSet("Trix_Box", OBJPROP_COLOR, G_color_1004);
      ObjectSet("Trix_Box", OBJPROP_BACK, FALSE);
      ichimoku_632 = iIchimoku(NULL, 0, 2, 5, 8, MODE_SENKOUSPANA, CandleToUse);
      ichimoku_640 = iIchimoku(NULL, 0, 2, 5, 8, MODE_SENKOUSPANB, CandleToUse);
      if (Bid < ichimoku_632) G_color_1000 = G_color_1012;
      if (Bid > ichimoku_640) G_color_1000 = G_color_1008;
      if (Bid < ichimoku_632 && Bid > ichimoku_640) G_color_1000 = Orange;
      ObjectDelete("Cloud_Box");
      ObjectCreate("Cloud_Box", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
      ObjectSetText("Cloud_Box", "0", 36, "Webdings");
      ObjectSet("Cloud_Box", OBJPROP_CORNER, 1);
      ObjectSet("Cloud_Box", OBJPROP_XDISTANCE, G_x_1076 + 35);
      ObjectSet("Cloud_Box", OBJPROP_YDISTANCE, G_y_1080 + 26 + Gd_948);
      ObjectSet("Cloud_Box", OBJPROP_COLOR, G_color_1000);
      ObjectSet("Cloud_Box", OBJPROP_BACK, FALSE);
      icustom_648 = iCustom(NULL, 0, "THV3 Coral", 0, CandleToUse);
      icustom_656 = iCustom(NULL, G_timeframe_1032, "THV3 Coral", 0, CandleToUse);
      if (Coral_next_TF == TRUE) {
         if (Period() == PERIOD_M1) G_timeframe_1032 = 5;
         if (Period() == PERIOD_M5) G_timeframe_1032 = 15;
         if (Period() == PERIOD_M15) G_timeframe_1032 = 30;
         if (Period() == PERIOD_M30) G_timeframe_1032 = 60;
         if (Period() == PERIOD_H1) G_timeframe_1032 = 240;
         if (Period() == PERIOD_H4) G_timeframe_1032 = 1440;
         if (Period() == PERIOD_D1) G_timeframe_1032 = -10080;
         if (Period() == PERIOD_W1) G_timeframe_1032 = 43200;
         if (Period() == PERIOD_MN1) {
            G_timeframe_1032 = 43200;
            ObjectCreate("Coral_Error", OBJ_LABEL, 0, 0, 0);
            ObjectSet("Coral_Error", OBJPROP_CORNER, 0);
            ObjectSet("Coral_Error", OBJPROP_XDISTANCE, 10);
            ObjectSet("Coral_Error", OBJPROP_YDISTANCE, Gd_948 + 30.0);
            ObjectSetText("Coral_Error", "Coral Error, no higher period available ==> Monthly applied", 12, "Arial Bold", Red);
         }
      }
      if (Bid >= icustom_656) G_color_992 = G_color_1008;
      if (Bid <= icustom_656) G_color_992 = G_color_1012;
      ObjectDelete("Coral5_Box");
      ObjectCreate("Coral5_Box", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
      ObjectSetText("Coral5_Box", "0", 36, "Webdings");
      ObjectSet("Coral5_Box", OBJPROP_CORNER, 1);
      ObjectSet("Coral5_Box", OBJPROP_XDISTANCE, G_x_1076 + 95);
      ObjectSet("Coral5_Box", OBJPROP_YDISTANCE, G_y_1080 + 26 + Gd_948);
      ObjectSet("Coral5_Box", OBJPROP_COLOR, G_color_992);
      ObjectSet("Coral5_Box", OBJPROP_BACK, FALSE);
      if (Use_Coral_1M == TRUE) {
         if (Bid > icustom_648) G_color_996 = G_color_1008;
         if (Bid < icustom_648) G_color_996 = G_color_1012;
         ObjectDelete("Coral_Box");
         ObjectCreate("Coral_Box", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
         ObjectSetText("Coral_Box", "0", 36, "Webdings");
         ObjectSet("Coral_Box", OBJPROP_CORNER, 1);
         ObjectSet("Coral_Box", OBJPROP_XDISTANCE, G_x_1076 + 65);
         ObjectSet("Coral_Box", OBJPROP_YDISTANCE, G_y_1080 + 26 + Gd_948);
         ObjectSet("Coral_Box", OBJPROP_COLOR, G_color_996);
         ObjectSet("Coral_Box", OBJPROP_BACK, FALSE);
      }
      if (ChangeChartColor == TRUE && Use_Coral_1M == TRUE) {
         if (Bid > ichimoku_640 && Bid >= icustom_656 && Bid >= icustom_648 && icustom_624 == EMPTY_VALUE && Gd_412 < Ld_64) {
            G_color_988 = G_color_1016;
            ObjectCreate("aChart_Box", OBJ_LABEL, 0, 0, 0, 0, 0);
            ObjectSetText("aChart_Box", "g", 1500, "Webdings");
            ObjectSet("aChart_Box", OBJPROP_CORNER, 1);
            ObjectSet("aChart_Box", OBJPROP_XDISTANCE, G_x_1076);
            ObjectSet("aChart_Box", OBJPROP_YDISTANCE, G_y_1080);
            ObjectSet("aChart_Box", OBJPROP_COLOR, G_color_1016);
            ObjectSet("aChart_Box", OBJPROP_BACK, TRUE);
         } else ObjectDelete("aChart_Box");
         if (Bid < ichimoku_640 && Bid <= icustom_656 && Bid <= icustom_648 && icustom_616 == EMPTY_VALUE && Gd_412 > Ld_72) {
            G_color_988 = G_color_1020;
            ObjectCreate("aChart_Boxd", OBJ_LABEL, 0, 0, 0, 0, 0);
            ObjectSetText("aChart_Boxd", "g", 1500, "Webdings");
            ObjectSet("aChart_Boxd", OBJPROP_CORNER, 1);
            ObjectSet("aChart_Boxd", OBJPROP_XDISTANCE, G_x_1076);
            ObjectSet("aChart_Boxd", OBJPROP_YDISTANCE, G_y_1080);
            ObjectSet("aChart_Boxd", OBJPROP_COLOR, G_color_1020);
            ObjectSet("aChart_Boxd", OBJPROP_BACK, TRUE);
         } else ObjectDelete("aChart_Boxd");
      }
   }
   if (Signal_Sound == TRUE) {
      if (G_color_988 == G_color_1020 && Gi_1024 != -1) {
         Gi_1024 = -1;
         PlaySound("wait.wav");
      }
      if (G_color_988 == G_color_1016 && Gi_1024 != -1) {
         Gi_1024 = -1;
         PlaySound("wait.wav");
      }
      if (ChangeChartColor == TRUE && Use_Coral_1M == FALSE) {
         ObjectDelete("Coral_Box");
         ObjectCreate("Coral_Box", OBJ_LABEL, AnalyzeBoxWindow, 0, 0, 0, 0);
         ObjectSetText("Coral_Box", "r", 12, "Webdings");
         ObjectSet("Coral_Box", OBJPROP_CORNER, 1);
         ObjectSet("Coral_Box", OBJPROP_XDISTANCE, G_x_1076 + 80);
         ObjectSet("Coral_Box", OBJPROP_YDISTANCE, G_y_1080 + 56 + Gd_948);
         ObjectSet("Coral_Box", OBJPROP_COLOR, FireBrick);
         ObjectSet("Coral_Box", OBJPROP_BACK, FALSE);
         if (Bid > ichimoku_640 && Bid >= icustom_656 && icustom_624 == EMPTY_VALUE && Gd_412 < Ld_64) {
            G_color_988 = G_color_1016;
            ObjectCreate("aChart_Box", OBJ_LABEL, 0, 0, 0, 0, 0);
            ObjectSetText("aChart_Box", "g", 1500, "Webdings");
            ObjectSet("aChart_Box", OBJPROP_CORNER, 1);
            ObjectSet("aChart_Box", OBJPROP_XDISTANCE, G_x_1076);
            ObjectSet("aChart_Box", OBJPROP_YDISTANCE, G_y_1080);
            ObjectSet("aChart_Box", OBJPROP_COLOR, G_color_1016);
            ObjectSet("aChart_Box", OBJPROP_BACK, TRUE);
         } else ObjectDelete("aChart_Box");
         if (Bid < ichimoku_640 && Bid <= icustom_656 && icustom_616 == EMPTY_VALUE && Gd_412 > Ld_72) {
            G_color_988 = G_color_1020;
            ObjectCreate("aChart_Boxd", OBJ_LABEL, 0, 0, 0, 0, 0);
            ObjectSetText("aChart_Boxd", "g", 1500, "Webdings");
            ObjectSet("aChart_Boxd", OBJPROP_CORNER, 1);
            ObjectSet("aChart_Boxd", OBJPROP_XDISTANCE, G_x_1076);
            ObjectSet("aChart_Boxd", OBJPROP_YDISTANCE, G_y_1080);
            ObjectSet("aChart_Boxd", OBJPROP_COLOR, G_color_1020);
            ObjectSet("aChart_Boxd", OBJPROP_BACK, TRUE);
         } else ObjectDelete("aChart_Boxd");
      }
   }
   if (Gi_984) {
      ObjectDelete("Trix_candle");
      ObjectCreate("Trix_candle", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_candle", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_candle", OBJPROP_XDISTANCE, 70);
      ObjectSet("Trix_candle", OBJPROP_YDISTANCE, Gd_948 + 142.0);
      ObjectSet("Trix_candle", OBJPROP_COLOR, Gold);
      ObjectSet("Trix_candle", OBJPROP_BACK, FALSE);
      ObjectSetText("Trix_candle", "Candle       :", 9, "Arial Bold", Orange);
      ObjectDelete("Trix_candle1");
      ObjectCreate("Trix_candle1", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
      ObjectSet("Trix_candle1", OBJPROP_CORNER, AnalyzeBoxCorner);
      ObjectSet("Trix_candle1", OBJPROP_XDISTANCE, 12);
      ObjectSet("Trix_candle1", OBJPROP_YDISTANCE, Gd_948 + 142.0);
      ObjectSet("Trix_candle1", OBJPROP_COLOR, Gold);
      ObjectSet("Trix_candle1", OBJPROP_BACK, FALSE);
      ObjectSetText("Trix_candle1", text_608, 9, "Arial Bold", Orange);
   }
   if (Alert_On_Fast_Slow_Trix_Cross) {
      if (G_ibuf_392[2] < G_ibuf_380[2] && G_ibuf_392[1] > G_ibuf_380[1] && G_bars_420 < Bars) {
         if (Gi_984) text_524 = "Buy";
         ObjectDelete("Order_Crossing_Label");
         ObjectCreate("Order_Crossing_Label", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
         ObjectSet("Order_Crossing_Label", OBJPROP_CORNER, AnalyzeBoxCorner);
         ObjectSet("Order_Crossing_Label", OBJPROP_XDISTANCE, 12);
         ObjectSet("Order_Crossing_Label", OBJPROP_YDISTANCE, Gd_948 + 110.0);
         ObjectSet("Order_Crossing_Label", OBJPROP_COLOR, Red);
         ObjectSetText("Order_Crossing_Label", text_524, 9, "Arial Bold", Lime);
         Ls_484 = Gs_424 + " " + Symbol() + " " + TF2Str(Period()) + " BUY ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
         DoAlerts(Ls_484, Ls_484);
         G_bars_420 = Bars;
         if (SoundAlerts) PlaySound(AnalyseBuySound);
      } else {
         if (G_ibuf_392[2] > G_ibuf_380[2] && G_ibuf_392[1] < G_ibuf_380[1] && G_bars_420 < Bars) {
            if (Gi_984) text_524 = "Sell";
            ObjectDelete("Order_Crossing_Label");
            ObjectCreate("Order_Crossing_Label", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
            ObjectSet("Order_Crossing_Label", OBJPROP_CORNER, AnalyzeBoxCorner);
            ObjectSet("Order_Crossing_Label", OBJPROP_XDISTANCE, 12);
            ObjectSet("Order_Crossing_Label", OBJPROP_YDISTANCE, Gd_948 + 110.0);
            ObjectSet("Order_Crossing_Label", OBJPROP_COLOR, Red);
            ObjectSetText("Order_Crossing_Label", text_524, 9, "Arial Bold", Red);
            Ls_484 = Gs_424 + " " + Symbol() + " " + TF2Str(Period()) + " SELL ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
            DoAlerts(Ls_484, Ls_484);
            G_bars_420 = Bars;
            if (SoundAlerts) PlaySound(AnalyseSellSound);
         }
      }
   }
   if (Gi_984)
      if (Gd_412 > Ld_64) text_532 = "Sell OB";
   ObjectDelete("Order_Crossing_Label_OB");
   ObjectCreate("Order_Crossing_Label_OB", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_CORNER, AnalyzeBoxCorner);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_XDISTANCE, 12);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_YDISTANCE, Gd_948 + 110.0);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_COLOR, Red);
   ObjectSetText("Order_Crossing_Label_OB", text_532, 9, "Arial Bold", Red);
   if (Gd_412 > Ld_64) ObjectDelete("Order_Crossing_Label");
   if (Gi_984)
      if (Gd_412 < Ld_72) text_532 = "Buy OS";
   ObjectDelete("Order_Crossing_Label_OB");
   ObjectCreate("Order_Crossing_Label_OB", OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_CORNER, AnalyzeBoxCorner);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_XDISTANCE, 12);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_YDISTANCE, Gd_948 + 110.0);
   ObjectSet("Order_Crossing_Label_OB", OBJPROP_COLOR, Red);
   ObjectSetText("Order_Crossing_Label_OB", text_532, 9, "Arial Bold", Red);
   if (Gd_412 < Ld_72) ObjectDelete("Order_Crossing_Label");
   if (Alert_On_Fast_Trix_Color_Change) {
      if (G_ibuf_392[1] > G_ibuf_380[1] && G_ibuf_396[2] != EMPTY_VALUE && G_ibuf_396[1] == EMPTY_VALUE && G_bars_420 < Bars) {
         if (Gi_984) text_508 = "Exit Long";
         if (ObjectFind("Exit_Label" + Time[0]) == -1) {
            ObjectDelete("Exit_Label" + Time[0]);
            ObjectCreate("Exit_Label" + Time[0], OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
            ObjectSet("Exit_Label" + Time[0], OBJPROP_CORNER, AnalyzeBoxCorner);
            ObjectSet("Exit_Label" + Time[0], OBJPROP_XDISTANCE, 12);
            ObjectSet("Exit_Label" + Time[0], OBJPROP_YDISTANCE, Gd_948 + 125.0);
            ObjectSet("Exit_Label" + Time[0], OBJPROP_COLOR, Orange);
            ObjectSet("Exit_Label", OBJPROP_BACK, FALSE);
            ObjectSetText("Exit_Label" + Time[0], text_508, 9, "Arial Bold", Gold);
         }
         Ls_484 = Gs_424 + " " + Symbol() + " " + TF2Str(Period()) + " TRIX EXIT ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
         DoAlerts(Ls_484, Ls_484);
         G_bars_420 = Bars;
         if (SoundAlerts) PlaySound(Sound_On_Fast_Trix_Color_Change);
      } else {
         if (G_ibuf_392[1] < G_ibuf_380[1] && G_ibuf_400[2] != EMPTY_VALUE && G_ibuf_400[1] == EMPTY_VALUE && G_bars_420 < Bars) {
            if (Gi_984) text_508 = "Exit Short";
            if (ObjectFind("Exit_Label" + Time[0]) == -1) {
               if (Gi_984) {
                  ObjectDelete("Exit_Label");
                  ObjectCreate("Exit_Label" + Time[0], OBJ_LABEL, AnalyzeBoxWindow, 0, 0);
                  ObjectSet("Exit_Label" + Time[0], OBJPROP_CORNER, AnalyzeBoxCorner);
                  ObjectSet("Exit_Label" + Time[0], OBJPROP_XDISTANCE, 12);
                  ObjectSet("Exit_Label" + Time[0], OBJPROP_YDISTANCE, Gd_948 + 125.0);
                  ObjectSet("Exit_Label" + Time[0], OBJPROP_COLOR, Gold);
                  ObjectSet("Exit_Label", OBJPROP_BACK, FALSE);
                  ObjectSetText("Exit_Label" + Time[0], text_508, 9, "Arial Bold", Orange);
               }
            }
            Ls_484 = Gs_424 + " " + Symbol() + " " + TF2Str(Period()) + " TRIX EXIT ALARM @ " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES);
            DoAlerts(Ls_484, Ls_484);
            G_bars_420 = Bars;
            if (SoundAlerts) PlaySound(Sound_On_Fast_Trix_Color_Change);
         }
      }
      if (ObjectFind("Exit_Label" + Time[1]) != -1) ObjectDelete("Exit_Label" + Time[1]);
   }
   return (0);
}

void DoAlerts(string As_0, string As_8) {
   if (MsgAlerts) Alert(As_8);
   if (eMailAlerts) SendMail(As_0, As_8);
}

string TF2Str(int Ai_0) {
   switch (Ai_0) {
   case 1:
      return ("M1");
   case 5:
      return ("M5");
   case 15:
      return ("M15");
   case 30:
      return ("M30");
   case 60:
      return ("H1");
   case 240:
      return ("H4");
   case 1440:
      return ("D1");
   case 10080:
      return ("W1");
   case 43200:
      return ("MN");
   }
   return (Period());
}

void CatchBullishDivergence(int Ai_0) {
   int Li_4;
   int Li_8;
   if (IsIndicatorTrough(Ai_0) != 0) {
      Li_4 = Ai_0;
      Li_8 = GetIndicatorLastTrough(Ai_0);
      if (G_ibuf_392[Li_4] > G_ibuf_392[Li_8] && Low[Li_4] < Low[Li_8]) {
         G_ibuf_636[Li_4] = G_ibuf_392[Li_4] - 0.0001;
         if (drawPriceTrendLines == TRUE) DrawPriceTrendLine(Time[Li_4], Time[Li_8], Low[Li_4], Low[Li_8], BullishDivergenceColor, STYLE_SOLID);
         if (drawIndicatorTrendLines == TRUE) DrawIndicatorTrendLine(Time[Li_4], Time[Li_8], G_ibuf_392[Li_4], G_ibuf_392[Li_8], BullishDivergenceColor, STYLE_SOLID);
         if (EnableAlerts == TRUE) {
            if (SoundAlertOnDivergence == TRUE) SoundAlert(ClassicBullDivSound, Li_4);
            else DisplayAlert("Classical bullish divergence on: ", Li_4);
         }
      }
      if (G_ibuf_392[Li_4] < G_ibuf_392[Li_8] && Low[Li_4] > Low[Li_8]) {
         G_ibuf_636[Li_4] = G_ibuf_392[Li_4] - 0.0001;
         if (drawPriceTrendLines == TRUE) DrawPriceTrendLine(Time[Li_4], Time[Li_8], Low[Li_4], Low[Li_8], BullishDivergenceColor, STYLE_DOT);
         if (drawIndicatorTrendLines == TRUE) DrawIndicatorTrendLine(Time[Li_4], Time[Li_8], G_ibuf_392[Li_4], G_ibuf_392[Li_8], BullishDivergenceColor, STYLE_DOT);
         if (EnableAlerts == TRUE) {
            if (SoundAlertOnDivergence == TRUE) {
               SoundAlert(ReverseBullDivSound, Li_4);
               return;
            }
            DisplayAlert("Reverse bullish divergence on: ", Li_4);
         }
      }
   }
}

void CatchBearishDivergence(int Ai_0) {
   int Li_4;
   int Li_8;
   if (IsIndicatorPeak(Ai_0) != 0) {
      Li_4 = Ai_0;
      Li_8 = GetIndicatorLastPeak(Ai_0);
      if (G_ibuf_392[Li_4] < G_ibuf_392[Li_8] && High[Li_4] > High[Li_8]) {
         G_ibuf_640[Li_4] = G_ibuf_392[Li_4] + 0.0001;
         if (drawPriceTrendLines == TRUE) DrawPriceTrendLine(Time[Li_4], Time[Li_8], High[Li_4], High[Li_8], BearishDivergenceColor, STYLE_SOLID);
         if (drawIndicatorTrendLines == TRUE) DrawIndicatorTrendLine(Time[Li_4], Time[Li_8], G_ibuf_392[Li_4], G_ibuf_392[Li_8], BearishDivergenceColor, STYLE_SOLID);
         if (EnableAlerts == TRUE) {
            if (SoundAlertOnDivergence == TRUE) SoundAlert(ClassicBearDivSound, Li_4);
            else DisplayAlert("Classical bearish divergence on: ", Li_4);
         }
      }
      if (G_ibuf_392[Li_4] > G_ibuf_392[Li_8] && High[Li_4] < High[Li_8]) {
         G_ibuf_640[Li_4] = G_ibuf_392[Li_4] + 0.0001;
         if (drawPriceTrendLines == TRUE) DrawPriceTrendLine(Time[Li_4], Time[Li_8], High[Li_4], High[Li_8], BearishDivergenceColor, STYLE_DOT);
         if (drawIndicatorTrendLines == TRUE) DrawIndicatorTrendLine(Time[Li_4], Time[Li_8], G_ibuf_392[Li_4], G_ibuf_392[Li_8], BearishDivergenceColor, STYLE_DOT);
         if (EnableAlerts == TRUE) {
            if (SoundAlertOnDivergence == TRUE) {
               SoundAlert(ReverseBearDivSound, Li_4);
               return;
            }
            DisplayAlert("Reverse bearish divergence on: ", Li_4);
         }
      }
   }
}

int IsIndicatorTrough(int Ai_0) {
   if (G_ibuf_392[Ai_0] <= G_ibuf_392[Ai_0 + 1] && G_ibuf_392[Ai_0] < G_ibuf_392[Ai_0 + 2] && G_ibuf_392[Ai_0] < G_ibuf_392[Ai_0 - 1]) return (1);
   return (0);
}

int GetIndicatorLastTrough(int Ai_0) {
   for (int Li_4 = Ai_0 + 5; Li_4 < Bars; Li_4++) {
      if (G_ibuf_380[Li_4] <= G_ibuf_380[Li_4 + 1] && G_ibuf_380[Li_4] <= G_ibuf_380[Li_4 + 2] && G_ibuf_380[Li_4] <= G_ibuf_380[Li_4 - 1] && G_ibuf_380[Li_4] <= G_ibuf_380[Li_4 - 2]) {
         for (int Li_ret_8 = Li_4; Li_ret_8 < Bars; Li_ret_8++)
            if (G_ibuf_392[Li_ret_8] <= G_ibuf_392[Li_ret_8 + 1] && G_ibuf_392[Li_ret_8] < G_ibuf_392[Li_ret_8 + 2] && G_ibuf_392[Li        

Recommend