//+------------------------------------------------------------------+
//|                                                    P4L Clock.mq4 |
//| New rewrite by: Pips4life, a user at forexfactory.com            |
//| 2009-11-29: v2_4  P4L Clock.mq4                                  |
//|  (See Version History below)                                     |
//|                                                                  |
//| Previous names: Clock_v1_3.mq4, Clock.mq4, ...                   |
//| Previous version:   Jerome,  4xCoder@gmail.com, ...              |
//|                                                                  |
//+------------------------------------------------------------------+
//
// Description:
//    This indicator displays world timezones on a chart, and will change
//    the display color when each market zone is open.  Unlike other versions,
//    this version will correctly account for worldwide ST/DST changes 
//    unique to each timezone.  For example, New York, London, Sydney, etc. 
//    each observe DST on a different calendar, while Tokyo doesn't use 
//    DST at all.  Furthermore, your Local timezone has it's own DST
//    schedule.   None of that matters to this indicator, which handles
//    all the ST/DST changes automatically (Program updates will be necessary
//    if any government legislatively changes the annual ST/DST changeover
//    formula, such as Tokyo which is *considering* observing DST).
//    

#property indicator_chart_window       //Comment out this line if you prefer a subwindow display, AND...
//#property indicator_separate_window  //UN-Comment this line for subwindow display, AND... change "DrawInWindowNumber = 1" below!

// Version History:
// 2009-11-29: v2_4 DEV pips4life:
//    Made several changes suggested by Traderathome of FF. (Thanks).
//    New "Indicator_On" variable to turn off labels without removing indicator.
//    Added "DrawInWindowNumber" variable.  User *might* want to use "indicator_separate_window" above
//       AND change default DrawInWindowNumber = 1 (instead of 0, main window). (See below).
//    Added variables: FontName, TimezoneFontSize, ClockFontSize, LineSpacing
//    Added variables to control horizontal offset of clock and timezone labels, and vertical offset.
//    Reworked auto-horizontal adjustment based on: ShowBarTime, AM/PM, bar-seconds, time-seconds, and Period()
//    The order of labels is the same regardless of LabelCorner, however, ReverseLabelOrder can swap if desired.
//    Renamed "Seattle" to "Pacific".
//    Added TZ info for Central(US), and Mountain(US).
//    Added TZ info for China (same TZ as Hong Kong, Singapore, Taipei, and Perth)
//    Added TZ info for Brazil, Mexico, Israel, Helsinki, India, Jakarta
//    NOTE: Brazil's ST/DST appears to be a specific date, not an annual formula. Update the data EVERY YEAR! (last done Nov 2009)
//    New "OverrideShowALL" variable to turn on every timezone.
//    Made some trivial hour-of-day corrections to Moscow, Berlin TZ's (ST/DST changeover was off by an hour).
//       All other TZ data was verified unchanged since last release.
//    Turned several uncommon timezones off by default.
//    Changed colors.  Compatible with either very light or very dark. Alternate choices are given.
//    Turned on display of seconds by default.  It's very helpful to calibrate your localtime vs. Broker time.
//    MM:30 timezones can now use Broker_Gold_Standard (e.g. India).
//    Timezones and clocks are generally closer together and closer to the chart edges than before. User can customize if needed.
// 2008-09-28: v2_3  pips4life:
//    Added Auckland, Moscow, Berlin, Pacific (was Seattle) for Jodie(jhp2025). Default VerticalOffsetPixels is now 10.
// 2008-09-28: v2_2  pips4life: Turns out the ST/DST crossover dates are good
//    until any market zone country legistlatively changes their dates.
//    No annual update is necessary!  I updated the comments accordingly.
//    I moved the init() block before start for easier readability of the flow.
//    Mostly cosmetic changes.
// 2008-09-27: v2_1  pips4life: 
//    Modified Sydney changes NuckingFuts made. (Thx for the prelim work).
//    The original world time ST/DST calculation method which I had not looked
//    at enough to understand is fatally flawed, so...all that is rewritten! 
//    The new method uses true clock data and  *should* work from every timezone, 
//    and *should* handle ST/DST changes for each TZ, independently,
//    regardless of your Local TS and/or ST/DST status. (Depends on Windows
//    being correct, however). CONSEQUENTLY, the changes require ANNUAL UPDATES
//    to get the world ST/DST changeover dates!! Check this thread for updates:
//       http://forexfactory.com/showthread.php?t=109305
//    If no update, in JUST ONE CHART (!!), set If_TZ_ChangesSetTrueOn_ONE_chart=TRUE 
//    and follow the directions...  Do NOT compile the code with that variable=TRUE!!
//    Added Weekend_Test_Mode so simulated ticks show true times over the weekend.
// 2008-09-25:  mods by NuckingFuts
//    Fixed timezones with no daylight savings
//    Added Sydney
// 2008-09-24:  v2_0 "P4L Clock.mq4" by pips4life @ forexfactory.com 
//    Different highlight color(s) used for Market Open hours (Assuming 8AM - 5PM Local market hours)
//    Added seconds display, and used method such that single digits look better (":09" not ":9")
//    Added "Broker_MMSS_Is_Gold_Standard" to adjust (by a few seconds or minutes) the market hours, because
//      as if often the case, the Local computer clock may be off by a small amount.
//    Two extern variables to control display of seconds: bool Display_Time_With_Seconds, int Display_Bar_With_Seconds.
//    When Display_Bar_With_Seconds=2 (Auto mode), seconds display when < 2min, OR, if Display_Time_With_Seconds=True.
//    "Bar:" changed to "Bar Left:" (remaining time). Also, it will say "wait4bar" (rather than to display
//      a negative number as would have occurred) during periods of low activity until a new bar is formed.
//    "Suppress_Bar_HH_Below_H1" displays only [MM:SS] for H1 and below since HH in [HH:MM:SS] is always "00" 
//    Adjusted pixel distance between labels depending on options.
//    "Bar Left:" time does not display above D1 charts.  A future enhancement (not planned) could report DD_HH:MM[:SS]
//    Added Show_DIBS_London clock with user-setable start/stop hour relative to London (6AM and 7PM at present).
//
// 2008-??   v1_4  Was NOT an indicator, rather a script; however, it didn't handle new barstr (Time[0] stuck), nor could
//    one change timeframes without having to "Disable" and re-add the script. May have been more CPU intensive??
// 2008-??   v1_3 and earlier.  Details can be found on the web.

// FUTURE PLANS:
//

//#property copyright "Jerome" //previous author
//#property link      "4xCoder@gmail.com"
#property copyright "pips4life" //P4L Clock.mq4 is rewrite of Clock.mq4, Clock_v1_3.mq4
#property link      "pips4life, a user at forexfactory.com"

#import "kernel32.dll"
// For function documentation, see: http://msdn.microsoft.com/en-us/library/ms725473(VS.85).aspx
void GetLocalTime(int& LocalTimeArray[]);
void GetSystemTime(int& systemTimeArray[]);
int  GetTimeZoneInformation(int& LocalTZInfoArray[]);
bool SystemTimeToTzSpecificLocalTime(int& targetTZinfoArray[], int& systemTimeArray[], int& targetTimeArray[]);
//bool TzSpecificLocalTimeToSystemTime(int& targetTZinfoArray[], int& LocalTimeArray[], int& targetTimeArray[]);
#import

//------------------------------------------------------------------
// Instructions
//    Copy this file to:  C:\Program Files\--your-MT4-directory-here---\experts\indicators
//    Review the "extern" variable settings below. Change as desired, then restart MT4 or do "Compile" in MetaEditor.
//    
//    Open a chart and add this indicator. Assuming you compiled with the "extern" defaults you prefer,
//    you shouldn't need to change any of the defaults, *except* one: (FOR "P4L Clock.mq4" ONLY!) 
//    This Version *requires* "Allow DLL Imports" to be set under the Common Tab when you add this to a chart!
//    FYI, the DLLs retrieve the Local CPU clock time and timezone info as well as world timezone info.
//    A word of caution: You can see my entire source code and what the DLL's do which should be harmless.
//    Personally, I *never* enable DLL's on any binary .EX4 file because I don't trust what the program might do.  
//    For all I know, it could be sending out very private information about me or my account! 
//
//    NOTE! The world timezone times are only as accurate as your LOCAL CPU CLOCK or, if variable
//    Broker_MMSS_Is_Gold_Standard=True, your Broker's clock! At least verify your own clock and set it accurately!
//    NOTE! Your Broker time is independent of your Local CPU clock and, though unlikely, may change at any time.
// DISCLAIMER: Use completely at your own risk!! Author(s) accept no liabilities whatsoever!


