← К каталогу
Исходный код · ID 2897

P4L Clock

p4l clock.mq5
Вы автор или правообладатель?

Сообщите нам, если считаете, что материал размещён без разрешения.

Краткий обзор

О программе

P4L Clock — это пользовательский индикатор для MetaTrader 4, отображающий на графике мировое время в нескольких часовых зонах одновременно. Индикатор автоматически учитывает переходы на летнее/зимнее время для каждой зоны и меняет цвет отображения в зависимости от того, находится ли рынок в рабочие или нерабочие часы.

Помимо часов, индикатор способен показывать данные текущей свечи: диапазон High-Low в пипсах, открытие-закрытие (Open-to-Close), объём, спред, цену Bid, а также средние периодические (APR) и дневные (ADR) диапазоны. Отображение каждого элемента включается и выключается отдельно через настройки.

Индикатор использует вызовы Windows API (DLL) для получения локального времени компьютера и информации о часовых зонах. Для корректной работы требуется включённая опция «Разрешить импорт DLL» в настройках MT4. Обновления данных часовых зон требуют ежегодной актуализации в коде.

Встроены механизмы оповещений: всплывающие алерты при высоком объёме свечи и низком спреде, а также возможность отрисовки стрелок на графике при низком спреде. Индикатор поддерживает размещение меток в четырёх углах графика с настройкой смещений, шрифтов и цветов.

Настройки программы

