NewsCal-v107~.mq4
#property copyright "Copyright © 2012, Tim Morris"
#property link ""
#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Black
//#include
#import "stdlib.ex4"
string ErrorDescription(int a0); // DA69CBAFF4D38B87377667EEC549DE5A
#import "wininet.dll"
int InternetOpenA(string a0, int a1, string a2, string a3, int a4);
int InternetOpenUrlA(int a0, string a1, string a2, int a3, int a4, int a5);
int InternetReadFile(int a0, string a1, int a2, int& a3[]);
int InternetCloseHandle(int a0);
#import "kernel32.dll"
int GetTimeZoneInformation(int& a0[]);
#import "user32.dll"
bool GetWindowRect(int a0, int& a1[]);
#import
string gs_76 = "";
int g_window_84 = 0;
string gsa_88[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
string gsa_92[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
extern string o_______Table_______o = "";
extern bool DisplayTable = TRUE;
extern string TableTitle = "Calendar";
extern bool NarrowTable = FALSE;
extern bool TableShowClock = TRUE;
extern int TableNumEvents = 10;
extern int TableLookBackMns = 30;
extern int TableLookAheadHrs = 48;
extern int TableHorizAlign = 1;
extern int TableVertAlign = 1;
extern int TableSubWindow = 0;
extern bool TableBackground = TRUE;
extern string o_____Vert.Lines____o = "";
int intunused_156;
extern bool DisplayVertLines = FALSE;
extern int VLineMaxPeriod = 15;
extern int VLineLookAheadMns = 60;
extern string o______Filters______o = "";
bool int180 = TRUE;
extern bool IncludeLowImpact = TRUE;
extern bool IncludeMediumImpact = TRUE;
extern bool IncludeHighImpact = TRUE;
extern bool IncludeHolidays = TRUE;
extern bool IncludeMeetings = TRUE;
extern bool IncludeSpeeches = TRUE;
bool int208 = TRUE;
bool int212 = TRUE;
bool int216 = TRUE;
extern bool IncludeSymbolCurrencies = TRUE;
extern string CurrencyFilterList = "ALL";
extern string o______Alarms_______o = "";
extern bool SoundAlarms = TRUE;
extern string Alarm1Wav = "";
extern int Alarm1Mns = 5;
extern string Alarm2Wav = "news.wav";
extern int Alarm2Mns = 0;
extern string o______Colors_______o = "";
extern color ColorBreaking = LimeGreen;
extern color ColorHigh = C'0xFF,0x20,0x00';
extern color ColorMedium = C'0xFF,0x9F,0x00';
extern color ColorLow = C'0xDC,0xD7,0x1D';
extern color ColorHoliday = CadetBlue;
extern color ColorDefault = C'0xC8,0xC8,0xC8';
extern color ColorBack1 = C'0x20,0x38,0x40';
extern color ColorBack2 = C'0x18,0x2A,0x30';
extern string o_______Data________o = "";
extern bool UseAlternateSource = FALSE;
string gsa_320[400][8];
int gia_324[400];
int gia_328[400];
string gsa_332[10] = {"ALL", "USD", "EUR", "JPY", "GBP", "AUD", "CAD", "CHF", "NZD", "CNY"};
int gia_336[6] = {720, 480, 10, 5, 3, 1};
int gia_340[6] = {166, 94, 41, 157, 105, 166};
string gsa_344[10] = {"weeklyevents", "event", "title", "country", "date", "time", "impact", "actual", "forecast", "previous"};
int gia_348[8] = {4, 3, 0, 1, 5, 6, 7, 8};
int int352 = 0;
string g_str_concat_356;
string g_str_concat_364;
string g_str_concat_372;
string g_str_concat_380;
string g_str_concat_388;
int g_file_396 = -1;
int int400;
int int404;
int int408;
int int412;
int int416;
int int420;
int int424;
int int428;
int int432;
int int436;
int int440;
string gs_444;
string gs_452;
int int460;
int g_window_464;
int g_datetime_468;
int g_datetime_472;
int g_datetime_476;
int int480;
int int484;
int int488;
int int492;
string gs_496;
bool int504;
int gia_508[43];
int gia_512[4];
// 7465400D36DC5E39F99D4EF48A7722C5
int f0_18(string as_0, string a_name_8) {
a_name_8 = f0_43(as_0, a_name_8);
if (ObjectFind(a_name_8) == -1) return (0);
return (ObjectGet(a_name_8, OBJPROP_COLOR));
}
// 8C57A90F850B92F7F061C31B6A084717
string f0_22(string as_0, string a_name_8) {
a_name_8 = f0_43(as_0, a_name_8);
if (ObjectFind(a_name_8) == -1) return ("");
return (ObjectDescription(a_name_8));
}
// 1934DA04B1B41B57C08DB3BEE508A1A0
void f0_3(string as_0, string a_name_8, string a_text_16) {
a_name_8 = f0_43(as_0, a_name_8);
if (ObjectFind(a_name_8) != -1) ObjectSetText(a_name_8, a_text_16, 0);
}
// 3961644D9AFC0E1A8FAD72AB9E414F92
void f0_10(string as_0, string as_8) {
string ls_unused_20;
string name_28;
int objs_total_16 = ObjectsTotal();
as_8 = f0_43(as_0, as_8);
int li_36 = 0;
while (li_36 < ObjectsTotal()) {
name_28 = ObjectName(li_36);
if (StringSubstr(name_28, 0, StringLen(as_8)) == as_8) ObjectDelete(name_28);
else li_36++;
}
}
// FCD6DC468BD6B3A5282E3356F22F2B83
string f0_43(string as_0, string as_8) {
if (as_8 == "") return (StringConcatenate(gs_76, " ", as_0));
return (StringConcatenate(gs_76, " ", as_0, " ", as_8));
}
// A57C47E137DF81814028E011C7F834D7
void f0_32(string a_name_0, int a_datetime_8, color a_color_12, int a_style_16, bool a_bool_20) {
a_name_0 = f0_43("@", a_name_0);
if (ObjectFind(a_name_0) == -1) ObjectCreate(a_name_0, OBJ_VLINE, g_window_84, a_datetime_8, 0);
else ObjectSet(a_name_0, OBJPROP_TIME1, a_datetime_8);
ObjectSet(a_name_0, OBJPROP_COLOR, a_color_12);
ObjectSet(a_name_0, OBJPROP_STYLE, a_style_16);
ObjectSet(a_name_0, OBJPROP_BACK, a_bool_20);
}
// 6595FFF1B77DC72B7BF770FB0B3CDED8
void f0_16(string a_name_0, int a_x_8, int a_y_12, int a_corner_16, string a_text_20, color a_color_28, string a_fontname_32, int a_fontsize_40) {
a_name_0 = f0_43("LB", a_name_0);
if (ObjectFind(a_name_0) == -1) ObjectCreate(a_name_0, OBJ_LABEL, g_window_84, 0, 0);
ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_8);
ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_12);
ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_16);
ObjectSetText(a_name_0, a_text_20, a_fontsize_40, a_fontname_32, a_color_28);
}
// 9649D00365C5D1B1D6D5FCC86E5352C1
int f0_27(double ad_0, double ad_8, double ad_16) {
return (f0_14(ad_0) + f0_14(ad_16) * 256 + f0_14(ad_8) << 16);
}
// 60713441D1BB6C463160FBC100FF2604
int f0_14(double ad_0) {
return (MathMin(MathMax(MathRound(ad_0), 0), 255));
}
// E37F0136AA3FFAF149B351F6A4C948E9
void init() {
g_datetime_468 = TimeLocal();
g_datetime_472 = TimeLocal();
g_datetime_476 = TimeLocal();
int484 = 0;
int488 = 0;
int480 = 1;
if (UninitializeReason() == REASON_CHARTCHANGE) int480 = 0;
int416 = 1;
int400 = 0;
if (IsDllsAllowed()) f0_8(int420, int424);
else {
TableHorizAlign = 0;
TableVertAlign = 1;
TableSubWindow = 0;
}
if (!DisplayTable) {
TableNumEvents = 0;
TableHorizAlign = 1;
TableVertAlign = -1;
TableSubWindow = 0;
TableTitle = "NewsCal Messages";
NarrowTable = TRUE;
TableShowClock = FALSE;
TableBackground = TRUE;
} else TableNumEvents = MathMax(TableNumEvents, 1);
if (NarrowTable) {
int440 = 209;
gs_444 = "_____________________________";
gs_452 = "gggggggggggggggg";
} else {
int440 = 339;
gs_444 = "_______________________________________________";
gs_452 = "gggggggggggggggggggggggggg";
}
if (!DisplayVertLines) VLineMaxPeriod = 0;
if (!SoundAlarms) {
Alarm1Wav = "";
Alarm2Wav = "";
}
TableLookBackMns = MathMax(TableLookBackMns, 0);
TableLookAheadHrs = MathMax(TableLookAheadHrs, 1);
TableSubWindow = MathMax(TableSubWindow, 0);
VLineLookAheadMns = MathMax(VLineLookAheadMns, 0);
if (TableVertAlign == 0) TableVertAlign = 1;
CurrencyFilterList = f0_5(CurrencyFilterList);
gs_76 = "News";
f0_10("", "");
gs_76 = "z" + "News";
f0_10("", "");
int404 = f0_29();
int408 = f0_17();
int412 = f0_20();
g_str_concat_388 = StringConcatenate("Data: ", "ForexFactory.com");
if (UseAlternateSource) {
int352 = TRUE;
g_str_concat_388 = StringConcatenate("Data: ", "DailyFX.com");
}
g_str_concat_356 = StringConcatenate("NewsCal$CacheFile$", int352, ".txt");
g_str_concat_364 = StringConcatenate("NewsCal$ShareLock$", int352);
g_str_concat_372 = StringConcatenate("NewsCal$DLTime$", int352);
g_str_concat_380 = StringConcatenate("NewsCal$DLTries$", int352);
}
// 52D46093050F38C27267BCE42543EF60
void deinit() {
gs_76 = "News";
if (DisplayVertLines) f0_10("@", "");
gs_76 = "z" + "News";
f0_10("LB", TableTitle + "¬~");
if (g_file_396 >= 0) FileClose(g_file_396);
f0_30(g_str_concat_364, int416);
}
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
int li_0 = int424;
if (IsDllsAllowed()) f0_8(int420, int424);
if (TimeLocal() < int400 && li_0 == int424) return (1);
if (int480 & 1 > 0)
if (TimeLocal() > g_datetime_468 + 3) int480--;
if (!IsDllsAllowed()) int480 |= 64;
if (!IsConnected()) {
int480 |= 32;
f0_30(g_str_concat_364, 0);
} else int480 &= -33;
if (int480 < 32) {
int492 = 3600.0 * MathRound((TimeCurrent() - f0_11()) / 3600.0);
if (f0_36(g_str_concat_364, int416, int484)) {
int488 = f0_19();
f0_30(g_str_concat_364, int416);
if (int488 > 0) int480 &= -3;
else int480 |= 2;
}
}
if (int484 > 10) int480 |= 8;
else int480 &= -9;
int global_var_4 = GlobalVariableGet(g_str_concat_380);
if (global_var_4 > 5) int480 |= 4;
else int480 &= -5;
f0_0(int488);
if (int480 > 0) {
int460++;
if (int480 >= 64) {
f0_9(int460, "Error: DLLs are not enabled");
int400 = TimeLocal() + 30;
} else {
if (int480 >= 32) {
f0_9(int460, "Not connected ...");
int400 = TimeLocal();
} else {
if (int480 >= 16) {
f0_9(int460, "File error");
int400 = TimeLocal() + 30;
} else {
if (int480 >= 8) {
f0_9(int460, "File sharing error");
int400 = TimeLocal();
} else {
if (int480 >= 4) {
f0_9(int460, "Download failed");
int400 = TimeLocal() + 30;
} else {
if (int480 >= 2) {
f0_9(int460, "Downloading ...");
int400 = TimeLocal() + 30;
} else {
f0_9(int460, "Initialising ...");
int400 = TimeLocal();
}
}
}
}
}
}
} else int400 = 60 * (TimeLocal() / 60 + 1);
return (0);
}
// B2B83F7CCC214BB92FF1829DA0222769
int f0_36(string a_var_name_0, int &ai_8, int &a_count_12) {
int li_16 = GetTickCount();
a_count_12++;
while (!IsStopped() && GetTickCount() - li_16 < 50) {
if (GlobalVariableSetOnCondition(a_var_name_0, ai_8, 0) == TRUE) {
if (ai_8 == 1) {
ai_8 = GetTickCount();
GlobalVariableSet(a_var_name_0, ai_8);
}
a_count_12 = 0;
return (1);
}
if (GetLastError() == 4058/* GLOBAL_VARIABLE_NOT_FOUND */) GlobalVariableSet(a_var_name_0, 0);
}
return (0);
}
// A05E1C077BA1F84E989AD59C9D60D6BC
void f0_30(string a_var_name_0, int ai_8) {
if (ai_8 == 0 || ai_8 == 1) {
GlobalVariableSet(a_var_name_0, 0);
return;
}
GlobalVariableSetOnCondition(a_var_name_0, 0, ai_8);
}
// 77DD4293D172F74FC8E342E5F5A27D63
int f0_19() {
int li_20;
bool li_24;
int global_var_0 = GlobalVariableGet(g_str_concat_372);
int global_var_4 = GlobalVariableGet(g_str_concat_380);
string ls_8 = "";
int li_ret_16 = 0;
if (TimeLocal() - global_var_0 > f0_39(global_var_4)) li_24 = TRUE;
else {
g_file_396 = FileOpen(g_str_concat_356, FILE_BIN|FILE_READ);
if (g_file_396 >= 0) {
FileClose(g_file_396);
g_file_396 = -1;
} else li_24 = TRUE;
}
if (li_24) {
li_20 = f0_13(f0_34(), ls_8);
if (li_20 > 0) Print("Download failed - Error number:", li_20);
else {
li_ret_16 = f0_1(ls_8);
if (li_ret_16 < 1) Print("Can\'t read source download");
else {
g_file_396 = FileOpen(g_str_concat_356, FILE_BIN|FILE_WRITE);
if (g_file_396 < 0) {
Print("Can\'t save data file, ", ErrorDescription(GetLastError()));
int480 |= 16;
li_ret_16 = 0;
} else {
FileWriteString(g_file_396, ls_8, StringLen(ls_8));
FileClose(g_file_396);
int480 &= -17;
g_file_396 = -1;
global_var_4 = -1;
}
}
}
GlobalVariableSet(g_str_concat_380, global_var_4 + 1);
GlobalVariableSet(g_str_concat_372, TimeLocal());
}
if (li_ret_16 < 1) {
g_file_396 = FileOpen(g_str_concat_356, FILE_BIN|FILE_READ);
if (g_file_396 < 0) {
Print("Can\'t load data file, ", ErrorDescription(GetLastError()));
int480 |= 16;
} else {
for (ls_8 = ""; StringLen(ls_8) < FileSize(g_file_396); ls_8 = StringConcatenate(ls_8, FileReadString(g_file_396, FileSize(g_file_396) - StringLen(ls_8)))) {
}
FileClose(g_file_396);
int480 &= -17;
g_file_396 = -1;
li_ret_16 = f0_1(ls_8);
if (li_ret_16 < 1) {
Print("Can\'t read saved file");
int480 |= 16;
FileDelete(g_str_concat_356);
} else int480 &= -17;
}
}
return (li_ret_16);
}
// 0160EC6BBBF4C3343C4F101D5EDE5E31
void f0_0(int ai_0) {
int li_12;
int li_16;
int428 = TableHorizAlign;
if (TableHorizAlign < 0) int428 += int424 - 50 - int440;
if (TableHorizAlign == 0) int428 = (int424 - 50 - int440) / 2;
int428 = MathMax(MathMin(int428, int424 - 50 - int440), 0);
int428 += 5;
g_window_464 = MathMin(TableSubWindow, WindowsTotal() - 1);
int460 = TableNumEvents;
if (int480 > 0) int460 = MathMax(int460, 5);
if (TableVertAlign >= 0) {
int432 = TableVertAlign + 3;
int436 = 0;
} else {
int432 = (-TableVertAlign) + 18 * int460 + 20;
int436 = 2;
}
int count_20 = 0;
int li_24 = 99999;
bool li_28 = FALSE;
bool li_32 = FALSE;
gs_76 = "News";
if (DisplayVertLines) f0_10("@", "");
gs_76 = "z" + "News";
f0_10("LB", TableTitle + "¬~");
if (int460 > 0) f0_4();
if (int480 > 0) int460--;
if (int480 & 3 > 0) {
f0_9(1, "Copyright © 2012, Tim Morris");
f0_9(2, "Version 1.07 (22 Nov 2012)");
f0_9(3, " ");
f0_9(4, " ");
} else {
if (ai_0 > 0) {
li_16 = f0_11() / 60;
for (int index_4 = 0; index_4 < ai_0; index_4++) {
if (gia_328[index_4] > 0 && 1 << f0_38(gsa_320[index_4][4]) & int404 > 0 && 1 << gia_324[index_4] & int408 > 0 && 1 << f0_37(gsa_320[index_4][1]) & int412 > 0) {
li_12 = gia_328[index_4] / 60 - li_16;
if (li_12 == Alarm1Mns && Alarm1Wav != "" && TimeLocal() > g_datetime_472 + 60) li_28 = TRUE;
if (li_12 == Alarm2Mns && Alarm2Wav != "" && TimeLocal() > g_datetime_476 + 60) li_32 = TRUE;
if (li_12 >= 0 && li_12 < li_24) li_24 = li_12;
if (Period() <= VLineMaxPeriod && f0_38(gsa_320[index_4][4]) > 0 && gia_336[gia_324[index_4]] <= 15 && li_12 <= VLineLookAheadMns && int480 & 1 == 0) f0_31(gsa_320[index_4][0], gsa_320[index_4][1], gia_328[index_4] + int492, f0_38(gsa_320[index_4][4]));
if (li_12 > (-gia_336[gia_324[index_4]]) || li_12 > (-TableLookBackMns) && li_12 <= 60 * TableLookAheadHrs && count_20 < int460) {
count_20++;
f0_15(count_20, li_12, gia_336[gia_324[index_4]], gsa_320[index_4][1], gsa_320[index_4][0], f0_38(gsa_320[index_4][4]), gia_324[index_4]);
}
}
}
if (li_28) {
PlaySound(Alarm1Wav);
g_datetime_472 = TimeLocal();
}
if (li_32) {
PlaySound(Alarm2Wav);
g_datetime_476 = TimeLocal();
}
if (count_20 == 0 && int460 > 0) {
if (li_24 < 99999) f0_9(1, StringConcatenate("No matching events for ", f0_2(li_24)));
else f0_9(1, "No further matching events");
}
}
}
WindowRedraw();
}
// B190FDD597B3454854B0EDCB3FC85CFB
string f0_34() {
int li_4;
int li_0 = int352;
if (li_0 == 1) {
li_4 = f0_11() - 86400 * TimeDayOfWeek(f0_11());
return (StringConcatenate("http://www.dailyfx.com/files/Calendar", "-", f0_6(TimeMonth(li_4)), "-", f0_6(TimeDay(li_4)), "-", TimeYear(li_4), ".csv"));
}
return ("http://www.forexfactory.com/ffcal_week_this.xml");
}
// 029B0B966E0B0737828A1001EAB76E5D
int f0_1(string &as_0) {
int li_8 = int352;
if (li_8 == 1) return (f0_25(as_0));
return (f0_33(as_0));
}
// AE764784884E2950AAB67A70B079891F
int f0_33(string &as_0) {
string ls_8;
string ls_16;
string ls_24;
int li_44;
int li_36 = 0;
if (!f0_24(as_0, ls_8, li_36, gsa_344[0])) return (0);
int li_40 = 0;
for (int index_32 = 0; index_32 < 400; index_32++) {
if (!(f0_24(ls_8, ls_16, li_40, gsa_344[1]))) break;
li_44 = 0;
for (int count_48 = 0; count_48 < 8; count_48++) {
f0_24(ls_16, ls_24, li_44, gsa_344[count_48 + 2]);
if (StringSubstr(ls_24, 0, 9) == ""), ai_16);
if (li_28 <= ai_16) {
li_28 = StringFind(as_0, StringConcatenate("<", as_20, " />"), ai_16);
if (li_28 <= ai_16) return (FALSE);
ai_16 = li_28 + StringLen(as_20) + 4;
return (TRUE);
}
ai_16 = li_28 + StringLen(as_20) + 2;
li_28 = StringFind(as_0, StringConcatenate(""), ai_16);
if (li_28 <= ai_16) return (FALSE);
as_8 = StringSubstr(as_0, ai_16, li_28 - ai_16);
ai_16 = li_28 + StringLen(as_20) + 3;
return (TRUE);
}
// B29033BFDFB291CB79B93CCC09C67993
int f0_35(string as_0, string as_8) {
string ls_16 = StringSubstr(as_0, 0, 2);
string ls_24 = StringSubstr(as_0, 3, 2);
string ls_32 = StringSubstr(as_0, 6, 4);
int li_40 = StringFind(as_8, ":");
if (li_40 == -1 || StrToInteger(ls_16) == 0 || StrToInteger(ls_24) == 0 || StrToInteger(ls_32) == 0) return (0);
int li_44 = StrToInteger(StringSubstr(as_8, 0, li_40));
string ls_48 = StringSubstr(as_8, li_40 + 1, 2);
string ls_56 = StringSubstr(as_8, StringLen(as_8) - 2);
if (ls_56 == "pm" || ls_56 == "PM" && li_44 != 12) li_44 += 12;
if (ls_56 == "am" || ls_56 == "AM" && li_44 == 12) li_44 = 0;
string ls_64 = " ";
if (li_44 < 10) ls_64 = " 0";
return (StrToTime(StringConcatenate(ls_32, ".", ls_16, ".", ls_24, ls_64, li_44, ":", ls_48)));
}
// 92DB30BDA1488E2DB8A6E00EE9D09C11
int f0_25(string &as_0) {
string lsa_8[9];
int li_12;
int li_16 = 0;
int index_20 = 0;
int index_24 = 0;
f0_12(lsa_8, "");
while (li_16 < StringLen(as_0) && index_20 < 400 && index_24 < 9) {
li_12 = StringGetChar(as_0, li_16);
if (li_12 < ' ') {
if (lsa_8[gia_348[2]] != "Date" && lsa_8[gia_348[2]] != "") {
for (int index_28 = 0; index_28 < 8; index_28++) gsa_320[index_20][index_28] = lsa_8[gia_348[index_28]];
gsa_320[index_20][1] = f0_5(gsa_320[index_20][1]);
if (StringSubstr(gsa_320[index_20][0], 0, 4) == gsa_320[index_20][1] + " ") gsa_320[index_20][0] = StringSubstr(gsa_320[index_20][0], 4);
gia_324[index_20] = f0_23(gsa_320[index_20][4], gsa_320[index_20][0], gsa_320[index_20][7], gsa_320[index_20][6]);
gia_328[index_20] = f0_28(gsa_320[index_20][2], gsa_320[index_20][3]);
index_20++;
}
index_24 = 0;
f0_12(lsa_8, "");
} else {
if (li_12 == ',') index_24++;
else
if (li_12 != '"') lsa_8[index_24] = lsa_8[index_24] + CharToStr(li_12);
}
li_16++;
}
return (index_20);
}
// 9BC3ABD5032D8414E11ED94DFD446C6D
int f0_28(string as_0, string as_8) {
int str2int_16 = StrToInteger(StringSubstr(as_0, 8, 2));
if (StringFind(as_8, ":") < 0) as_8 = "00:00";
int li_20 = 1;
while (true) {
if (li_20 > 12) return (0);
if (StringSubstr(gsa_92[li_20 - 1], 0, 3) == StringSubstr(as_0, 4, 3)) break;
li_20++;
}
int li_24 = TimeYear(f0_11());
if (TimeMonth(f0_11()) == 12 && li_20 == 1) li_24++;
if (TimeMonth(f0_11()) == 1 && li_20 == 12) li_24--;
return (StrToTime(StringConcatenate(li_24, ".", li_20, ".", str2int_16, " ", as_8)));
}
// 199974B594B04D3CC69CF7BEF291760B
void f0_4() {
int li_0;
int li_4;
int li_8;
int li_12;
int li_16;
int li_20;
int li_24;
int li_28;
double ld_36;
int li_44;
g_window_84 = g_window_464;
gs_76 = "z" + "News";
if (TableBackground) {
li_0 = 11;
li_4 = (18 * int460 + 22) / li_0;
if (li_4 > 12) {
li_0 = (18 * int460 + 22) / 12;
li_4 = (18 * int460 + 22) / li_0;
}
li_0 += 1;
li_8 = ColorBack1 & 255;
li_12 = ColorBack2 & 255;
li_16 = ColorBack1 >> 8 & 255;
li_20 = ColorBack2 >> 8 & 255;
li_24 = ColorBack1 >> 16 & 255;
li_28 = ColorBack2 >> 16 & 255;
for (int count_32 = 0; count_32 < li_0; count_32++) {
ld_36 = 1.0 * count_32 / li_0;
li_44 = f0_27(li_8 + (li_12 - li_8) * ld_36, li_24 + (li_28 - li_24) * ld_36, li_16 + (li_20 - li_16) * ld_36);
if (int436 == 0) f0_16(TableTitle + "¬~B" + count_32, int428 - 3, int432 + count_32 * li_4 - 4, 0, gs_452, li_44, "Webdings", 10);
else f0_16(TableTitle + "¬~B" + count_32, int428 - 3, int432 - count_32 * li_4 + 2, 2, gs_452, li_44, "Webdings", 10);
}
}
if (int436 == 0) {
if (TableBackground) f0_16(TableTitle + "¬~B" + li_0, int428 - 3, int432 + 18 + 18 * int460, 0, gs_452, ColorBack2, "Webdings", 10);
f0_16(TableTitle + "¬~F1", int428, int432, 0, TableTitle, ColorDefault, "Arial Bold", 10);
if (TableShowClock) {
f0_16(TableTitle + "¬~F2", int428 + int440 - 118, int432, 0, StringConcatenate(f0_41(TimeLocal()), " ", TimeToStr(TimeLocal(), TIME_MINUTES)), ColorDefault, "Arial Bold",
10);
}
f0_16(TableTitle + "¬~F3", int428, int432 + 1, 0, gs_444, ColorDefault, "Arial", 10);
f0_16(TableTitle + "¬~F4", int428, int432 + 3 + 18 * int460, 0, gs_444, ColorDefault, "Arial", 10);
f0_16(TableTitle + "¬~F5", int428, int432 + 19 + 18 * int460, 0, g_str_concat_388, ColorDefault, "Arial", 8);
f0_16(TableTitle + "¬~F6", int428 + int440 - 80, int432 + 19 + 18 * int460, 0, "NewsCal 1.07", ColorDefault, "Arial", 8);
return;
}
if (TableBackground) f0_16(TableTitle + "¬~B" + li_0, int428 - 3, int432 - 20 - 18 * int460, 2, gs_452, ColorBack2, "Webdings", 10);
f0_16(TableTitle + "¬~F1", int428, int432, 2, TableTitle, ColorDefault, "Arial Bold", 10);
if (TableShowClock) {
f0_16(TableTitle + "¬~F2", int428 + int440 - 118, int432, 2, StringConcatenate(f0_41(TimeLocal()), " ", TimeToStr(TimeLocal(), TIME_MINUTES)), ColorDefault, "Arial Bold",
10);
}
f0_16(TableTitle + "¬~F3", int428, int432 - 1, 2, gs_444, ColorDefault, "Arial", 10);
f0_16(TableTitle + "¬~F4", int428, int432 - 3 - 18 * int460, 2, gs_444, ColorDefault, "Arial", 10);
f0_16(TableTitle + "¬~F5", int428, int432 - 17 - 18 * int460, 2, g_str_concat_388, ColorDefault, "Arial", 8);
f0_16(TableTitle + "¬~F6", int428 + int440 - 80, int432 - 17 - 18 * int460, 2, "NewsCal 1.07", ColorDefault, "Arial", 8);
}
// A268BE5E2B8840D73011201AEF9A9B38
void f0_31(string as_0, string as_8, int ai_16, int ai_20) {
g_window_84 = 0;
gs_76 = "News";
string time2str_24 = TimeToStr(ai_16, TIME_DATE|TIME_MINUTES);
string str_concat_32 = f0_22("@", time2str_24);
if (str_concat_32 != "") str_concat_32 = StringConcatenate(str_concat_32, ",");
str_concat_32 = StringConcatenate(str_concat_32, as_8, "[", f0_21(as_0, 2, 5), "]");
int li_40 = f0_18("@", time2str_24);
if (f0_7(li_40) < ai_20) li_40 = f0_26(ai_20);
f0_32(time2str_24, ai_16, li_40, STYLE_DOT, TRUE);
f0_3("@", time2str_24, str_concat_32);
}
// 62806B04A1E8269D76C1297E7336B6F0
void f0_15(int ai_0, int ai_4, int ai_8, string as_12, string as_20, int ai_28, int ai_32) {
int li_60;
int li_64;
if (ai_0 == 1) {
gs_496 = "";
int504 = TRUE;
}
g_window_84 = g_window_464;
gs_76 = "z" + "News";
int li_36 = int432;
if (int436 == 0) li_36 += 18 * ai_0;
else li_36 -= 18 * ai_0;
int color_40 = ColorBreaking;
string str_concat_44 = StringConcatenate(TableTitle, "¬~T", ai_0);
string ls_52 = f0_2(ai_4);
if (ai_4 <= 0 && ai_4 > (-ai_8)) ls_52 = "Now";
if (ai_4 > 0) color_40 = ColorDefault;
if (ls_52 != gs_496) {
if (int504 && ai_4 >= 0) {
f0_16(str_concat_44, int428, li_36, int436, ls_52, color_40, "Arial Bold", 10);
int504 = FALSE;
} else f0_16(str_concat_44, int428, li_36, int436, ls_52, color_40, "Arial", 10);
}
gs_496 = ls_52;
color_40 = f0_26(ai_28);
str_concat_44 = StringConcatenate(TableTitle, "¬~E", ai_0);
f0_16(str_concat_44, int428 + 39, li_36 - 2 + int436 / 2, int436, CharToStr(gia_340[ai_32]), color_40, "Webdings", 12);
str_concat_44 = StringConcatenate(TableTitle, "¬~C", ai_0);
f0_16(str_concat_44, int428 + 58, li_36, int436, as_12, color_40, "Arial", 10);
str_concat_44 = StringConcatenate(TableTitle, "¬~N", ai_0);
if (NarrowTable) {
if (StringLen(as_20) > 15) as_20 = f0_21(as_20, 3, 11);
if (StringLen(as_20) > 15) as_20 = f0_21(as_20, 2, 11);
if (StringLen(as_20) > 15) as_20 = f0_21(as_20, 2, 7);
} else {
li_60 = 0;
li_64 = 36;
if (ai_28 > 2) li_64 = 32;
as_20 = f0_40(as_20, li_60, li_64, 1);
}
if (ai_28 > 2) {
f0_16(str_concat_44, int428 + 90, li_36, int436, as_20, color_40, "Arial Bold", 10);
return;
}
f0_16(str_concat_44, int428 + 90, li_36, int436, as_20, color_40, "Arial", 10);
}
// 37B00879685AB405C10717E51F27A0C0
void f0_9(int ai_0, string as_4) {
g_window_84 = g_window_464;
gs_76 = "z" + "News";
int li_12 = int432;
if (int436 == 0) li_12 += 18 * ai_0;
else li_12 -= 18 * ai_0;
string str_concat_16 = StringConcatenate(TableTitle, "¬~T", ai_0);
f0_16(str_concat_16, int428, li_12, int436, as_4, ColorBreaking, "Arial", 10);
}
// 7F67DCB01B70F0091328E123390167D0
string f0_21(string as_0, int ai_8, int ai_12) {
int li_24;
int li_32;
int li_40;
string ls_16 = "";
int li_28 = 0;
int count_36 = 0;
if (ai_12 < 4) ai_12 = 4;
while (true) {
li_24 = li_28 - 1;
while (li_24 < StringLen(as_0)) {
li_24++;
if (li_24 >= StringLen(as_0) || count_36 >= ai_8) return (StringTrimRight(ls_16));
if (StringGetChar(as_0, li_24) != ' ') break;
}
li_28 = li_24;
while (li_28 < StringLen(as_0)) {
li_28++;
if (li_28 >= StringLen(as_0)) break;
if (StringGetChar(as_0, li_28) == ' ') break;
}
li_32 = li_28 - li_24;
if (StringSubstr(as_0, li_24, 4) == "Non-") li_40 = 4;
else li_40 = 0;
if (li_32 > ai_12 && li_32 >= li_40 + 4) {
li_32 = li_40 + 4;
if (StringFind("aeiou-", StringSubstr(as_0, li_24 + li_40 + 3, 1)) >= 0) {
li_32 = li_40 + 3;
if (StringFind("aeiou-", StringSubstr(as_0, li_24 + li_40 + 2, 1)) >= 0) li_32 = li_40 + 2;
}
}
ls_16 = StringConcatenate(ls_16, StringSubstr(as_0, li_24, li_32), " ");
count_36++;
}
return /*(WARN)*/;
}
// BC00D4913442E4DB3D9E277EE1C35B66
string f0_40(string as_0, int &ai_8, int ai_12, bool ai_16) {
int li_32;
string ls_20 = "";
int li_28 = ai_8;
while (true) {
ai_8 = li_28 - 1;
while (ai_8 < StringLen(as_0)) {
ai_8++;
if (ai_8 >= StringLen(as_0)) return (StringTrimRight(ls_20));
if (StringGetChar(as_0, ai_8) > ' ') break;
}
li_28 = ai_8;
while (li_28 < StringLen(as_0)) {
li_28++;
if (li_28 >= StringLen(as_0)) break;
if (StringGetChar(as_0, li_28) <= ' ') break;
}
li_32 = li_28 - ai_8;
if (StringLen(ls_20) + li_32 > ai_12) break;
ls_20 = StringConcatenate(ls_20, StringSubstr(as_0, ai_8, li_32), " ");
}
if (ai_16) {
ls_20 = StringConcatenate(ls_20, StringSubstr(as_0, ai_8, li_32));
ls_20 = StringConcatenate(StringSubstr(ls_20, 0, ai_12 - 1), CharToStr(133));
}
return (StringTrimRight(ls_20));
}
// 513B46F10BDB33D779DB951518497FB6
void f0_12(string &asa_0[9], string as_4) {
for (int li_12 = ArrayRange(asa_0, 0) - 1; li_12 >= 0; li_12--) asa_0[li_12] = as_4;
}
// 9F2D7D996965610AB0A97ED4B6ED58E5
int f0_29() {
int count_0 = 0;
if (int180) count_0++;
if (IncludeLowImpact) count_0 += 2;
if (IncludeMediumImpact) count_0 += 4;
if (IncludeHighImpact) count_0 += 8;
return (count_0);
}
// 706734F7DD66BBB9AEBE904A87902BDC
int f0_17() {
int li_ret_0 = 0;
if (IncludeHolidays) li_ret_0 = 1;
if (IncludeMeetings) li_ret_0 += 2;
if (IncludeSpeeches) li_ret_0 += 4;
if (int208) li_ret_0 += 8;
if (int212) li_ret_0 += 16;
if (int216) li_ret_0 += 32;
return (li_ret_0);
}
// 7E47C8BD77CCD83A3642AAA6E4146CE2
int f0_20() {
int li_ret_0 = 1;
if (IncludeSymbolCurrencies) li_ret_0 = li_ret_0 | 1 << f0_37(StringSubstr(Symbol(), 0, 3)) | 1 << f0_37(StringSubstr(Symbol(), 3, 3));
if (StringFind(CurrencyFilterList, "ALL") > -1) li_ret_0 |= 4095;
else {
for (int li_4 = 1; li_4 < 10; li_4++)
if (StringFind(CurrencyFilterList, gsa_332[li_4]) > -1) li_ret_0 |= 1 << li_4;
}
return (li_ret_0);
}
// 19DE5B94F7B83900D4B296D9FA491AEC
string f0_5(string as_0) {
int li_20;
string ls_ret_8 = as_0;
for (int li_16 = 0; li_16 < StringLen(ls_ret_8); li_16++) {
li_20 = StringGetChar(ls_ret_8, li_16);
if (li_20 >= 'a' && li_20 <= 'z') ls_ret_8 = StringSetChar(ls_ret_8, li_16, li_20 - 32);
}
return (ls_ret_8);
}
// 9112C6F149D6B3526BE3CB6A7CE88D0F
int f0_23(string as_0, string as_8, string as_16, string as_24) {
if (f0_38(as_0) < 1) {
if (StringFind(as_8, "Holiday") > -1) return (0);
return (5);
}
if (as_16 == "" && as_24 == "") {
if (StringFind(as_8, "Speaks") > -1 || StringFind(as_8, "Testifies") > -1 || StringFind(as_8, "Press Conference") > -1) return (2);
if ((StringFind(as_8, "Conference") > -1 && StringFind(as_8, "Press") == -1) || (StringFind(as_8, "Meet") > -1 && StringFind(as_8, "Minutes") == -1) || StringFind(as_8,
"Summit") > -1 || StringFind(as_8, "Election") > -1 || StringFind(as_8, "Vote") > -1) return (1);
return (3);
}
return (4);
}
// B9E2FA43B7395F6A8677AB775C274D5A
int f0_38(string as_0) {
if (as_0 == "High") return (3);
if (as_0 == "Medium") return (2);
if (as_0 == "Low") return (1);
if (as_0 == "Holiday") return (0);
return (-1);
}
// 25C7CD143285DD0A6143ECF2790C5FC3
int f0_7(int ai_0) {
if (ai_0 == ColorHigh) return (3);
if (ai_0 == ColorMedium) return (2);
if (ai_0 == ColorLow) return (1);
if (ai_0 == ColorHoliday) return (0);
return (-1);
}
// 937102B669D041213806E37D57E73E23
int f0_26(int ai_0) {
switch (ai_0) {
case 3:
return (ColorHigh);
case 2:
return (ColorMedium);
case 1:
return (ColorLow);
case 0:
return (ColorHoliday);
}
return (ColorDefault);
}
// B4B1ED2BB903439A3FAE9FB4A6960459
int f0_37(string as_0) {
for (int index_8 = 0; index_8 < 10; index_8++)
if (as_0 == gsa_332[index_8]) break;
return (index_8);
}
// BA0515ECEB485A96629738FB11D1EA7C
int f0_39(int ai_0) {
if (ai_0 <= 0) return (3600);
return (30.0 * MathPow(2, ai_0 - 1));
}
// 5861CA60EB9BC32653BE9CC150BB761C
int f0_13(string as_0, string &as_8) {
int lia_32[] = {1};
int li_36 = 80;
string ls_40 = "--------10--------20--------30--------40--------50--------60--------70--------80";
int li_16 = InternetOpenA("Mozilla/4.0 (compatible; MT4-News/1.0;)", 0, "0", "0", 0);
if (li_16 == 0) return (1);
int li_20 = InternetOpenUrlA(li_16, as_0, "0", 0, -2080374528, 0);
if (li_20 == 0) return (2);
int li_24 = InternetReadFile(li_20, ls_40, li_36, lia_32);
if (li_24 == 0) return (3);
int li_28 = lia_32[0];
for (as_8 = StringSubstr(ls_40, 0, lia_32[0]); lia_32[0] != 0; as_8 = StringConcatenate(as_8, StringSubstr(ls_40, 0, lia_32[0]))) {
li_24 = InternetReadFile(li_20, ls_40, li_36, lia_32);
if (lia_32[0] == 0) break;
li_28 += lia_32[0];
}
li_24 = InternetCloseHandle(li_20);
if (li_24 == 0) return (4);
li_24 = InternetCloseHandle(li_16);
if (li_24 == 0) return (5);
return (0);
}
// 4071488DE8516E67F1C8C907916542A5
int f0_11() {
return (TimeLocal() - 60 * f0_42());
}
// E775675BA2ACBAAC5C1142393C8A4339
int f0_42() {
int li_0 = GetTimeZoneInformation(gia_508);
int li_4 = gia_508[0];
if (li_0 == 1) li_4 += gia_508[21];
if (li_0 == 2) li_4 += gia_508[42];
return (-li_4);
}
// 1C87E1D5E9B9F532C8C3AC87514AEBF1
string f0_6(int ai_0) {
string ls_4 = ai_0 + 100;
return (StringSubstr(ls_4, 1));
}
// DF1FB33930688DD4EF20887553F0BE5E
string f0_41(int ai_0) {
return (StringConcatenate(StringSubstr(gsa_88[TimeDayOfWeek(ai_0)], 0, 3), " ", f0_6(TimeDay(ai_0)), " ", StringSubstr(gsa_92[TimeMonth(ai_0) - 1], 0, 3)));
}
// 190634B36D37826B9B0E22F219420785
string f0_2(int ai_0) {
if (ai_0 >= 6000) return (">100h");
if (ai_0 <= -600) return ("<-10h");
if (ai_0 <= -60) return (StringConcatenate("-", (-ai_0) / 60, "h", f0_6((-ai_0) % 60)));
if (ai_0 < 60) return (StringConcatenate(ai_0, "m"));
return (StringConcatenate(ai_0 / 60, "h", f0_6(ai_0 % 60)));
}
// 33D45B51EA86A3659B35AB01F36CFA08
int f0_8(int &ai_0, int &ai_4) {
if (!GetWindowRect(WindowHandle(Symbol(), 0), gia_512)) return (0);
ai_0 = gia_512[3] - gia_512[1];
ai_4 = gia_512[2] - gia_512[0];
return (1);
} |