//---- input parameters -- FYI, THE USER MAY CUSTOMIZE THESE EXTERN VARIABLE SETTINGS AS DESIRED:
extern bool     Indicator_On                  = true;       // Easy method to disable without removing indicator.
extern string   _INFO_Set_your_computer_clock = "Accuracy depends on YOUR CPU CLOCK!!";
extern string   _INFO_Verify_times_with_URL   = "www.worldtimezone.net/index24.php";
extern string   _INFO_Re_LabelCorner          = "0=Top-left, 1=TR, 2=BL, 3=BR";
extern int      WindowNumber                  = 0;    //>=1 are sub-windows BUT they must already exist (e.g. add RSI to create a sub-window 1).
extern int      LabelCorner                   = 2;    // 1 & 3 work best:  0=top-left; 1=top-right; 2=bottom-left; 3=bottom-right
extern bool     ReverseLabelOrder             = false;// false = Normal top-to-bottom order: Bar,Broker, then NZ to Asia to Europe to US
extern int      VerticalOffsetPixels          = 5;    // 5 pixels from top (or bottom) to show the 1st clock. Note (min. of 12 is forced if LabelCorner=0,top-left,due to chart text)
extern int      HorizClockOffsetPixels        = 9;    // 5 pixels from left (or right) to show the 1st clock
extern int      HorizTimezoneOffsetPixels     = 43;   // 42 pixels from left (or right) to show the 1st timezone
//========= v1_4 new colors and fonts
// IMO, these colors and sizes work well for Black AND White background charts. However, alternate colors/fonts/sizes were suggested by Traderathome (see below).
extern color    TimezoneColor                 = C'103,118,133';      // Green. Color of label, off-hours.  Alt: Blk: LimeGreen      Wht: SlateGray or C'103,118,133'
extern color    ClockColor                    = Blue;  // SteelBlue. Color of clock, off-hours    Blk: CornflowerBlue Wht: Blue
extern color    LabelMktOpenColor             = MidnightBlue;        // Red. Color of label, market-open        Blk: Red            Wht: MidnightBlue
extern color    ClockMktOpenColor             = Crimson;  // OrangeRed. Color of clock, market-open  Blk: DarkOrange     Wht: Crimson
extern string   FontName                      = "Arial Bold";    // "Arial" Wht-or-Blk: "Arial Bold" or "Arial" are good choices.
extern int      TimezoneFontSize              = 9;         // 10 Wht-or-Blk: 10, or Blk: 9
extern int      ClockFontSize                 = 9;          // 9
extern int      LineSpacing                   = 13;         // 14  or 13
extern bool     Show_Background               = true;
extern color    Background_Color              = White;//C'240,240,240';
//==========
extern bool     Highlight_Market_Open         = true ;      // When true, the above market-open colors are used between 8AM - 5PM (market Local)
extern bool     Display_Times_With_AMPM       = true;      // True=show 12 hour AM/PM time, false=show 24 hour time
extern bool 	 Display_Time_With_Seconds     = false ;      // Turn on seconds for timezone clocks.
extern string   _INFO_Re_Bar_With_Seconds     = "0=No; 1=Yes; 2=Auto"; // Auto is: if < 120 seconds or if Display_Time_With_Seconds is true -- arguably a bit too clever, so "1" is default.
extern int  	 Display_Bar_With_Seconds      = 0;          // Control "Bar Left:" to display ":SS" independently from other times.
extern bool     Suppress_Bar_HH_Below_H1      = true ;      // For "Bar Left:" on H1 and below, display only [MM:SS] since HH in [HH:MM:SS] is always "00"
extern bool     Broker_MMSS_Is_Gold_Standard  = true ;      // If true, make a correction up to a few seconds/minutes vs. your Local CPU clock. FYI, we don't know Broker TZ/DST info but don't care.
//==========
extern bool     OverrideShowALL               = false;
extern bool     ShowBarTime                   = false ;      //However, BarTime only shows if <= PERIOD_D1
extern bool     ShowBroker                    = true ;
extern bool     ShowAuckland                  = false;
extern bool     ShowSydney                    = true ;
extern bool     ShowTokyo                     = true ;
extern bool     ShowChina                     = true ;
extern bool     ShowJakarta                   = false;
extern bool     ShowIndia                     = false;
extern bool     ShowMoscow                    = false;
extern bool     ShowIsrael                    = false;
extern bool     ShowHelsinki                  = false;
extern bool     ShowBerlin                    = true;
extern bool 	 ShowLondon                    = true ;
extern bool 	 ShowUTC_GMT                   = false ; // FYI, UTC_GMT does not change with Daylight Savings Time. In winter, London=UTC; in summer, London=UTC+1. Also, UTC does not highlight "market" hours.
extern bool     ShowBrazil                    = false;
extern bool 	 ShowNewYork                   = true ;
extern bool     ShowCentral                   = false;
extern bool     ShowMexico                    = false;
extern bool     ShowMountain                  = false;
extern bool 	 ShowPacific                   = false;
extern bool     ShowLocal                     = false ; // FYI, this is your Local computer clock. For accuracy, right-mouse on Clock -> Adjust Date/Time ->Internet Time->Update Now
extern bool     Show_DIBS_London              = false; // FYI, for DIBS method, see http://www.forexfactory.com/showthread.php?t=86766
extern int      DIBS_LondonOpenHour           = 6;     // DIBS relative to London Local time. 6 ~= 2 hours before London ~= Chicago midnight. (Follows London DST)
extern int      DIBS_LondonCloseHour          = 15;    // MAX is 23!! Subjective choice. Change as desired. 9 hours length?? (Do NOT use # < DIBS_LondonOpenHour). 
extern bool     Weekend_Test_Mode             = false; // Normally false. True forces Broker_MMSS_Is_Gold_Standard=false as well. Clock updates are >=once-per-Broker-second but on weekends the Broker clock freezes

// FYI: If a market zone changes ST/DST dates (e.g. if Tokyo adopts DST), or, to add a new market timezone to this program,
//   you need to obtain the timezone ST/DST crossover date information.  To do that, add "extern" before this variable but leave it FALSE!
//  Add indicator to one chart and set this variable True ON ONE CHART ONLY, then follow the directions...
//
// WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
// This variable controls writing information to a file, but we do NOT want multiple chart windows EACH writing to the file!!!! Therefore...
// you should NEVER compile this variable as TRUE!  Rather, follow the directions below...
//extern
bool  New_DST_SetTrueOnONEchart   = FALSE; // WARNING! Do NOT compile this as TRUE! Rather, insert "extern" before "bool", compile, then change JUST ONE CHART value to TRUE for instructions!


// This was external but really isn't necessary at all. Every "Local" clock ought to be 
//   within 15min of what is expected for Broker time. The freature was removed.
//bool     SupportAlso_HH_30_TimeZones   = true;  // If true a TZ on HH_30 (e.g. India, Caracas) can use Broker_HHMM_Is_Gold_Standard=true-or-false as desired.
                                                       // If false, a NORMAL TZ cannot adjust to Broker time more than 15 minutes different from your Local clock.

//---- buffers

int    AucklandTZInfoArray[43];
int    SydneyTZInfoArray[43];
int    TokyoTZInfoArray[43];
int    ChinaTZInfoArray[43];
int    JakartaTZInfoArray[43];
int    IndiaTZInfoArray[43];
int    MoscowTZInfoArray[43];
int    IsraelTZInfoArray[43];
int    HelsinkiTZInfoArray[43];
int    BerlinTZInfoArray[43];
int    LondonTZInfoArray[43];
int    BrazilTZInfoArray[43];
int    NewYorkTZInfoArray[43];
int    CentralTZInfoArray[43];
int    MexicoTZInfoArray[43];
int    MountainTZInfoArray[43];
int    PacificTZInfoArray[43];
int    LocalTZInfoArray[43];


// Almost all local markets are assumed open 8AM to 5PM
int LocalOpenHour = 8;
int LocalCloseHour = 17;

// Sydney market Local is 7am-4pm per FF user "NuckingFuts"
int SydneyLocalOpenHour = 7;
int SydneyLocalCloseHour = 16;