НастройкаОписание
DEV code version (_Version_v2_12__2014_Mar_19) _Version_v2_12__2014_Mar_19 — Текстовый параметр версии кода (DEV).
Easy method to disable without removing indicator. (Indicator_On) Indicator_On — Переключатель для отключения отображения меток без удаления индикатора с графика.
_INFO_Set_your_computer_clock _INFO_Set_your_computer_clock — Информационный текстовый параметр с предупреждением о зависимости от локальных часов компьютера.
_INFO_Re_LabelCorner _INFO_Re_LabelCorner — Информационный текстовый параметр с описанием значений LabelCorner.
0=top-left; 1=top-right; 2=bottom-left; 3=bottom-right (LabelCorner) LabelCorner — Угол размещения меток на графике: 0 — верхний левый, 1 — верхний правый, 2 — нижний левый, 3 — нижний правый.
0=main chart window. >=1 are sub-windows BUT they must already exist (e.g. add RSI to create a sub-w (DrawInWindowNumber DrawInWindowNumber — Номер окна для отображения меток. 0 — основной график. Значения >=1 — подокна, которые должны уже существовать (например, добавить RSI).
false = Normal top-to-bottom order: Bar,Broker, then NZ to Asia to Europe to US (ReverseLabelOrder) ReverseLabelOrder — Если false, метки отображаются сверху вниз: Bar, Broker, затем от Новой Зеландии до США. Если true, порядок меняется на обратный.
5 pixels from top (or bottom) to show the 1st clock. Note (min. of 12 is forced if LabelCorner=0,top (VerticalOffsetPixe VerticalOffsetPixels — Вертикальное смещение первой метки от верхнего (или нижнего) края в пикселях. Минимум 12 пикселей при LabelCorner=0 (верхний левый).
5 pixels from left (or right) to show the 1st clock (HorizClockOffsetPixels) HorizClockOffsetPixels — Горизонтальное смещение меток часов от левого (или правого) края графика в пикселях.
42 pixels from left (or right) to show the 1st timezone (HorizTimezoneOffsetPixels) HorizTimezoneOffsetPixels — Горизонтальное смещение меток часовых зон от левого (или правого) края графика в пикселях.
Green. Color of label, off-hours. Alt: Blk: LimeGreen Wht: SlateGray or C'103,118,133' (TimezoneColor) TimezoneColor — Цвет меток часовых зон в нерабочие часы рынка.
SteelBlue. Color of clock, off-hours Blk: CornflowerBlue Wht: Blue (ClockColor) ClockColor — Цвет меток часов в нерабочие часы рынка.
Red. Color of label, market-open Blk: Red Wht: MidnightBlue (LabelMktOpenColor) LabelMktOpenColor — Цвет меток в рабочие часы рынка.
OrangeRed. Color of clock, market-open Blk: DarkOrange Wht: Crimson (ClockMktOpenColor) ClockMktOpenColor — Цвет меток часов в рабочие часы рынка.
HigherPriceVolumeColor HigherPriceVolumeColor — Цвет значений цены и объёма, когда текущее значение выше предыдущего.
LowerPriceVolumeColor LowerPriceVolumeColor — Цвет значений цены и объёма, когда текущее значение ниже предыдущего.
LowSpreadArrowColor LowSpreadArrowColor — Цвет стрелок низкого спреда.
119 = tiny diamond (LowSpreadArrowCode) LowSpreadArrowCode — Код стрелки для отметки низкого спреда (по умолчанию 119 — маленький ромб).
"Arial" Wht-or-Blk: "Arial Bold" or "Arial" are good choices. (FontName) FontName — Имя шрифта для отображения меток. Рекомендуются «Arial Bold» или «Arial».
10 Wht-or-Blk: 10, or Blk: 9 (TimezoneFontSize) TimezoneFontSize — Размер шрифта меток часовых зон.
9 (ClockFontSize) ClockFontSize — Размер шрифта меток часов.
14 or 13 (LineSpacing) LineSpacing — Вертикальное расстояние между метками в пикселях.
True=show 12 hour AM/PM time, false=show 24 hour time (Display_Times_With_AMPM) Display_Times_With_AMPM — Если true, отображает время в 12-часовом формате с AM/PM. Если false — в 24-часовом формате.
Turn on seconds for timezone clocks. (Display_Time_With_Seconds) Display_Time_With_Seconds — Если true, отображает секунды в метках часовых зон.
When true, the above market-open colors are used between 8AM - 5PM (market Local) (Highlight_Market_Open) Highlight_Market_Open — Если true, в рабочие часы рынка (LocalOpenHour–LocalCloseHour) используются цвета Market Open для меток и часов.
Almost all local markets are assumed open 8AM to 5PM (LocalOpenHour) LocalOpenHour — Час открытия локального рынка (по умолчанию 8:00).
LocalCloseHour LocalCloseHour — Час закрытия локального рынка (по умолчанию 17:00).
Sydney market Local is 7am-4pm per FF Aussie user "NuckingFuts" (SydneyLocalOpenHour) SydneyLocalOpenHour — Час открытия местного рынка Сиднея (по умолчанию 7:00).
SydneyLocalCloseHour SydneyLocalCloseHour — Час закрытия местного рынка Сиднея (по умолчанию 16:00).
Tokyo market Local is 9am-6pm per FF MarketHours tool and several users. (TokyoLocalOpenHour) TokyoLocalOpenHour — Час открытия местного рынка Токио (по умолчанию 9:00).
TokyoLocalCloseHour TokyoLocalCloseHour — Час закрытия местного рынка Токио (по умолчанию 18:00).
Control "Bar Left:" to display ":SS" independently from other times. (Display_Bar_With_Seconds) Display_Bar_With_Seconds — Управляет отображением секунд в строке «Bar Left»: 0 — нет, 1 — всегда, 2 — автоматически (если менее 120 секунд или Display_Time_With_Seconds = true).
For "Bar Left:" on H1 and below, display only [MM:SS] since HH in [HH:MM:SS] is always "00" (Suppress_Bar_HH_Below_H1) Suppress_Bar_HH_Below_H1 — Если true, для таймфреймов H1 и ниже в строке Bar Left отображается только [MM:SS], так как HH в [HH:MM:SS] всегда «00».
If true, make a correction up to a few seconds/minutes vs. your Local CPU clock. FYI, we don't know (Broker_MMSS_Is_Gold Broker_MMSS_Is_Gold_Standard — Если true, вносит коррекцию до нескольких секунд/минут к локальному времени компьютера для приближения к времени брокера.
How many bars to consider when looking for high volume. (HighVolumeBarsCompared) HighVolumeBarsCompared — Количество баров для анализа при определении высокого объёма.
Flag if volume is >= the Nth highest volume of the last HighVolumeBarsCompared. Highlighted with red (Above_The_Nth_High Above_The_Nth_Highest_Volume — Порог для определения высокого объёма: свечи с объёмом не ниже N-го по величине из последних HighVolumeBarsCompared помечаются как высокие.
Popup alert if High Volume Bar (DoHighVolumeAlerts) DoHighVolumeAlerts — Если true, при высоком объёме свечи (объём >= Above_The_Nth_Highest_Volume) выводится всплывающее оповещение.
If true, extra-digit-brokers "pips" multiplied by 1/10th to get standard pips. (AutoPipTenthsFor5DigitBroker) AutoPipTenthsFor5DigitBroker — Если true, для пятизначных брокеров значение пипсов делится на 10 для получения стандартных пипсов.
_INFO_MUST_change_LowSpread _INFO_MUST_change_LowSpread — Информационный текстовый параметр с напоминанием о необходимости изменить порог LowSpread.
Any pip spread <+ threshold value is highlighted using ClockMktOpenColor. (LowSpreadHighlightThreshold) LowSpreadHighlightThreshold — Пороговое значение спреда в пипсах. Если спред меньше или равен этому значению, он подсвечивается цветом ClockMktOpenColor.
Popup alert if Low Spread if price >= threshold (default 0.0) (DoLowSpreadAlerts) DoLowSpreadAlerts — Если true, при низком спреде (спред <= LowSpreadHighlightThreshold) выводится всплывающее оповещение.
Mark chart with an arrow if Low Spread (DoLowSpreadArrows) DoLowSpreadArrows — Если true, на графике отрисовывается стрелка при низком спреде.
False, because Spread Arrows can NOT be recreated from history! They're based on live tick data only (Delete_Old_SpreadA Delete_Old_SpreadArrows — Если true, удаляет старые стрелки низкого спреда. По умолчанию false, так как стрелки основаны на данных текущего тика и не могут быть воссозданы из истории.
_INFO_Choose_what_to_display _INFO_Choose_what_to_display — Информационный текстовый параметр для раздела выбора отображаемых элементов.
OverrideShowALL OverrideShowALL — Если true, включает отображение всех часовых зон и элементов одновременно.
However, BarTime only shows if <= PERIOD_D1 (ShowBarTime) ShowBarTime — Отображать ли время до закрытия текущей свечи (Bar Left). Отображается только на таймфреймах до D1 включительно.
ShowBroker ShowBroker — Отображать ли время брокера.
ShowAuckland ShowAuckland — Отображать ли часовую зону Окленд.
ShowSydney ShowSydney — Отображать ли часовую зону Сидней.
ShowTokyo ShowTokyo — Отображать ли часовую зону Токио.
ShowChina ShowChina — Отображать ли часовую зону Китай.
ShowJakarta ShowJakarta — Отображать ли часовую зону Джакарта.
ShowIndia ShowIndia — Отображать ли часовую зону Индия.
ShowDubai ShowDubai — Отображать ли часовую зону Дубай.
ShowMoscow ShowMoscow — Отображать ли часовую зону Москва.
ShowIsrael ShowIsrael — Отображать ли часовую зону Израиль.
ShowHelsinki ShowHelsinki — Отображать ли часовую зону Хельсинки.
ShowBerlin ShowBerlin — Отображать ли часовую зону Берлин.
ShowLondon ShowLondon — Отображать ли часовую зону Лондон.
FYI, UTC_GMT does not change with Daylight Savings Time. In winter, London=UTC; in summer, London=UT (ShowUTC_GMT) ShowUTC_GMT — Отображать ли время UTC/GMT. UTC/GMT не меняется при переходе на летнее время.
ShowBrazil ShowBrazil — Отображать ли часовую зону Бразилия.
ShowNewYork ShowNewYork — Отображать ли часовую зону Нью-Йорк.
ShowCentral ShowCentral — Отображать ли часовую зону Central (Центральная США).
ShowMexico ShowMexico — Отображать ли часовую зону Мексика.
ShowMountain ShowMountain — Отображать ли часовую зону Mountain (Горная зона США).
ShowPacific ShowPacific — Отображать ли часовую зону Pacific (Тихоокеанская зона).
FYI, this is your Local computer clock. For accuracy, right-mouse on Clock -> Adjust Date/Time ->Int (ShowLocal) ShowLocal — Отображать ли локальное время компьютера.
ShowPipSpread ShowPipSpread — Отображать ли текущий спред (Ask-Bid) в пипсах.
Bid price (ShowBidPrice) ShowBidPrice — Отображать ли текущую цену Bid.
Note, in MT4 "tick" volume is not the same as true transaction-volume (which isn't available in FX) (ShowVolume) ShowVolume — Отображать ли объём текущей свечи. Примечание: в MT4 «тиковый» объём не равен истинному объёму сделок.
Current bar High-Low in pips. (ShowRange) ShowRange — Отображать ли текущий диапазон High-Low свечи в пипсах.
Current bar Open-to-(current)Close in pips. (ShowPips2open) ShowPips2open — Отображать ли разницу Open-to-Close текущей свечи в пипсах.
In pips. Any period, but if THIS period, then the color changes to indicate the range is above/below (ShowAvgPeriodRange ShowAvgPeriodRange — Отображать ли средний периодический диапазон (APR) в пипсах. Для любого периода. Если тот же период — меняется цвет для указания диапазона выше/ниже предыдущего бара.
In pips. DAILY, but if ShowAvgPeriodRange is already displaying Daily, this one is suppressed. (ShowAvgDailyRange) ShowAvgDailyRange — Отображать ли средний дневной диапазон (ADR) в пипсах. Если ShowAvgPeriodRange уже показывает дневной период с тем же количеством баров, ADR подавляется.
Current,0 or D,D1,Daily,M1440,1440 or H,H1,M60,60 or M#,# or ... etc. (APR_Period) APR_Period — Строковый параметр, задающий период для расчёта APR. Допустимые значения: Current, D, D1, Daily, M1440, H, H1, M60 и т.д.
Usually 1,5,10,20,... Note: A "trick" value of "1" gives the PREVIOUS Bar's range (APR_Bars) APR_Bars — Количество баров для расчёта среднего периодического диапазона (APR). Обычно 1, 5, 10, 20 и т.д. Значение 1 даёт диапазон предыдущего бара указанного периода.
Usually 1,5,10,20,... Note: A "trick" value of "1" gives the PREVIOUS (Daily) Bar's range (ADR_Bars) ADR_Bars — Количество баров для расчёта среднего дневного диапазона (ADR). Обычно 1, 5, 10, 20 и т.д. Значение 1 даёт диапазон предыдущего дневного бара.
For APR, when Period is H,Daily,Weekly,Monthly, the "P" is H,D,W,MN respectively. BUT, for others, i (APR_LabelShowsMinu APR_LabelShowsMinutes — Если true, метка APR использует обозначение минут (A#R), если период не стандартный (H, D, W, MN). Если false, используется префикс APR или буквенное обозначение периода.
FYI, for DIBS method, see http://www.forexfactory.com/showthread.php?t=86766 (Show_DIBS_London) Show_DIBS_London — Отображать ли дополнительные часы DIBS London с настраиваемыми временами открытия и закрытия.
_For_DIBS_info_go_to__ _For_DIBS_info_go_to__ — Текстовый параметр с URL-адресом для получения информации о методе DIBS.
DIBS relative to London Local time. 6 ~= 2 hours before London ~= Chicago midnight. (Follows London (DIBS_LondonOpenHour DIBS_LondonOpenHour — Час открытия для отображения DIBS London относительно локального времени Лондона.
MAX is 23!! Subjective choice. Change as desired. 9 hours length?? (Do NOT use # < DIBS_LondonOpenHo (DIBS_LondonCloseHo DIBS_LondonCloseHour — Час закрытия для отображения DIBS London (метод DIBS). Максимум 23. Не должно быть меньше DIBS_LondonOpenHour.
Normally false. True forces Broker_MMSS_Is_Gold_Standard=false as well. Clock updates are >=once-per (Weekend_Test_Mode) Weekend_Test_Mode — Если true, принудительно отключает Broker_MMSS_Is_Gold_Standard. Часы обновляются с каждым тиком, но на выходных часы брокера замораживаются.
Controls how wide the background beneath the labels is. "* New York" is the widest so far. (Background_AddWidth_Pixels) Background_AddWidth_Pixels — Ширина фоновой области под метками в пикселях. Определяет, насколько широким будет прямоугольник- фон под текстом.
Note: I prefer DIFFERENT from regular chart Background to know when prices are obscured! (Background_Color) Background_Color — Цвет фонового прямоугольника под метками. Рекомендуется выбирать цвет, отличающийся от фона графика, чтобы видеть, когда информация может быть закрыта свечами.
Put a background beneath the labels. The timezones stand out and are less obscured by price bars, li (Background_Under_L Background_Under_Labels — Если true, создаёт фоновый прямоугольник под метками, делая их менее заметными под ценовыми свечами и линиями.
Получить полный код

Поиск по коду файла

#property indicator_chart_window       //Uncomment this line if you prefer a MAIN-window display, AND... change "DrawInWindowNumber = 0" below!

#include <stdlib.mqh>

#import "kernel32.dll"

void GetLocalTime(int& LocalTimeArray[]);
void GetSystemTime(int& systemTimeArray[]);
int  GetTimeZoneInformation(int& LocalTZInfoArray[]);
bool SystemTimeToTzSpecificLocalTime(int& targetTZinfoArray[], int& systemTimeArray[], int& targetTimeArray[]);

#import

extern string   _Version_v2_12__2014_Mar_19   = "Donations welcome! PayPal p*******e*@yahoo.com"; // DEV code version
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      LabelCorner                   = 1;          // 0=top-left; 1=top-right; 2=bottom-left; 3=bottom-right

extern int      DrawInWindowNumber            = 0;          // 0=main chart window. >=1 are sub-windows BUT they must already exist (e.g. add RSI to create a sub-window 1).
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        = 5;          // 5 pixels from left (or right) to show the 1st clock
extern int      HorizTimezoneOffsetPixels     = 42;         // 42 pixels from left (or right) to show the 1st timezone

extern color    TimezoneColor                 = Green;      // Green. Color of label, off-hours.  Alt: Blk: LimeGreen      Wht: SlateGray or C'103,118,133'
extern color    ClockColor                    = SteelBlue;  // SteelBlue. Color of clock, off-hours    Blk: CornflowerBlue Wht: Blue
extern color    LabelMktOpenColor             = Red;        // Red. Color of label, market-open        Blk: Red            Wht: MidnightBlue
extern color    ClockMktOpenColor             = OrangeRed;  // OrangeRed. Color of clock, market-open  Blk: DarkOrange     Wht: Crimson
extern color    HigherPriceVolumeColor        = SteelBlue;
extern color    LowerPriceVolumeColor         = Red;
extern color    LowSpreadArrowColor           = HotPink;
extern int      LowSpreadArrowCode            = 119;        // 119 = tiny diamond

extern string   FontName                      = "Arial";    // "Arial" Wht-or-Blk: "Arial Bold" or "Arial" are good choices.
extern int      TimezoneFontSize              = 10;         // 10 Wht-or-Blk: 10, or Blk: 9
extern int      ClockFontSize                 = 9;          // 9
extern int      LineSpacing                   = 14;         // 14  or 13

extern bool     Display_Times_With_AMPM       = false;      // True=show 12 hour AM/PM time, false=show 24 hour time
extern bool 	 Display_Time_With_Seconds     = true ;      // Turn on seconds for timezone clocks.

extern bool     Highlight_Market_Open         = true ;      // When true, the above market-open colors are used between 8AM - 5PM (market Local) 
extern int      LocalOpenHour                 = 8;          // Almost all local markets are assumed open 8AM to 5PM
extern int      LocalCloseHour                = 17;
extern int      SydneyLocalOpenHour           = 7;          // Sydney market Local is 7am-4pm per FF Aussie user "NuckingFuts"
extern int      SydneyLocalCloseHour          = 16;
extern int      TokyoLocalOpenHour            = 9;          // Tokyo market Local is 9am-6pm per FF MarketHours tool and several users.
extern int      TokyoLocalCloseHour           = 18;
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      = 1;          // 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 int      HighVolumeBarsCompared        = 120;        // How many bars to consider when looking for high volume. 
extern int      Above_The_Nth_Highest_Volume  = 12;         // Flag if volume is >= the Nth highest volume of the last HighVolumeBarsCompared. Highlighted with red label "*HiVol*"
extern bool     DoHighVolumeAlerts            = false;      // Popup alert if High Volume Bar 

extern bool     AutoPipTenthsFor5DigitBroker  = true ;      // If true, extra-digit-brokers "pips" multiplied by 1/10th to get standard pips.
extern string   _INFO_MUST_change_LowSpread   = "...threshold to >0 pips for low-spread";
extern double   LowSpreadHighlightThreshold   = 0.0;        // Any pip spread <+ threshold value is highlighted using ClockMktOpenColor.
extern bool     DoLowSpreadAlerts             = false;      // Popup alert if Low Spread if price >= threshold (default 0.0)
extern bool     DoLowSpreadArrows             = false;      // Mark chart with an arrow if Low Spread
extern bool     Delete_Old_SpreadArrows       = false;      // False, because Spread Arrows can NOT be recreated from history! They're based on live tick data only. Once deleted, they're gone!

extern string   _INFO_Choose_what_to_display  = "=================";
extern bool     OverrideShowALL               = false;
extern bool     ShowBarTime                   = true ; //However, BarTime only shows if <= PERIOD_D1
extern bool     ShowBroker                    = false;
extern bool     ShowAuckland                  = false;
extern bool     ShowSydney                    = false;
extern bool     ShowTokyo                     = false;
extern bool     ShowChina                     = false;
extern bool     ShowJakarta                   = false;
extern bool     ShowIndia                     = false;
extern bool     ShowDubai                     = false;
extern bool     ShowMoscow                    = false;
extern bool     ShowIsrael                    = false;
extern bool     ShowHelsinki                  = false;
extern bool     ShowBerlin                    = false;
extern bool 	 ShowLondon                    = false;
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                   = false;
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     ShowPipSpread                 = true ; 
extern bool     ShowBidPrice                  = false; // Bid price
extern bool     ShowVolume                    = false; // Note, in MT4 "tick" volume is not the same as true transaction-volume (which isn't available in FX)
extern bool     ShowRange                     = true ; // Current bar High-Low in pips.
extern bool     ShowPips2open                 = false; // Current bar Open-to-(current)Close in pips.
extern bool     ShowAvgPeriodRange            = false ; // In pips. Any period, but if THIS period, then the color changes to indicate the range is above/below previous bar.
extern bool     ShowAvgDailyRange             = true ; // In pips. DAILY, but if ShowAvgPeriodRange is already displaying Daily, this one is suppressed.
extern string   APR_Period                    = "Current"; //Current,0  or  D,D1,Daily,M1440,1440  or  H,H1,M60,60  or  M#,#  or  ... etc.
extern int      APR_Bars                      = 5;     // Usually 1,5,10,20,...   Note: A "trick" value of "1" gives the PREVIOUS Bar's range
extern int      ADR_Bars                      = 6;     // Usually 1,5,10,20,...   Note: A "trick" value of "1" gives the PREVIOUS (Daily) Bar's range
extern bool     APR_LabelShowsMinutes         = true ; // For APR, when Period is H,Daily,Weekly,Monthly, the "P" is H,D,W,MN respectively. BUT, for others, if true, "P" is used, else "#" where #=Period()

extern bool     Show_DIBS_London              = false; // FYI, for DIBS method, see 
extern string   _For_DIBS_info_go_to__        = "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

extern int      Background_AddWidth_Pixels    = 47;    // Controls how wide the background beneath the labels is. "* New York" is the widest so far.
extern color    Background_Color              = Lavender; // Note: I prefer DIFFERENT from regular chart Background to know when prices are obscured!
extern bool     Background_Under_Labels       = true ; // Put a background beneath the labels.  The timezones stand out and are less obscured by price bars, lines, etc.

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!

string backName = "_P4L ClockBackground"; // The leading "_" is critical. It is alphabetically before the other labels on top of the background label.

int    AucklandTZInfoArray[43];
int    SydneyTZInfoArray[43];
int    TokyoTZInfoArray[43];
int    ChinaTZInfoArray[43];
int    JakartaTZInfoArray[43];
int    IndiaTZInfoArray[43];
int    DubaiTZInfoArray[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];

bool FLAG_LABELEXISTS = false;
bool FLAG_DEINIT = false;

int pipdigits = 0;
string pipstring = " p "; // intentional trailing space makes it more readable, but only for NON-extra-digit-brokers.
double pointdiv10;
double myPoint;
double lastprice = 0;
double lastapr;
datetime lastapradrtime = 0;
double lastadr;
int lastBars=0;
int lastBars_spread=0;
int lastBars_sp_arrows=0;
int lastBars_volume=0;
string periodstr;
bool obj_created=false;
int volarray[];

int apr_timeframe;

int init()
  {
      // код доступен только после оплаты
   } // end of init()

void createLabels()
{
   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;

   int adjustLeft = 0; //Basic 5 characters, HH:MM, no adjustment needed when using program defaults.
   if (ShowBarTime && Display_Bar_With_Seconds >= 1 && Period() <= PERIOD_D1 && (Period() > PERIOD_H1 || !Suppress_Bar_HH_Below_H1) ) adjustLeft = 37; // Up to 5+7=12 characters WIDE [ HH:MM:SS ]
   else if (ShowBarTime && Period() <= PERIOD_D1) adjustLeft = 16; // 5+4=9 characters [ HH:MM ]
   else if (ShowBidPrice || ShowVolume) adjustLeft = 14; // 7 characters 1.34567 or 123.567
   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

   if (ShowRange ||ShowPips2open || ShowAvgPeriodRange || ShowAvgDailyRange)
   {
      if (pipdigits == 1) adjustLeft = MathMax(adjustLeft,26);
      else adjustLeft = MathMax(adjustLeft,16);
   }

   left = left + adjustLeft;

   int offset=0;
   int revoffset=0;

   if (OverrideShowALL)
   {
      ShowBarTime = true;
      ShowBroker = true;
      ShowAuckland = true;
      ShowSydney = true;
      ShowTokyo = true;
      ShowChina = true;
      ShowJakarta = true;
      ShowIndia = true;
      ShowDubai = true;
      ShowMoscow = true;
      ShowIsrael = true;
      ShowHelsinki = true;
      ShowBerlin = true;
      Show_DIBS_London = true;
      ShowLondon = true;
      ShowUTC_GMT = true;
      ShowBrazil = true;
      ShowNewYork = true;
      ShowCentral = true;
      ShowMexico = true;
      ShowMountain = true;
      ShowPacific = true;
      ShowLocal = true;
      ShowPipSpread = true;
      ShowBidPrice = true;
      ShowVolume = true;
      ShowRange = true;
      ShowPips2open = true;
      ShowAvgPeriodRange = true;
      ShowAvgDailyRange = true;
   }

   if ( (ReverseLabelOrder && LabelCorner <= 1) || (!ReverseLabelOrder && LabelCorner >= 2)) //0=Top-left, 1=TR, 2=BL, 3=BR
   {
      int count = 0;
      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 (ShowDubai) 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++;
      if (ShowPipSpread) count++;
      if (ShowBidPrice) count++;
      if (ShowVolume) count++;
      if (ShowRange) count++;
      if (ShowPips2open) count++;
      if (ShowAvgPeriodRange) count++;
      if (ShowAvgDailyRange) count++;

      count--; // Decrement by 1 for the first label.
      if (ShowBarTime && Period() > PERIOD_D1) count--; // Decrement if this won't be displayed due to Period()
      if ((ShowAvgPeriodRange && ShowAvgDailyRange) && apr_timeframe == PERIOD_D1 && APR_Bars == ADR_Bars ) count--; // Decrement if APR is already the same ADR
      LineSpacing = MathAbs(LineSpacing); 
      offset = LineSpacing * count;
      revoffset = offset + LineSpacing; //adjust revoffset to 1 more
      LineSpacing = -1 * MathAbs(LineSpacing); //Just in case init() is run twice, use MathAbs to be sure final value is negative.
   } // end of if (... reverselabels)

   if (Background_Under_Labels)
   {

      if (ObjectFind(backName) == -1) ObjectCreate(backName, OBJ_LABEL, DrawInWindowNumber, 0, 0, 0, 0);
      for (int k=1; k<=8 ; k++ ) { if (ObjectFind(backName+k) == -1) ObjectCreate(backName+k, OBJ_LABEL, DrawInWindowNumber, 0, 0, 0, 0); }
   }

   if(ShowBarTime && Period() <= PERIOD_D1)
   {
      ObjectMakeLabel( "barl", left, top+offset );
      ObjectMakeLabel( "bart", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowBroker)
   {
      ObjectMakeLabel( "Brokerl", left, top+offset );
      ObjectMakeLabel( "Brokert", right, top+offset );
     	offset+=LineSpacing;
   }

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

   if(ShowPipSpread)
   {
      ObjectMakeLabel( "spreadl", left, top+offset );
      ObjectMakeLabel( "spreadt", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowBidPrice)
   {
      ObjectMakeLabel( "pricel", left, top+offset );
      ObjectMakeLabel( "pricet", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowVolume)
   {
      ObjectMakeLabel( "volumel", left, top+offset );
      ObjectMakeLabel( "volumet", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowRange)
   {
      ObjectMakeLabel( "rangel", left, top+offset );
      ObjectMakeLabel( "ranget", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowPips2open)
   {
      ObjectMakeLabel( "pips2openl", left, top+offset );
      ObjectMakeLabel( "pips2opent", right, top+offset );
      offset+=LineSpacing;
   }

   if(ShowAvgPeriodRange)
   {
      ObjectMakeLabel( "aprl", left, top+offset );
      ObjectMakeLabel( "aprt", right, top+offset );
      offset+=LineSpacing;
   }

   if ( ShowAvgDailyRange && ( !ShowAvgPeriodRange || ( ShowAvgPeriodRange && (apr_timeframe != PERIOD_D1 || APR_Bars != ADR_Bars) ) ) )
   {
      ObjectMakeLabel( "adrl", left, top+offset );
      ObjectMakeLabel( "adrt", right, top+offset );
      offset+=LineSpacing;
   }

   if (Background_Under_Labels)
   {

      offset = MathMax(offset,revoffset) + MathMax(0,VerticalOffsetPixels-5); // Related to total height of background created.
      int yB = MathMax(1,VerticalOffsetPixels - 2);
      if (LabelCorner == 0) yB = MathMax(11,yB); // The top-left corner must be below normal chart label. User can increase vert-offset. 
      int xB = MathMax(1,HorizClockOffsetPixels - 6);
 	   double bfactor = 1.1; // There is some extra pixels above and below the actual character size.
      string btext = "gg"; // A "g" is a simple filled box using the Webdings font. Double "gg" is the width of approx. the bfactor * 2 *  Bfontsize
 	   int Bfontsize = (MathMax(left,right) - HorizClockOffsetPixels + Background_AddWidth_Pixels)/StringLen(btext); 

      createBackground (backName,btext,Bfontsize,xB,yB);

      for (k=1; k<=8 ; k++ )
      {

         if (offset <= MathCeil(yB+Bfontsize*bfactor)) { ObjectDelete(backName+k); continue; } //break;

         yB = MathMin(yB+Bfontsize*bfactor, offset - Bfontsize*bfactor);
         createBackground (backName+k,btext,Bfontsize,xB,yB);
      }
   }

}

void createBackground (string objName, string text, int Bfontsize, int xB, int yB)
{
	   if (ObjectFind(objName) == -1){
         ObjectCreate(objName, OBJ_LABEL, DrawInWindowNumber, 0, 0, 0, 0);}

      ObjectSetText(objName, text, Bfontsize, "Webdings");      
      ObjectSet(objName, OBJPROP_CORNER, LabelCorner);
      ObjectSet(objName, OBJPROP_BACK, false);
      ObjectSet(objName, OBJPROP_XDISTANCE, xB);
      ObjectSet(objName, OBJPROP_YDISTANCE, yB );    
      ObjectSet(objName, OBJPROP_COLOR, Background_Color);
      return;
} // end of createBackground

int start()
  {
      // код доступен только после оплаты
   }
   static bool ranFirstTick;
   if (!ranFirstTick)
   {
      deinit();
      createLabels();
      ranFirstTick=true;
   }
   static datetime last_timecurrent;

   int counted_bars=IndicatorCounted();

   if(counted_bars<0) return(-1);
   int uncountedBars=Bars-counted_bars; // After the initial run through, a 2nd tick in the SAME current bar gives "1".  If a NEW bar, returns "2"

   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) 
   {

     init();  //Run init() again.

     last_timecurrent = 0; // Gets around weekend-mode issue.
   }

   static bool FLAG_WINDOWALERT = false;
   if (!FLAG_WINDOWALERT && !WindowIsVisible(DrawInWindowNumber))
   {
      Alert(WindowExpertName(),": ERROR, subwindow ",DrawInWindowNumber," was not found or is invisible. No labels drawn.");
      FLAG_WINDOWALERT = true;
   }

   static int peakVolThreshold;    // This is for build <=509, prior to major 2014-Feb-02 MT4 changes.

   if (ShowVolume && Bars != lastBars)
   {  
      lastBars=Bars;
      int volBarLimit=MathMin(HighVolumeBarsCompared,lastBars);
      for(int i=0; i<volBarLimit; i++) 
         { volarray[i] = Volume[i]; }

      ArraySort(volarray,WHOLE_ARRAY,0,MODE_DESCEND);
      int element = MathMin(volBarLimit,Above_The_Nth_Highest_Volume-1);
      peakVolThreshold = volarray[element];
   }

   if (!Weekend_Test_Mode && TimeCurrent() - last_timecurrent == 0) return(0); // 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    DubaiTimeArray[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 (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;
        }

   }   

   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(DubaiTZInfoArray, systemTimeArray, DubaiTimeArray);
   datetime Dubai   = TimeArrayToTime(DubaiTimeArray)+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 spreads;
   if (ShowPipSpread)
   {
      double spread =MathRound((Ask - Bid)/pointdiv10) * pointdiv10/myPoint;
      spreads = StringConcatenate(DoubleToStr(spread,pipdigits),pipstring); // 1/10ths of pips is normal on extra-digit broker
   }

   if (ShowBidPrice)
   {
      double price = Bid;
      string prices = DoubleToStr(price,Digits); 
   }

   if (ShowVolume)
   {
      string volumes = DoubleToStr(Volume[0],0); 
   }

   string ranges;
   if (ShowRange)
   {
      double range =MathRound((High[0] - Low[0])/pointdiv10) * pointdiv10/myPoint;
      ranges = StringConcatenate(DoubleToStr(range,pipdigits),pipstring); // 1/10ths of pips is normal on extra-digit broker
   }

   string pips2opens;
   if (ShowPips2open)
   {
      double pips2open =MathRound((Close[0] - Open[0])/pointdiv10) * pointdiv10/myPoint;
      pips2opens = StringConcatenate(DoubleToStr(pips2open,pipdigits),pipstring); // 1/10ths of pips is normal on extra-digit broker
   }

   static string aprs;
   if (ShowAvgPeriodRange || ShowRange) //apr is needed for ShowRange, even if APR is not displayed.
   {

      static double apr;

      if (uncountedBars > 1 || TimeCurrent() - lastapradrtime > 20) //Every new bar OR next tick after 20-seconds causes an update.
      {
         lastapr=apr;
         lastapradrtime = TimeCurrent();

         apr = MathRound((iMA(NULL,apr_timeframe,APR_Bars,0,MODE_SMA,PRICE_HIGH,1) - iMA(NULL,apr_timeframe,APR_Bars,0,MODE_SMA,PRICE_LOW,1))/pointdiv10) * pointdiv10/myPoint;
         aprs = StringConcatenate(DoubleToStr(apr,pipdigits),pipstring); // 1/10ths of pips is normal on extra-digit broker

         if (lastapr == 0) lastapr = MathRound((iMA(NULL,apr_timeframe,APR_Bars,0,MODE_SMA,PRICE_HIGH,2) - iMA(NULL,apr_timeframe,APR_Bars,0,MODE_SMA,PRICE_LOW,2))/pointdiv10) * pointdiv10/myPoint;
      }
   }

   static string adrs;
   if (ShowAvgDailyRange)
   {

      static double adr;

      if (uncountedBars > 1  || TimeCurrent() - lastapradrtime > 20) 
      {
         lastadr=adr;
         lastapradrtime = TimeCurrent();

         adr = MathRound((iMA(NULL,PERIOD_D1,ADR_Bars,0,MODE_SMA,PRICE_HIGH,1) - iMA(NULL,PERIOD_D1,ADR_Bars,0,MODE_SMA,PRICE_LOW,1))/pointdiv10) * pointdiv10/myPoint;
         adrs = StringConcatenate(DoubleToStr(adr,pipdigits),pipstring); // 1/10ths of pips is normal on extra-digit broker

         if (lastadr == 0) lastadr =  MathRound((iMA(NULL,PERIOD_D1,ADR_Bars,0,MODE_SMA,PRICE_HIGH,2) - iMA(NULL,PERIOD_D1,ADR_Bars,0,MODE_SMA,PRICE_LOW,2))/pointdiv10) * pointdiv10/myPoint;
      }
   }

   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 Dubais = timeToString( Dubai  );
   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(ShowPipSpread)
   {
	   ObjectSetText( "spreadl", "Spread", TimezoneFontSize, FontName, TimezoneColor );
      if (spread > LowSpreadHighlightThreshold) ObjectSetText( "spreadt", spreads, ClockFontSize, FontName,HigherPr

Показано первые 50% кода (символов: 54358)

Открыть по тарифу

Купите тариф с пакетом открытий или войдите, если тариф уже есть. Открытый файл останется в вашем кабинете навсегда.

Разовая покупка файла

На этой странице откроется полный исходный код файла вместо ознакомительного фрагмента.

Чтобы оформить заказ, введите email и перейдите к оплате.

Стоимость полного кода
5 435,80₽ ≈ $66.44