bool FLAG_LABELEXISTS = false;
bool FLAG_DEINIT = false;
   
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   FLAG_DEINIT = false;
   
   // Variable New_DST_SetTrueOnONEchart is used by programmers to add a new timezone to the code.  See above.
   if (New_DST_SetTrueOnONEchart) writeLocalTZInfoToFile("tzdata.csv", false); // The false obtains only the limited data which is needed.
   
   GetAllTimeZoneInfo(AucklandTZInfoArray, SydneyTZInfoArray, TokyoTZInfoArray, ChinaTZInfoArray, JakartaTZInfoArray, 
      IndiaTZInfoArray, MoscowTZInfoArray, IsraelTZInfoArray, HelsinkiTZInfoArray, BerlinTZInfoArray, LondonTZInfoArray, BrazilTZInfoArray, 
      NewYorkTZInfoArray, CentralTZInfoArray, MexicoTZInfoArray, MountainTZInfoArray, PacificTZInfoArray, LocalTZInfoArray);
   
   int top=VerticalOffsetPixels;
   if (LabelCorner == 0) top = MathMax(12,top);  // At least 12 pixels required to get beneath the top-left chart label.
   int left = HorizTimezoneOffsetPixels;
   int right = HorizClockOffsetPixels;
   
   // Below are some auto-adjustments BASED ON ORIGINAL DEFAULTS. User can manually force other values using the 3 Offsets above.
   int adjustLeft = 0; //Basic 5 characters, HH:MM, no adjustment needed when using program defaults.
   if (ShowBarTime && Display_Bar_With_Seconds >= 1 && (Period() > PERIOD_H1 || !Suppress_Bar_HH_Below_H1) ) adjustLeft = 32; // Up to 5+7=12 characters WIDE [ HH:MM:SS ]
   else if (ShowBarTime) adjustLeft = 16; // 5+4=9 characters [ HH:MM ]
   if (Display_Times_With_AMPM)
   {
      if (!Display_Time_With_Seconds) adjustLeft = MathMax(adjustLeft,26); // 5+3=8 characters HH:MM AM
      else adjustLeft = MathMax(adjustLeft,40); // 5+6=11 characters HH:MM:SS AM
   }
   else if (Display_Time_With_Seconds) adjustLeft = MathMax(adjustLeft,18); // 5+3=8 characters  HH:MM:SS
   
   left = left + adjustLeft;
   
   int offset=0;
   
   
   if ( (ReverseLabelOrder && LabelCorner <= 1) || (!ReverseLabelOrder && LabelCorner >= 2))
   {
      int count = 0;
      //
      if (OverrideShowALL)
      {
         count = 22; //CHANGE to however many ShowX variables there are!!
      }
      else
      {
         if (ShowBarTime) count++;
         if (ShowBroker) count++;
         if (ShowAuckland) count++;
         if (ShowSydney) count++;
         if (ShowTokyo) count++;
         if (ShowChina) count++;
         if (ShowJakarta) count++;
         if (ShowIndia) count++;
         if (ShowMoscow) count++;
         if (ShowIsrael) count++;
         if (ShowHelsinki) count++;
         if (ShowBerlin) count++;
         if (Show_DIBS_London) count++;
         if (ShowLondon) count++;
         if (ShowUTC_GMT) count++;
         if (ShowBrazil) count++;
         if (ShowNewYork) count++;
         if (ShowCentral) count++;
         if (ShowMexico) count++;
         if (ShowMountain) count++;
         if (ShowPacific) count++;
         if (ShowLocal) count++;  // 22 total. Change "count" above if the total changes.
         //if (Show) count++;
      }
      count--; // Decrement by 1 for the first label.
      if ((OverrideShowALL || ShowBarTime) && Period() > PERIOD_D1) count--; // Decrement if this won't be displayed due to Period()
      offset = LineSpacing * count;
      LineSpacing = -1 * MathAbs(LineSpacing); //Just in case init() is run twice, use MathAbs to be sure final value is negative.
   }

/*	
   if (Show_Background){
      int yB = VerticalOffsetPixels - 6; if (yB < 1 ) {yB = 1;}
 	
	   if (ObjectFind("P4L Background") == -1){
         ObjectCreate("P4L Background", OBJ_LABEL, 0, 0, 0, 0, 0);}
         
      ObjectSetText("P4L Background", "ggg", 92, "Webdings");      
      ObjectSet("P4L Background", OBJPROP_CORNER, 2);
      ObjectSet("P4L Background", OBJPROP_XDISTANCE, 0);
      ObjectSet("P4L Background", OBJPROP_YDISTANCE, yB );    
      ObjectSet("P4L Background", OBJPROP_COLOR, Background_Color);
      ObjectSet("P4L Background", OBJPROP_BACK, false);}
*/


   

   if( (ShowBarTime || OverrideShowALL) && Period() <= PERIOD_D1)
   {
      ObjectMakeLabel( "barl", left, top+offset );
      ObjectMakeLabel( "bart", right, top+offset );
      offset+=LineSpacing;
   } //No.  else if (ShowBarTime || OverrideShowALL) offset+=LineSpacing; //offset bar label regardless of Period()

  	// Begin world timezones, listed IN ORDER!
   if(ShowAuckland || OverrideShowALL)
   {
   	ObjectMakeLabel( "Aucklandl", left, top+offset );
   	ObjectMakeLabel( "Aucklandt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowSydney || OverrideShowALL)
   {
   	ObjectMakeLabel( "Sydneyl", left, top+offset );
   	ObjectMakeLabel( "Sydneyt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowTokyo || OverrideShowALL)
   {
   	ObjectMakeLabel( "Tokyol", left, top+offset );
   	ObjectMakeLabel( "Tokyot", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowChina || OverrideShowALL)
   {
   	ObjectMakeLabel( "Chinal", left, top+offset );
   	ObjectMakeLabel( "Chinat", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowJakarta || OverrideShowALL)
   {
   	ObjectMakeLabel( "Jakartal", left, top+offset );
   	ObjectMakeLabel( "Jakartat", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowIndia || OverrideShowALL)
   {
   	ObjectMakeLabel( "Indial", left, top+offset );
   	ObjectMakeLabel( "Indiat", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowMoscow || OverrideShowALL)
   {
   	ObjectMakeLabel( "Moscowl", left, top+offset );
   	ObjectMakeLabel( "Moscowt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowIsrael || OverrideShowALL)
   {
   	ObjectMakeLabel( "Israell", left, top+offset );
   	ObjectMakeLabel( "Israelt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowHelsinki || OverrideShowALL)
   {
   	ObjectMakeLabel( "Helsinkil", left, top+offset );
   	ObjectMakeLabel( "Helsinkit", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowBroker || OverrideShowALL)
   {
      ObjectMakeLabel( "Brokerl", left, top+offset );
      ObjectMakeLabel( "Brokert", right, top+offset );
     	offset+=LineSpacing;
   }     
   if(ShowBerlin || OverrideShowALL)
   {
   	ObjectMakeLabel( "Berlinl", left, top+offset );
   	ObjectMakeLabel( "Berlint", right, top+offset );
   	offset+=LineSpacing;
   }
   if ( Show_DIBS_London || OverrideShowALL) 
   {
      ObjectMakeLabel( "dibsl", left, top+offset );
      ObjectMakeLabel( "dibst", right, top+offset );
      offset+=LineSpacing;
   }
   if(ShowLondon || OverrideShowALL)
   {
	   ObjectMakeLabel( "Londonl", left, top+offset );
   	ObjectMakeLabel( "Londont", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowUTC_GMT || OverrideShowALL)
   {
   	ObjectMakeLabel( "utcl", left, top+offset );
   	ObjectMakeLabel( "utct", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowBrazil || OverrideShowALL)
   {
   	ObjectMakeLabel( "Brazill", left, top+offset );
   	ObjectMakeLabel( "Brazilt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowNewYork || OverrideShowALL)
   {
	   ObjectMakeLabel( "NewYorkl", left, top+offset );
   	ObjectMakeLabel( "NewYorkt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowCentral || OverrideShowALL)
   {
   	ObjectMakeLabel( "Centrall", left, top+offset );
   	ObjectMakeLabel( "Centralt", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowMexico || OverrideShowALL)
   {
   	ObjectMakeLabel( "Mexicol", left, top+offset );
   	ObjectMakeLabel( "Mexicot", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowMountain || OverrideShowALL)
   {
   	ObjectMakeLabel( "Mountainl", left, top+offset );
   	ObjectMakeLabel( "Mountaint", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowPacific || OverrideShowALL)
   {
	   ObjectMakeLabel( "Pacificl", left, top+offset );
   	ObjectMakeLabel( "Pacifict", right, top+offset );
   	offset+=LineSpacing;
   }
   if(ShowLocal || OverrideShowALL)
   {
      ObjectMakeLabel( "Locall", left, top+offset );
      ObjectMakeLabel( "Localt", right, top+offset );
      offset+=LineSpacing;
   }

   string short_name="P4L Clock_v2.4   ";
   if (Indicator_On == false) short_name=("P4L Clock_v2.4  -Off.   ");
   IndicatorShortName(short_name);   // This only matters if indicator_separate_window was used. 
   //----
   return(0);
} // end of init()
  
//+------------------------------------------------------------------+
//| Custom indicator iteration function -- Runs with each new tick   |
//+------------------------------------------------------------------+
int start()
  {
   static datetime last_timecurrent;
   
   //static bool FLAG_DEINIT = false;
   if(Indicator_On == false)
   {
      if (!FLAG_DEINIT) deinit(); //Run deinit() just once, not every tick.
      FLAG_DEINIT = true;
      return(0);
   }
   FLAG_DEINIT = false;
   
   if (!FLAG_LABELEXISTS) 
   {
     // This may happen if init() tried to create objects in subwindow 1 BEFORE the subwindow was created!
     init();  //Run init() again.
     // Potentially flag an Alert ERROR here, if at least one ShowX was true and FLAG_LABELEXISTS is still false.
     //FLAG_LABELEXISTS = true; // Possibly Force true because perhaps every ShowX variable is false. Don't run init() every time.
     last_timecurrent = 0; // Gets around weekend-mode issue.
   }
   
   if ( !IsDllsAllowed() ) 
   {
      if (TimeCurrent() - last_timecurrent < 7) return; // With a lot of fast ticks, this error message would be annoying if not delayed a bit
      last_timecurrent = TimeCurrent();
      Alert( WindowExpertName(),": ERROR. DLLs are disabled. To enable, select 'Allow DLL Imports' in the Common Tab of indicator" );
      return;
   }
   
   static bool FLAG_WINDOWALERT = false;
   if (!FLAG_WINDOWALERT && !WindowIsVisible(WindowNumber))
   {
      Alert(WindowExpertName(),": ERROR, subwindow ",WindowNumber," was not found or is invisible. No labels drawn.");
      FLAG_WINDOWALERT = true;
   }
   
   

	
   if (Show_Background){
      int yB = VerticalOffsetPixels - 6; if (yB < 1 ) {yB = 1;}
 	
	   if (ObjectFind("P4L Background") == -1){
         ObjectCreate("P4L Background", OBJ_LABEL, 0, 0, 0, 0, 0);}
         
      ObjectSetText("P4L Background", "ggg", 92, "Webdings");      
      ObjectSet("P4L Background", OBJPROP_CORNER, 2);
      ObjectSet("P4L Background", OBJPROP_XDISTANCE, 0);
      ObjectSet("P4L Background", OBJPROP_YDISTANCE, yB );    
      ObjectSet("P4L Background", OBJPROP_COLOR, Background_Color);
      ObjectSet("P4L Background", OBJPROP_BACK, false);}

   
   
   
   
   
   
   // FYI, if uncommented, saves CPU but won't update on weekends. If commented, on weekends the Broker_MMSS_Is_Gold_Standard must be FALSE. Better, just use Weekend_Test_Mode=true to update every tick.
   if (!Weekend_Test_Mode && TimeCurrent() - last_timecurrent == 0) return; // No point in processing more than 1 tick per second.
   last_timecurrent = TimeCurrent();
   
   int    systemTimeArray[4];
   
   int    AucklandTimeArray[4];
   int    SydneyTimeArray[4];
   int    TokyoTimeArray[4];
   int    ChinaTimeArray[4];
   int    JakartaTimeArray[4];
   int    IndiaTimeArray[4];
   int    MoscowTimeArray[4];
   int    IsraelTimeArray[4];
   int    HelsinkiTimeArray[4];
   int    BerlinTimeArray[4];
   int    LondonTimeArray[4];
   int    BrazilTimeArray[4];
   int    NewYorkTimeArray[4];
   int    CentralTimeArray[4];
   int    MexicoTimeArray[4];
   int    MountainTimeArray[4];
   int    PacificTimeArray[4];
   int    LocalTimeArray[4];
   
   
   GetLocalTime(LocalTimeArray);
   datetime Local_Time = TimeArrayToTime(LocalTimeArray);

   datetime BrokerTime = TimeCurrent();
   datetime BrokerCorrection = 0;
   
   if (Broker_MMSS_Is_Gold_Standard && !Weekend_Test_Mode) 
   {
      BrokerCorrection = TimeMinute(BrokerTime)*60 + TimeSeconds(BrokerTime) - TimeMinute(Local_Time)*60 - TimeSeconds(Local_Time);
      if (BrokerCorrection > 1800) BrokerCorrection = BrokerCorrection - 3600;
      else if (BrokerCorrection < -1800) BrokerCorrection = BrokerCorrection + 3600;
      static bool BrokerCorrectionError;
      //if (SupportAlso_HH_30_TimeZones && MathAbs(BrokerCorrection) > 900) BrokerCorrection = MathMod(BrokerCorrection + 1800,1800);
      if (MathAbs(BrokerCorrection) > 900) BrokerCorrection = MathMod(BrokerCorrection + 1800,1800);
      else if ( MathAbs(BrokerCorrection) > 900 && !BrokerCorrectionError)
        { // Only if HH_30 TimeZones are NOT supported, then this error may occur and be flagged:
         Print(WindowExpertName(),": Broker MMSS correction exceeds 15 minute limit. Was: ",BrokerCorrection, " seconds, now set to 0. Local_Time is now Gold Standard.");
         BrokerCorrectionError=true;
         BrokerCorrection=0;
        }
      //Alert("BrokerCorrection seconds: ", BrokerCorrection);
   }   
     
   GetSystemTime(systemTimeArray);
   datetime UTC = TimeArrayToTime(systemTimeArray)+BrokerCorrection;

   SystemTimeToTzSpecificLocalTime(AucklandTZInfoArray, systemTimeArray, AucklandTimeArray);
   datetime Auckland   = TimeArrayToTime(AucklandTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(SydneyTZInfoArray, systemTimeArray, SydneyTimeArray);
   datetime Sydney  = TimeArrayToTime(SydneyTimeArray)+BrokerCorrection;
   
   SystemTimeToTzSpecificLocalTime(TokyoTZInfoArray, systemTimeArray, TokyoTimeArray);
   datetime Tokyo   = TimeArrayToTime(TokyoTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(ChinaTZInfoArray, systemTimeArray, ChinaTimeArray);
   datetime China   = TimeArrayToTime(ChinaTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(JakartaTZInfoArray, systemTimeArray, JakartaTimeArray);
   datetime Jakarta   = TimeArrayToTime(JakartaTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(IndiaTZInfoArray, systemTimeArray, IndiaTimeArray);
   datetime India   = TimeArrayToTime(IndiaTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(MoscowTZInfoArray, systemTimeArray, MoscowTimeArray);
   datetime Moscow   = TimeArrayToTime(MoscowTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(IsraelTZInfoArray, systemTimeArray, IsraelTimeArray);
   datetime Israel   = TimeArrayToTime(IsraelTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(HelsinkiTZInfoArray, systemTimeArray, HelsinkiTimeArray);
   datetime Helsinki   = TimeArrayToTime(HelsinkiTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(BerlinTZInfoArray, systemTimeArray, BerlinTimeArray);
   datetime Berlin   = TimeArrayToTime(BerlinTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(LondonTZInfoArray, systemTimeArray, LondonTimeArray);
   datetime London  = TimeArrayToTime(LondonTimeArray)+BrokerCorrection;
   
   SystemTimeToTzSpecificLocalTime(BrazilTZInfoArray, systemTimeArray, BrazilTimeArray);
   datetime Brazil  = TimeArrayToTime(BrazilTimeArray)+BrokerCorrection;
   
   SystemTimeToTzSpecificLocalTime(NewYorkTZInfoArray, systemTimeArray, NewYorkTimeArray);
   datetime NewYork = TimeArrayToTime(NewYorkTimeArray)+BrokerCorrection;
   
   SystemTimeToTzSpecificLocalTime(CentralTZInfoArray, systemTimeArray, CentralTimeArray);
   datetime Central   = TimeArrayToTime(CentralTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(MexicoTZInfoArray, systemTimeArray, MexicoTimeArray);
   datetime Mexico   = TimeArrayToTime(MexicoTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(MountainTZInfoArray, systemTimeArray, MountainTimeArray);
   datetime Mountain   = TimeArrayToTime(MountainTimeArray)+BrokerCorrection;
      
   SystemTimeToTzSpecificLocalTime(PacificTZInfoArray, systemTimeArray, PacificTimeArray);
   datetime Pacific   = TimeArrayToTime(PacificTimeArray)+BrokerCorrection;
      
   string Brokers = TimeToString( TimeCurrent() );
   string Aucklands = TimeToString( Auckland  );
   string Sydneys = TimeToString(Sydney);
   string Tokyos = TimeToString( Tokyo  );
   string Chinas = TimeToString( China  );
   string Jakartas = TimeToString( Jakarta  );
   string Indias = TimeToString( India  );
   string Moscows = TimeToString( Moscow  );
   string Israels = TimeToString( Israel  );
   string Helsinkis = TimeToString( Helsinki  );
   string Berlins = TimeToString( Berlin  );
   string Londons = TimeToString( London  );
   string UTCs = TimeToString( UTC );
   string Brazils = TimeToString( Brazil  );
   string NewYorks = TimeToString( NewYork  );
   string Centrals = TimeToString( Central  );
   string Mexicos = TimeToString( Mexico  );
   string Mountains = TimeToString( Mountain  );
   string Pacifics = TimeToString( Pacific  );
   string Locals = TimeToString( Local_Time  );
   
   int secondsleft = Period()*60 + Time[0] - TimeCurrent(); // FYI, this CAN go negative if a new bar hasn't formed yet!
   string barstr;
   if (secondsleft >= 0) 
   {
      if (Display_Bar_With_Seconds != 0 && (Display_Bar_With_Seconds == 1 || Display_Time_With_Seconds || (Display_Bar_With_Seconds == 2 && secondsleft < 120))) barstr = TimeToStr( Period()*60 + Time[0] - TimeCurrent(), TIME_MINUTES|TIME_SECONDS );
      else barstr = TimeToStr( Period()*60 + Time[0] - TimeCurrent(), TIME_MINUTES );
      
      if (Suppress_Bar_HH_Below_H1 && Period() <= PERIOD_H1 && StringLen(barstr) > 6) barstr = StringSubstr(barstr,3);
   }
   else // negative means no new bar yet formed
     {
      if (Display_Bar_With_Seconds == 0) barstr = "wait"; // or "--:--"
      else barstr = "wait4bar"; // or "--:--:--"; 
     }



   
   if((ShowBarTime || OverrideShowALL) && Period() <= PERIOD_D1)
   {
      ObjectSetText( "barl", "Bar Left", TimezoneFontSize, FontName, TimezoneColor );
      ObjectSetText( "bart", StringConcatenate("[ ",barstr," ]"), ClockFontSize, FontName,ClockColor );
   }

   if(ShowBroker || OverrideShowALL)
   {
	   ObjectSetText( "Brokerl", "Broker", TimezoneFontSize, FontName, TimezoneColor );
      ObjectSetText( "Brokert", Brokers, ClockFontSize, FontName,ClockColor );
   }
   if(ShowAuckland || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Auckland) != 0 && TimeDayOfWeek(Auckland) != 6 && Highlight_Market_Open && TimeHour(Auckland) >= LocalOpenHour && TimeHour(Auckland) < LocalCloseHour)
   	{
   	   ObjectSetText( "Aucklandl", "* Auckland", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Aucklandt", Aucklands, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Aucklandl", "Auckland", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Aucklandt", Aucklands, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowSydney || OverrideShowALL)
   {
   	//if (true)
   	if (TimeDayOfWeek(Sydney) != 0 && TimeDayOfWeek(Sydney) != 6 && Highlight_Market_Open && TimeHour(Sydney) >= SydneyLocalOpenHour && TimeHour(Sydney) < SydneyLocalCloseHour)
   	{
   	   ObjectSetText( "Sydneyl", "* Sydney", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Sydneyt", Sydneys, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Sydneyl", "Sydney", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Sydneyt", Sydneys, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowTokyo || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Tokyo) != 0 && TimeDayOfWeek(Tokyo) != 6 && Highlight_Market_Open && TimeHour(Tokyo) >= LocalOpenHour && TimeHour(Tokyo) < LocalCloseHour)
   	{
   	   ObjectSetText( "Tokyol", "* Tokyo", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Tokyot", Tokyos, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Tokyol", "Tokyo", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Tokyot", Tokyos, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowChina || OverrideShowALL)
   {
   	if (TimeDayOfWeek(China) != 0 && TimeDayOfWeek(China) != 6 && Highlight_Market_Open && TimeHour(China) >= LocalOpenHour && TimeHour(China) < LocalCloseHour)
   	{
   	   ObjectSetText( "Chinal", "* Hong Kong", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Chinat", Chinas, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Chinal", "Hong Kong", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Chinat", Chinas, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowJakarta || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Jakarta) != 0 && TimeDayOfWeek(Jakarta) != 6 && Highlight_Market_Open && TimeHour(Jakarta) >= LocalOpenHour && TimeHour(Jakarta) < LocalCloseHour)
   	{
   	   ObjectSetText( "Jakartal", "* Jakarta", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Jakartat", Jakartas, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Jakartal", "Jakarta", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Jakartat", Jakartas, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowIndia || OverrideShowALL)
   {
   	if (TimeDayOfWeek(India) != 0 && TimeDayOfWeek(India) != 6 && Highlight_Market_Open && TimeHour(India) >= LocalOpenHour && TimeHour(India) < LocalCloseHour)
   	{
   	   ObjectSetText( "Indial", "* India", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Indiat", Indias, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Indial", "India", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Indiat", Indias, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowMoscow || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Moscow) != 0 && TimeDayOfWeek(Moscow) != 6 && Highlight_Market_Open && TimeHour(Moscow) >= LocalOpenHour && TimeHour(Moscow) < LocalCloseHour)
   	{
   	   ObjectSetText( "Moscowl", "* Moscow", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Moscowt", Moscows, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Moscowl", "Moscow", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Moscowt", Moscows, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowIsrael || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Israel) != 0 && TimeDayOfWeek(Israel) != 6 && Highlight_Market_Open && TimeHour(Israel) >= LocalOpenHour && TimeHour(Israel) < LocalCloseHour)
   	{
   	   ObjectSetText( "Israell", "* Israel", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Israelt", Israels, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Israell", "Israel", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Israelt", Israels, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowHelsinki || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Helsinki) != 0 && TimeDayOfWeek(Helsinki) != 6 && Highlight_Market_Open && TimeHour(Helsinki) >= LocalOpenHour && TimeHour(Helsinki) < LocalCloseHour)
   	{
   	   ObjectSetText( "Helsinkil", "* Helsinki", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Helsinkit", Helsinkis, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Helsinkil", "Helsinki", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Helsinkit", Helsinkis, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowBerlin || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Berlin) != 0 && TimeDayOfWeek(Berlin) != 6 && Highlight_Market_Open && TimeHour(Berlin) >= LocalOpenHour && TimeHour(Berlin) < LocalCloseHour)
   	{
   	   ObjectSetText( "Berlinl", "* Frankfurt", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Berlint", Berlins, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Berlinl", "Frankfurt", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Berlint", Berlins, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(Show_DIBS_London || OverrideShowALL)
   {
   	if (TimeDayOfWeek(London) != 0 && TimeDayOfWeek(London) != 6 && Highlight_Market_Open && TimeHour(London) >= DIBS_LondonOpenHour && TimeHour(London) < DIBS_LondonCloseHour)
   	{
   	   ObjectSetText( "dibsl", "* DIBS UK", TimezoneFontSize, FontName, LabelMktOpenColor );
      	ObjectSetText( "dibst", Londons, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "dibsl", "DIBS UK", TimezoneFontSize, FontName, TimezoneColor );
      	ObjectSetText( "dibst", Londons, ClockFontSize, FontName,ClockColor );
      }
   }
   if(ShowLondon || OverrideShowALL)
   {
   	if (TimeDayOfWeek(London) != 0 && TimeDayOfWeek(London) != 6 && Highlight_Market_Open && TimeHour(London) >= LocalOpenHour && TimeHour(London) < LocalCloseHour)
   	{
      	ObjectSetText( "Londonl", "* London", TimezoneFontSize, FontName, LabelMktOpenColor );
      	ObjectSetText( "Londont", Londons, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Londonl", "London", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Londont", Londons, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowUTC_GMT || OverrideShowALL)
   {
   	ObjectSetText( "utcl", "UTC/GMT", TimezoneFontSize, FontName, TimezoneColor );
   	ObjectSetText( "utct", UTCs, ClockFontSize, FontName,ClockColor );
   }
   if(ShowBrazil || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Brazil) != 0 && TimeDayOfWeek(Brazil) != 6 && Highlight_Market_Open && TimeHour(Brazil) >= LocalOpenHour && TimeHour(Brazil) < LocalCloseHour)
   	{
   	   ObjectSetText( "Brazill", "* Brazil", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Brazilt", Brazils, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Brazill", "Brazil", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Brazilt", Brazils, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowNewYork || OverrideShowALL)
   {
   	if (TimeDayOfWeek(NewYork) != 0 && TimeDayOfWeek(NewYork) != 6 && Highlight_Market_Open && TimeHour(NewYork) >= LocalOpenHour && TimeHour(NewYork) < LocalCloseHour)
   	{
   	   ObjectSetText( "NewYorkl", "* New York", TimezoneFontSize, FontName, LabelMktOpenColor );
      	ObjectSetText( "NewYorkt", NewYorks, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "NewYorkl", "New York", TimezoneFontSize, FontName, TimezoneColor );
      	ObjectSetText( "NewYorkt", NewYorks, ClockFontSize, FontName,ClockColor );
      }
   }
   if(ShowCentral || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Central) != 0 && TimeDayOfWeek(Central) != 6 && Highlight_Market_Open && TimeHour(Central) >= LocalOpenHour && TimeHour(Central) < LocalCloseHour)
   	{
   	   ObjectSetText( "Centrall", "* Central", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Centralt", Centrals, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Centrall", "Central", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Centralt", Centrals, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowMexico || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Mexico) != 0 && TimeDayOfWeek(Mexico) != 6 && Highlight_Market_Open && TimeHour(Mexico) >= LocalOpenHour && TimeHour(Mexico) < LocalCloseHour)
   	{
   	   ObjectSetText( "Mexicol", "* Mexico", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Mexicot", Mexicos, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Mexicol", "Mexico", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Mexicot", Mexicos, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowMountain || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Mountain) != 0 && TimeDayOfWeek(Mountain) != 6 && Highlight_Market_Open && TimeHour(Mountain) >= LocalOpenHour && TimeHour(Mountain) < LocalCloseHour)
   	{
   	   ObjectSetText( "Mountainl", "* Mountain", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Mountaint", Mountains, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Mountainl", "Mountain", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Mountaint", Mountains, ClockFontSize, FontName,ClockColor );
   	}
   }
   if(ShowPacific || OverrideShowALL)
   {
   	if (TimeDayOfWeek(Pacific) != 0 && TimeDayOfWeek(Pacific) != 6 && Highlight_Market_Open && TimeHour(Pacific) >= LocalOpenHour && TimeHour(Pacific) < LocalCloseHour)
   	{
   	   ObjectSetText( "Pacificl", "* Seattle", TimezoneFontSize, FontName, LabelMktOpenColor );
   	   ObjectSetText( "Pacifict", Pacifics, ClockFontSize, FontName,ClockMktOpenColor );
   	}
   	else
   	{
   	   ObjectSetText( "Pacificl", "Seattle", TimezoneFontSize, FontName, TimezoneColor );
   	   ObjectSetText( "Pacifict", Pacifics, ClockFontSize, FontName,ClockColor );
   	}
   }
   if ( ShowLocal || OverrideShowALL)
   {
      ObjectSetText( "Locall", "Local", TimezoneFontSize, FontName, TimezoneColor );
      ObjectSetText( "Localt", Locals, ClockFontSize, FontName,ClockColor );
   }

   //----
   return(0);
} // end of start()


//+------------------------------------------------------------------+
//| Custom functions                                                 |
//+------------------------------------------------------------------+

string TimeToString( datetime when ) {
   string timeStr;
   int hour = TimeHour( when );
   if ( !Display_Times_With_AMPM ) 
     {
      if (Display_Time_With_Seconds) timeStr = (TimeToStr( when, TIME_MINUTES|TIME_SECONDS));
      else timeStr = (TimeToStr( when, TIME_MINUTES));
     }
   else
     {
      // User wants 12HourTime format with "AM" or "PM".   
      // FYI, if >12:00, subtract 12 hours in seconds which is 12*60*60=43200
      if (Display_Time_With_Seconds)
        {
         if ( hour >  12 || hour == 0) timeStr = TimeToStr( (when - 43200), TIME_MINUTES|TIME_SECONDS);
         else timeStr = TimeToStr( when, TIME_MINUTES|TIME_SECONDS);
         if ( hour >= 12) timeStr = StringConcatenate(timeStr, " PM");
         else timeStr = StringConcatenate(timeStr, " AM");
        }
      else
        {
         if ( hour >  12 || hour == 0) timeStr = TimeToStr( (when - 43200), TIME_MINUTES);
         else timeStr = TimeToStr( when, TIME_MINUTES);
         if ( hour >= 12) timeStr = StringConcatenate(timeStr, " PM");
         else timeStr = StringConcatenate(timeStr, " AM");
        }
     }
   return (timeStr);
} // end of TimeToString
//+------------------------------------------------------------------+


int ObjectMakeLabel( string n, int xoff, int yoff ) {
   if (!WindowIsVisible(WindowNumber)) return(-1);
   ObjectCreate( n, OBJ_LABEL, WindowNumber, 0, 0 );
   ObjectSet( n, OBJPROP_CORNER, LabelCorner );
   ObjectSet( n, OBJPROP_XDISTANCE, xoff );
   ObjectSet( n, OBJPROP_YDISTANCE, yoff );
   ObjectSet( n, OBJPROP_BACK, false );
   if (ObjectFind(n) >= 0) FLAG_LABELEXISTS = true; // If NO label exists then start() may run init() again.
} // end of ObjectMakeLabel
//+------------------------------------------------------------------+

string FormatDateTime(int nYear,int nMonth,int nDay,int nHour,int nMin,int nSec)
  {
   string sMonth,sDay,sHour,sMin,sSec;
   sMonth=100+nMonth;
   sMonth=StringSubstr(sMonth,1);
   sDay=100+nDay;
   sDay=StringSubstr(sDay,1);
   sHour=100+nHour;
   sHour=StringSubstr(sHour,1);
   sMin=100+nMin;
   sMin=StringSubstr(sMin,1);
   sSec=100+nSec;
   sSec=StringSubstr(sSec,1);
   return(StringConcatenate(nYear,".",sMonth,".",sDay," ",sHour,":",sMin,":",sSec));
} // end of FormatDateTime
//+------------------------------------------------------------------+

datetime TimeArrayToTime(int& LocalTimeArray[])
{
   //---- parse date and time from array
   
   int    nYear,nMonth,nDOW,nDay,nHour,nMin,nSec,nMilliSec;
   //string sMilliSec;

   nYear=LocalTimeArray[0]&0x0000FFFF;
   nMonth=LocalTimeArray[0]>>16;
   //nDOW=LocalTimeArray[1]&0x0000FFFF;
   nDay=LocalTimeArray[1]>>16;
   nHour=LocalTimeArray[2]&0x0000FFFF;
   nMin=LocalTimeArray[2]>>16;
   nSec=LocalTimeArray[3]&0x0000FFFF;
   nMilliSec=LocalTimeArray[3]>>16;
   string LocalTimeS = FormatDateTime(nYear,nMonth,nDay,nHour,nMin,nSec);
   datetime Local_Time = StrToTime( LocalTimeS );
   return(Local_Time);
} // end of TimeArrayToTime
//+------------------------------------------------------------------+

void GetAllTimeZoneInfo(int& AucklandTZInfoArray[], int& SydneyTZInfoArray[], int& TokyoTZInfoArray[], int& ChinaTZInfoArray[], int& JakartaTZInfoArray[], 
      int& IndiaTZInfoArray[], int& MoscowTZInfoArray[], int& IsraelTZInfoArray[], int& HelsinkiTZInfoArray[], int& BerlinTZInfoArray[], int& LondonTZInfoArray[], int& BrazilTZInfoArray[],
      int& NewYorkTZInfoArray[], int& CentralTZInfoArray[], int& MexicoTZInfoArray[], int& MountainTZInfoArray[], int& PacificTZInfoArray[], int& LocalTZInfoArray[])
{
   int dst=GetTimeZoneInformation(LocalTZInfoArray);
   // Note: the dst return info is no longer used.  However, FYI, the Return info is: dst =
   //  0 = Your Local TZ does not switch between Std Time and DST (e.g. Tokyo, Jakarta)
   //  1 = Your Local TZ does switch to DST, but is presently on ST
   //  2 = Your Local TZ does switch to DST and is presently on DST
   //
   // FYI:  LocalTZInfoArray[n] =
   //   0 = bias, in minutes(!)    // ************* This is important and used below
   //   1-16 TZ-standard-name
   //   17-20 = StdTimeArray       // ************* This is important and used below
   //   21 = std-bias              // ************* This is important and used below
   //   22-37 = TZ-daylight-name
   //   38-41 = DaylightTimeArray  // ************* This is important and used below
   //   42 = dst-bias              // ************* This is important and used below
   
   // FYI:
   // From: http://www.tech-archive.net/Archive/DotNet/microsoft.public.dotnet.framework.interop/2005-05/msg00278.html
   //"To select the correct day in the month, set the wYear member to zero, the 
   //wHour and wMinute members to the transition time, the wDayOfWeek member to 
   //the appropriate weekday, and the wDay member to indicate the occurence of the 
   //day of the week within the month (first through fifth). 
   //
   //"Using this notation, specify the 2:00a.m. on the first Sunday in April as 
   //follows: wHour = 2, wMonth = 4, wDayOfWeek = 0, wDay = 1. Specify 2:00a.m. on 
   //the last Thursday in October as follows: wHour = 2, wMonth = 10, wDayOfWeek = 
   //4, wDay = 5."
   
   // 1<<16  = 065536 // Syntax 1<<16 is take the # and bitwise-shift it to the left 16 bits. The new (least significant) right-bits are zeros.
   // 2<<16  = 131072
   // 3<<16  = 196608
   // 4<<16  = 262144
   // 5<<16  = 327680
   // 6<<16  = 393216
   // 7<<16  = 458752
   // 8<<16  = 524288
   // 9<<16  = 589824
   // 10<<16 = 655360
   // 11<<16 = 720896
   // 12<<16 = 786432
   
   // FYI, for all the TZ ST/DST dates, the wYear=0 and wDay= the # for wDayOfWeek IN the month, e.g. wDayOfWeek=0 and wDay=1 means 1st Sunday.
   // Consequently, these numbers should be good into perpetuity, until of course, countries legistlatively change 
   // their DST/ST changeover dates. (e.g. Tokyo is considering DST, and the US changed it's dates not long ago)
   //ArrayCopy(NewYorkTZInfoArray, LocalTZInfoArray); // Not necessary. All key fields set below.
   AucklandTZInfoArray[0] = -720;
   AucklandTZInfoArray[17] = 262144; // 4<<16 == 262144  April
   AucklandTZInfoArray[18] = 65536;  // 1<<16 == 65536   1st Sunday
   AucklandTZInfoArray[19] = 3;
   AucklandTZInfoArray[20] = 0;
   AucklandTZInfoArray[21] = 0;
   AucklandTZInfoArray[38] = 589824; // 9<<16 == 589824  September
   AucklandTZInfoArray[39] = 327680; // 5<<16 == 327680  5th/Last Sunday
   AucklandTZInfoArray[40] = 2;
   AucklandTZInfoArray[41] = 0;
   AucklandTZInfoArray[42] = -60;
   
   SydneyTZInfoArray[0] = -600;
   SydneyTZInfoArray[17] = 262144; // 4<<16 == 262144  April
   SydneyTZInfoArray[18] = 65536;  // 1<<16 == 65536   1st Sunday
   SydneyTZInfoArray[19] = 3;
   SydneyTZInfoArray[20] = 0;
   SydneyTZInfoArray[21] = 0;
   SydneyTZInfoArray[38] = 655360; // 10<<16 == 655360  October
   SydneyTZInfoArray[39] = 65536;  // 1<<16 == 65536    1st Sunday
   SydneyTZInfoArray[40] = 2;
   SydneyTZInfoArray[41] = 0;
   SydneyTZInfoArray[42] = -60;
   
   // FYI Tokyo = Seoul
   TokyoTZInfoArray[0] = -540;
   TokyoTZInfoArray[17] = 0; 
   TokyoTZInfoArray[18] = 0;
   TokyoTZInfoArray[19] = 0;
   TokyoTZInfoArray[20] = 0;
   TokyoTZInfoArray[21] = 0;
   TokyoTZInfoArray[38] = 0;
   TokyoTZInfoArray[39] = 0;
   TokyoTZInfoArray[40] = 0;
   TokyoTZInfoArray[41] = 0;
   TokyoTZInfoArray[42] = 0;
   
   // FYI, Beijing = Perth, Singapore, Taipei
   ArrayCopy(ChinaTZInfoArray, TokyoTZInfoArray);
   ChinaTZInfoArray[0] = -480;
   
   // FYI, Jakarta = Bangkok
   ArrayCopy(JakartaTZInfoArray, TokyoTZInfoArray);
   JakartaTZInfoArray[0] = -420;
   
   ArrayCopy(IndiaTZInfoArray, TokyoTZInfoArray);
   IndiaTZInfoArray[0] = -330;  // NOTE! Top of the hour is 30 min off most world timezones.
   
   // Moscow is further below
   
   // FYI, Cairo ST/DST dates may be hardcoded and might need annual updating! (These were obtained Nov 2009)
   //CairoTZInfoArray[0] = -120;
   //CairoTZInfoArray[17] = 589824; 
   //CairoTZInfoArray[18] = 327684;
   //CairoTZInfoArray[19] = 3866647;
   //CairoTZInfoArray[20] = 65470523;
   //CairoTZInfoArray[21] = 0;
   //CairoTZInfoArray[38] = 262144;
   //CairoTZInfoArray[39] = 327684;
   //CairoTZInfoArray[40] = 3866647;
   //CairoTZInfoArray[41] = 65470523;
   //CairoTZInfoArray[42] = -60;
   
   IsraelTZInfoArray[0] = -120;
   IsraelTZInfoArray[17] = 589824;  // 9<<16 == 589824  September
   IsraelTZInfoArray[18] = 131072;  // 2<<16  = 131072
   IsraelTZInfoArray[19] = 2;
   IsraelTZInfoArray[20] = 0;
   IsraelTZInfoArray[21] = 0;
   IsraelTZInfoArray[38] = 196608; // 3<<16 == 196608  March
   IsraelTZInfoArray[39] = 327685; // 5<<16  = 327680 AND "5" (*IF* Sunday is "0", is "5" Friday??)
   IsraelTZInfoArray[40] = 2;
   IsraelTZInfoArray[41] = 0;
   IsraelTZInfoArray[42] = -60;
   
   // Helsinki (-120) is further below
   // Berlin (-60) is further below
   
   LondonTZInfoArray[0] = 0;
   LondonTZInfoArray[17] = 655360; // 10<<16 == 655360  October
   LondonTZInfoArray[18] = 327680; // 5<<16 == 327680.  5th/Last Sunday. BECAUSE this is already "5" even though in 2008 the last Sunday in Oct is the 4th Sunday, this must mean "last" Sunday.
   LondonTZInfoArray[19] = 2;
   LondonTZInfoArray[20] = 0;
   LondonTZInfoArray[21] = 0;
   LondonTZInfoArray[38] = 196608; // 3<<16 == 196608  March
   LondonTZInfoArray[39] = 327680; // 5<<16 == 327680  5th/Last Sunday
   LondonTZInfoArray[40] = 1;
   LondonTZInfoArray[41] = 0;
   LondonTZInfoArray[42] = -60;
   
   ArrayCopy(MoscowTZInfoArray, LondonTZInfoArray);
   MoscowTZInfoArray[0] = -180;
   MoscowTZInfoArray[19] = 3;
   MoscowTZInfoArray[40] = 2;
   
   // FYI, Helsinki = Athens
   ArrayCopy(HelsinkiTZInfoArray, LondonTZInfoArray);
   HelsinkiTZInfoArray[0] = -120;
   HelsinkiTZInfoArray[19] = 4;
   HelsinkiTZInfoArray[40] = 3;
   
   // FYI, Berlin = Belgrade, Brussels, Paris, Sarajevo
   ArrayCopy(BerlinTZInfoArray, MoscowTZInfoArray);
   BerlinTZInfoArray[0] = -60;
   
   // NOTE! Brazil's ST/DST is likely a hardcoded date which will need updating EVERY YEAR!
   BrazilTZInfoArray[0] = 180;
   BrazilTZInfoArray[17] = 131072;   // 2<<16  = 131072
   BrazilTZInfoArray[18] = 196614;   // 3<<16 == 196608 AND 6, so, Saturday?? or Mar 6?
   BrazilTZInfoArray[19] = 3866647;
   BrazilTZInfoArray[20] = 65470523;
   BrazilTZInfoArray[21] = 0;
   BrazilTZInfoArray[38] = 655360;   // 10<<16 == 655360
   BrazilTZInfoArray[39] = 196614;
   BrazilTZInfoArray[40] = 3866647;
   BrazilTZInfoArray[41] = 65470523;
   BrazilTZInfoArray[42] = -60;
   
   //ArrayCopy(BuenasAriesTZInfoArray, BuenasAriesTZInfoArray);
   //BuenasAriesTZInfoArray[0] = 180;
   
   NewYorkTZInfoArray[0] = 300;
   NewYorkTZInfoArray[17] = 720896; // wYear = 0. wMonth = 11, and 11<<16 == 720896
   NewYorkTZInfoArray[18] = 65536;  // wDOW = 0 = Sunday. nDay = 1 and 1<<16 == 65536 // NOTE! When wYear = 0, wDay is the # for wDOW IN the month. 1 = 1st... Sunday for example.
   NewYorkTZInfoArray[19] = 2;
   NewYorkTZInfoArray[20] = 0;
   NewYorkTZInfoArray[21] = 0;
   NewYorkTZInfoArray[38] = 196608; // 3<<16 == 196608  March
   NewYorkTZInfoArray[39] = 131072; // 2<<16 == 131072  2nd Sunday
   NewYorkTZInfoArray[40] = 2;
   NewYorkTZInfoArray[41] = 0;
   NewYorkTZInfoArray[42] = -60;
   
   ArrayCopy(CentralTZInfoArray, NewYorkTZInfoArray);
   CentralTZInfoArray[0] = 360;
   
   //ArrayCopy(CenAmerTZInfoArray, TokyoTZInfoArray);
   //CenAmerTZInfoArray[0] = 360;
   
   MexicoTZInfoArray[0] = 360;
   MexicoTZInfoArray[17] = 655360; // 10<<16 == 655360  October
   MexicoTZInfoArray[18] = 327680; // 5<<16 == 327680  5th/Last Sunday
   MexicoTZInfoArray[19] = 2;
   MexicoTZInfoArray[20] = 0;
   MexicoTZInfoArray[21] = 0;
   MexicoTZInfoArray[38] = 262144; // 4<<16 == 262144  April
   MexicoTZInfoArray[39] = 65536;  // 1<<16 == 65536   1st Sunday
   MexicoTZInfoArray[40] = 2;
   MexicoTZInfoArray[41] = 0;
   MexicoTZInfoArray[42] = -60;
   
   ArrayCopy(MountainTZInfoArray, NewYorkTZInfoArray);
   MountainTZInfoArray[0] = 420;
   
   ArrayCopy(PacificTZInfoArray, NewYorkTZInfoArray);
   PacificTZInfoArray[0] = 480;
   
} // end of GetAllTimeZoneInfo
//+------------------------------------------------------------------+

void writeLocalTZInfoToFile(string filename, bool AllTZData)
{
   int    TimeArray[4];
   //int    TZInfoArray[43];
   int    z[43];
   int dst=GetTimeZoneInformation(z);
   
   if (ObjectFind("timezone") < 0)
   {
      Alert(WindowExpertName(),": Open your Terminal window. Go to Experts tab for timezone update instructions!");
      Print(WindowExpertName(),": If the market zone ST/DST changeover dates change, or to ADD a new market zone, do these steps!");
      Print("... First check for any program updates at: http://forexfactory.com/showthread.php?t=109305");
      Print("... If no update, you can start editing the version you already have.");
      Print("... First temporarily set your CPU clock to the NewYork Eastern US timezone.");
      Print("... Next create a text. Make the name 'timezone'. Make the description 'NewYork'.");
      Print("... Change chart period JUST ONCE -- the file will be appended each change!");
      Print("... Repeat steps to change CPU clock and text for GMT, Tokyo, Sydney, etc.");
      Print("... Start Excel. Open a blank file. Go to Data => Import External Data => Import Data");
      Print("... Import the file: ",TerminalPath(),"\x5Cexperts\x5Cfiles\x5C",filename);
      Print("... The file is Tab delimited and should provide simple readable columns of data");
      Print("... In MetaEditor, open: ",WindowExpertName(),".mq4, search for: NewYorkTZInfoArray[17]"); 
      Print("... Change all array values for all timezones according to your Excel spreadsheet");
      Print("... If you THOUGHT you just wrote data but you see this again, you missed a step.");
      Print("... Check your text name/description and try again...");
      Print("... When finished... change CPU clock back to normal. Change the timezone update boolean back to FALSE");
      return(0);
   }
   string tzname = ObjectDescription("timezone");
   
   int handle;
   handle = FileOpen(filename,FILE_READ,"\t");
   if (handle<0)
   {
      // If file does not exist, open new file and write a single line with column labels and then close it.
      handle = FileOpen(filename,FILE_CSV|FILE_READ|FILE_WRITE,"\t");
      if(handle<0) 
        {
         Print(filename," OPEN Error: ",GetLastError());
         return(0);
        }
      else FileSeek(handle,0,SEEK_END);
   
      if (AllTZData) 
      {
         FileWrite(handle, 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,"tzname");
      }
      else 
      {
         FileWrite(handle, 0,17,18,19,20,21,38,39,40,41,42,"tzname");
      }
      FileClose(handle);
   }
   
   // File should exist by now.
   handle = FileOpen(filename,FILE_CSV|FILE_READ|FILE_WRITE,"\t");
   if(handle<0) 
     {
      Print(filename," OPEN Error: ",GetLastError());
      return(0);
     }
   else FileSeek(handle,0,SEEK_END);
   
   if (AllTZData)
   {
      FileWrite(handle, z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7], z[8], z[9], z[10], z[11], z[12], z[13], z[14], z[15], z[16], z[17], z[18], z[19],
         z[20], z[21], z[22], z[23], z[24], z[25], z[26], z[27], z[28], z[29], z[30], z[31], z[32], z[33], z[34], z[35], z[36], z[37], z[38], z[39], z[40], z[41], z[42], tzname);
   }
   else
   {
      FileWrite(handle, z[0], z[17], z[18], z[19], z[20], z[21], z[38], z[39], z[40], z[41], z[42], tzname);
   
   }
   FileClose(handle);
   Print(WindowExpertName(),": ",tzname," data written to ",TerminalPath(),"\x5Cexperts\x5Cfiles\x5C",filename);
} // end of writeLocalTZInfoToFile


//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
{	
   ObjectDelete("P4L Background");    
   //----
   if(ShowBarTime || OverrideShowALL) { ObjectDelete( "barl" ); ObjectDelete( "bart" ); }
   if(ShowBroker || OverrideShowALL) { ObjectDelete( "Brokerl" ); ObjectDelete( "Brokert" ); }
   if(ShowAuckland || OverrideShowALL) { ObjectDelete( "Aucklandl" ); ObjectDelete( "Aucklandt" ); }
   if(ShowSydney || OverrideShowALL) { ObjectDelete( "Sydneyl" ); ObjectDelete( "Sydneyt" ); }
   if(ShowTokyo || OverrideShowALL) { ObjectDelete( "Tokyol" ); ObjectDelete( "Tokyot" ); }
   if(ShowChina || OverrideShowALL) { ObjectDelete( "Chinal" ); ObjectDelete( "Chinat" ); }
   if(ShowJakarta || OverrideShowALL) { ObjectDelete( "Jakartal" ); ObjectDelete( "Jakartat" ); }
   if(ShowIndia || OverrideShowALL) { ObjectDelete( "Indial" ); ObjectDelete( "Indiat" ); }
   if(ShowMoscow || OverrideShowALL) { ObjectDelete( "Moscowl" ); ObjectDelete( "Moscowt" ); }
   if(ShowIsrael || OverrideShowALL) { ObjectDelete( "Israell" ); ObjectDelete( "Israelt" ); }
   if(ShowHelsinki || OverrideShowALL) { ObjectDelete( "Helsinkil" ); ObjectDelete( "Helsinkit" ); }
   if(ShowBerlin || OverrideShowALL) { ObjectDelete( "Berlinl" ); ObjectDelete( "Berlint" ); }
   if(Show_DIBS_London || OverrideShowALL) { ObjectDelete( "dibsl" ); ObjectDelete( "dibst" ); }
   if(ShowLondon || OverrideShowALL) { ObjectDelete( "Londonl" ); ObjectDelete( "Londont" ); }
   if(ShowUTC_GMT || OverrideShowALL) { ObjectDelete( "utcl" ); ObjectDelete( "utct" ); }
   if(ShowBrazil || OverrideShowALL) { ObjectDelete( "Brazill" ); ObjectDelete( "Brazilt" ); }
   if(ShowNewYork || OverrideShowALL) { ObjectDelete( "NewYorkl" ); ObjectDelete( "NewYorkt" ); }
   if(ShowCentral || OverrideShowALL) { ObjectDelete( "Centrall" ); ObjectDelete( "Centralt" ); }
   if(ShowMexico || OverrideShowALL) { ObjectDelete( "Mexicol" ); ObjectDelete( "Mexicot" ); }
   if(ShowMountain || OverrideShowALL) { ObjectDelete( "Mountainl" ); ObjectDelete( "Mountaint" ); }
   if(ShowPacific || OverrideShowALL) { ObjectDelete( "Pacificl" ); ObjectDelete( "Pacifict" ); }
   if(ShowLocal || OverrideShowALL) { ObjectDelete( "Locall" ); ObjectDelete( "Localt" ); }
   
   //----
   return(0);
} // end of deinit()

