Time: 2015-01-01 | Download file:VolatilityFactor.mq4
//============================================================================================= //Decompiled by lptuyen at www.forexisbiz.com (FIB Forum) //Profile: http://www.forexisbiz.com/member.php/11057-lptuyen?tab=aboutme#aboutme //Email: Lptuyen_fx@yahoo.com //Another forum: lptuyen at WWI //Profile: http://worldwide-invest.org/members/48543-lptuyen?tab=aboutme#aboutme //============================================================================================= #property copyright "Copyright 2013" #property link "http://www.google.com" /*#import "ws2_32.dll" int WSAStartup(int a0, int& a1[]); int socket(int a0, int a1, int a2); int connect(int a0, int& a1[], int a2); int recv(int a0, int& a1[], int a2, int a3); int closesocket(int a0); int WSACleanup();*/ #import "kernel32.dll" void GetSystemTime(int& a0[]); #import extern int Magic = 2012345; extern string EA_Comment = "My super Ilan Mod"; extern bool Signal_1 = TRUE; extern bool Signal_2 = TRUE; bool Gi_96 = FALSE; bool Gi_100 = FALSE; extern double MaxSpread = 3.5; extern int Slippage = 2; extern bool NFA = FALSE; bool Gi_120 = FALSE; extern bool AutoGMT_Offset = TRUE; extern int ManualGMT_Offset = 2; extern bool DST_Usage = TRUE; extern string CS = "==== Custom Settings ===="; bool Gi_144 = TRUE; extern int BetterPricePips = 0; extern int MaxNegAdds = 3; extern int ForceProfit = 0; extern int ForceLoss = 0; extern int FixedTakeProfit = 0; extern int FixedStopLoss = 0; extern bool CloseOnlyOnProfit = FALSE; extern int MinProfitPips = 5; bool Gi_180 = FALSE; string Gs_gbpusd_184 = "GBPUSD"; extern string MM = "==== Risk Management ===="; extern bool RecoveryMode = FALSE; extern double FixedLots = 0.1; extern double AutoMM = 0.0; extern double AutoMM_Max = 5.0; int Gi_228 = 100; int G_period_232 = 0; int G_period_236 = 0; int Gi_240 = 0; int Gi_244 = 0; int Gi_248 = 0; int G_period_252 = 0; int Gi_256 = 0; int G_period_260 = 0; int Gi_264 = 0; int Gi_268 = 0; int Gi_272 = 0; int Gi_276 = 0; int Gi_280 = 0; int Gi_284 = -1; int Gi_288 = 0; int Gi_292 = 0; int Gi_296 = 0; int G_period_300 = 0; int Gi_304 = 0; int Gi_308 = 0; int G_period_312 = 0; int Gi_316 = 0; int G_period_320 = 0; int Gi_324 = 0; int G_period_328 = 0; int Gi_332 = 0; int Gi_336 = 0; int Gi_340 = -1; int Gi_344 = -1; int Gi_348 = -1; int Gi_352 = -1; int Gi_356 = 100; double Gd_360 = 10.0; double Gd_368 = 1.05; int Gi_376 = 3; int Gi_380 = 3; int Gi_384 = 0; int Gi_388 = 0; int Gi_392 = -1; string Gs_396 = ""; int Gi_404 = 2; bool Gi_408 = TRUE; bool Gi_412 = FALSE; int G_stoplevel_416 = 0; double G_minlot_420 = 0.01; double G_maxlot_428 = 0.01; double G_lotstep_436 = 0.01; int G_lotsize_444 = 100000; double G_marginrequired_448 = 1000.0; double Gd_456 = 0.0001; double Gd_unused_464 = 0.1; double Gd_472 = 1.0; int G_datetime_480 = 0; bool Gi_484 = FALSE; double Gd_488; // E37F0136AA3FFAF149B351F6A4C948E9 void init() { Gi_408 = TRUE; Gi_392 = -1; Comment(""); if (ObjectFind("BKGR") >= 0) ObjectDelete("BKGR"); if (ObjectFind("BKGR2") >= 0) ObjectDelete("BKGR2"); if (ObjectFind("BKGR3") >= 0) ObjectDelete("BKGR3"); if (ObjectFind("BKGR4") >= 0) ObjectDelete("BKGR4"); if (ObjectFind("LV") >= 0) ObjectDelete("LV"); } // 52D46093050F38C27267BCE42543EF60 int deinit() { Comment(""); if (ObjectFind("BKGR") >= 0) ObjectDelete("BKGR"); if (ObjectFind("BKGR2") >= 0) ObjectDelete("BKGR2"); if (ObjectFind("BKGR3") >= 0) ObjectDelete("BKGR3"); if (ObjectFind("BKGR4") >= 0) ObjectDelete("BKGR4"); if (ObjectFind("LV") >= 0) ObjectDelete("LV"); if (Gi_392 != -1) Gi_392 = f0_13(); return (0); } // EA2B2676C28C0DB26D39331A336C6B92 int start() { double price_0; color color_8; int ticket_12; color color_16; string Ls_20; string Ls_28; string Ls_36 = ""; double lots_44 = 0; double Ld_52 = 0; double Ld_60 = 0; double Ld_68 = 0; double Ld_76 = 0; double Ld_84 = 1; if (DayOfWeek() == 1 && iVolume(NULL, PERIOD_D1, 0) < 5.0) return (0); if (StringLen(Symbol()) < 6) return (0); if (Gi_408) { Comment("\nInitializing ..."); Sleep(1000); RefreshRates(); Gi_408 = FALSE; G_stoplevel_416 = MarketInfo(Symbol(), MODE_STOPLEVEL); G_minlot_420 = MarketInfo(Symbol(), MODE_MINLOT); G_maxlot_428 = MarketInfo(Symbol(), MODE_MAXLOT); G_lotsize_444 = MarketInfo(Symbol(), MODE_LOTSIZE); G_lotstep_436 = MarketInfo(Symbol(), MODE_LOTSTEP); G_marginrequired_448 = MarketInfo(Symbol(), MODE_MARGINREQUIRED); if (Digits <= 3) Gd_456 = 0.01; else Gd_456 = 0.0001; if (Digits == 3 || Digits == 5) Gd_unused_464 = 0.1; else Gd_unused_464 = 1; Sleep(1000); Gi_412 = TRUE; Sleep(1000); if (!Gi_412) Gi_408 = TRUE; } if ((!IsTesting()) && IsStopped()) return (0); if ((!IsTesting()) && !IsTradeAllowed()) return (0); if ((!IsTesting()) && IsTradeContextBusy()) return (0); if (IsDllsAllowed() == FALSE) { Comment("\nWarning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); Print("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); Alert("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors."); Sleep(30000); return (0); } if (StringSubstr(Symbol(), 0, 6) != "GBPUSD" && StringSubstr(Symbol(), 0, 6) != "EURUSD") { Comment("\nUnsupported currency pair! Supported currency pairs: GBPUSD and EURUSD"); Alert("Unsupported currency pair! Supported currency pairs: GBPUSD and EURUSD"); Sleep(10000); return (0); } if (!IsTesting() && Period() != PERIOD_M15) { Comment("\nPlease, swich to M15 chart!"); Alert("Please, swich to M15 chart!"); Sleep(10000); return (0); } if (Gi_392 <= 0) { if (!Gi_412) { Comment("\nInternet connection problem"); Alert("Internet connection problem"); Sleep(10000); return (0); } Gi_392 = f0_0(); Sleep(1000); if (Gi_392 < 0) Comment("\nInitializing ..."); } if (Gi_392 <= 0) { if (Gi_392 == -1) { Comment("\nAccount login check is failed! Please, start Faktor Volatilnosti, after successful login in your MT4 account!"); Alert("Account login check is failed! Please, start Faktor Volatilnosti, after successful login in your MT4 account!"); } else { if (Gi_392 == -2) { Comment("\nOnline authorization is failed! Please, register your account at http://www.google.com and restart your MT4 platform!"); Alert("Online authorization is failed! Please, register your account at http://www.google.com and restart your MT4 platform!"); } else { if (Gi_392 == -7) { Comment("\nInaccurate local system time! Please, synchronize your computer system time and then restart your MT4 platform!"); Alert("Inaccurate local system time! Please, synchronize your computer system time and then restart your MT4 platform!"); } else { if (Gi_392 == -8) { Comment("\nUnsupported currency pair " + Gs_396 + ", Bid: " + DoubleToStr(Bid, Digits) + ", Ask: " + DoubleToStr(Ask, Digits) + ". Supported currency pairs: GBPUSD and EURUSD"); Alert("Unsupported currency pair " + Gs_396 + ", Bid: " + DoubleToStr(Bid, Digits) + ", Ask: " + DoubleToStr(Ask, Digits) + ". Supported currency pairs: GBPUSD and EURUSD"); } else { if (Gi_392 == -9) { Comment("\nLocal authorization check is failed! Please, restart MT4 platform!"); Alert("Local authorization check is failed! Please, restart MT4 platform!"); } else { Comment("\nInitialization is failed with error code " + DoubleToStr(Gi_392, 0)); Alert("Initialization is failed with error code " + DoubleToStr(Gi_392, 0)); } } } } } Sleep(10000); return (0); } if (ForceProfit <= 0 || ForceLoss <= 0 || G_period_232 <= 0 || G_period_236 <= 0 || G_period_252 <= 0) { Comment("\nWrong initialization parameters for pair " + Symbol()); Alert("Wrong initialization parameters for pair " + Symbol()); Sleep(10000); return (0); } double order_open_price_92 = 0; double order_open_price_100 = 0; double Ld_108 = 0; double Ld_116 = 0; double Ld_124 = 0; double Ld_132 = 0; bool Li_140 = FALSE; bool Li_144 = FALSE; int Li_148 = 0; int Li_152 = 0; int count_156 = 0; int count_160 = 0; int count_164 = 0; int count_168 = 0; double Ld_172 = 0; if (StringSubstr(AccountCurrency(), 0, 3) == "JPY") { Ld_172 = MarketInfo("USDJPY" + StringSubstr(Symbol(), 6), MODE_BID); if (Ld_172 > 0.1) Ld_84 = Ld_172; else Ld_84 = 94; } if (StringSubstr(AccountCurrency(), 0, 3) == "GBP") { Ld_172 = MarketInfo("GBPUSD" + StringSubstr(Symbol(), 6), MODE_BID); if (Ld_172 > 0.1) Ld_84 = 1 / Ld_172; else Ld_84 = 0.6622516556; } if (StringSubstr(AccountCurrency(), 0, 3) == "EUR") { Ld_172 = MarketInfo("EURUSD" + StringSubstr(Symbol(), 6), MODE_BID); if (Ld_172 > 0.1) Ld_84 = 1 / Ld_172; else Ld_84 = 0.78125; } Ld_52 = MathCeil(1.0 / Ld_84 / 100.0 * AccountBalance() / G_lotstep_436 / (G_lotsize_444 / 100)) * G_lotstep_436; if (AutoMM > 0.0 && (!RecoveryMode)) lots_44 = MathMax(G_minlot_420, MathMin(G_maxlot_428, MathCeil(MathMin(AutoMM_Max, AutoMM) / Ld_84 / 100.0 * AccountFreeMargin() / G_lotstep_436 / (G_lotsize_444 / 100)) * G_lotstep_436)); if (AutoMM > 0.0 && RecoveryMode) lots_44 = f0_9(); if (AutoMM == 0.0) lots_44 = FixedLots; double order_stoploss_180 = 0; double order_takeprofit_188 = 0; double order_stoploss_196 = 0; double order_takeprofit_204 = 0; for (int pos_212 = 0; pos_212 <= OrdersTotal() - 1; pos_212++) { if (!OrderSelect(pos_212, SELECT_BY_POS, MODE_TRADES)) Print("Error in OrderSelect! Position:", pos_212); else { if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderMagicNumber() != Magic) { if (OrderType() == OP_BUY) count_164++; else count_168++; } if (OrderMagicNumber() == Magic) { Ld_76 += OrderProfit(); if (OrderType() == OP_BUY) Ld_60 = (Bid - OrderOpenPrice()) / Gd_456; else Ld_60 = (OrderOpenPrice() - Ask) / Gd_456; Ld_68 += Ld_60; if (OrderType() == OP_BUY) { count_156++; Ld_108 += OrderOpenPrice() * OrderLots(); Ld_124 += OrderLots(); Li_148 = MathMax(Li_148, OrderOpenTime()); if (order_open_price_92 < Point || OrderOpenPrice() < order_open_price_92) order_open_price_92 = OrderOpenPrice(); if (!((FixedTakeProfit > 0 || FixedStopLoss > 0))) continue; if (order_stoploss_180 < Point && order_takeprofit_188 < Point) { order_stoploss_180 = OrderStopLoss(); order_takeprofit_188 = OrderTakeProfit(); } if (order_stoploss_180 < Point && order_takeprofit_188 < Point) { if (FixedStopLoss > 0) order_stoploss_180 = MathMin(OrderOpenPrice() - FixedStopLoss * Gd_456, Bid - G_stoplevel_416 * Point); if (FixedTakeProfit > 0) order_takeprofit_188 = MathMax(OrderOpenPrice() + FixedTakeProfit * Gd_456, Ask + G_stoplevel_416 * Point); } if (!((OrderStopLoss() < Point && OrderTakeProfit() < Point))) continue; if (!((MathAbs(order_stoploss_180 - OrderStopLoss()) >= Point || MathAbs(order_takeprofit_188 - OrderTakeProfit()) >= Point))) continue; OrderModify(OrderTicket(), OrderOpenPrice(), order_stoploss_180, order_takeprofit_188, 0, CLR_NONE); continue; } count_160++; Ld_116 += OrderOpenPrice() * OrderLots(); Ld_132 += OrderLots(); Li_152 = MathMax(Li_152, OrderOpenTime()); if (order_open_price_100 < Point || OrderOpenPrice() > order_open_price_100) order_open_price_100 = OrderOpenPrice(); if (FixedTakeProfit > 0 || FixedStopLoss > 0) { if (order_stoploss_196 < Point && order_takeprofit_204 < Point) { order_stoploss_196 = OrderStopLoss(); order_takeprofit_204 = OrderTakeProfit(); } if (order_stoploss_196 < Point && order_takeprofit_204 < Point) { if (FixedStopLoss > 0) order_stoploss_196 = MathMax(OrderOpenPrice() + FixedStopLoss * Gd_456, Ask + G_stoplevel_416 * Point); if (FixedTakeProfit > 0) order_takeprofit_204 = MathMin(OrderOpenPrice() - FixedTakeProfit * Gd_456, Bid - G_stoplevel_416 * Point); } if (OrderStopLoss() < Point && OrderTakeProfit() < Point) if (MathAbs(order_stoploss_196 - OrderStopLoss()) >= Point || MathAbs(order_takeprofit_204 - OrderTakeProfit()) >= Point) OrderModify(OrderTicket(), OrderOpenPrice(), order_stoploss_196, order_takeprofit_204, 0, CLR_NONE); } } } } } if (count_156 > 0 && Ld_124 > 0.0) Ld_108 = NormalizeDouble(Ld_108 / Ld_124, Digits); if (count_160 > 0 && Ld_132 > 0.0) Ld_116 = NormalizeDouble(Ld_116 / Ld_132, Digits); if ((!IsTesting()) || IsVisualMode()) { if ((!IsTesting() || TimeCurrent() >= G_datetime_480 + 1) || !Gi_144 || iVolume(NULL, PERIOD_M1, 0) <= 1.0) { G_datetime_480 = TimeCurrent(); color_16 = SeaGreen; if (lots_44 > 3.0 * Ld_52) color_16 = Red; else if (lots_44 > 1.5 * Ld_52) color_16 = OrangeRed; if (ObjectFind("BKGR") < 0) { ObjectCreate("BKGR", OBJ_LABEL, 0, 0, 0); ObjectSetText("BKGR", "g", 110, "Webdings", DarkSlateGray); ObjectSet("BKGR", OBJPROP_CORNER, 0); ObjectSet("BKGR", OBJPROP_BACK, TRUE); ObjectSet("BKGR", OBJPROP_XDISTANCE, 5); ObjectSet("BKGR", OBJPROP_YDISTANCE, 15); } if (ObjectFind("BKGR2") < 0) { ObjectCreate("BKGR2", OBJ_LABEL, 0, 0, 0); ObjectSetText("BKGR2", "g", 110, "Webdings", color_16); ObjectSet("BKGR2", OBJPROP_BACK, TRUE); ObjectSet("BKGR2", OBJPROP_XDISTANCE, 5); ObjectSet("BKGR2", OBJPROP_YDISTANCE, 60); } else ObjectSet("BKGR2", OBJPROP_COLOR, color_16); if (ObjectFind("BKGR3") < 0) { ObjectCreate("BKGR3", OBJ_LABEL, 0, 0, 0); ObjectSetText("BKGR3", "g", 110, "Webdings", color_16); ObjectSet("BKGR3", OBJPROP_CORNER, 0); ObjectSet("BKGR3", OBJPROP_BACK, TRUE); ObjectSet("BKGR3", OBJPROP_XDISTANCE, 5); ObjectSet("BKGR3", OBJPROP_YDISTANCE, 45); } else ObjectSet("BKGR3", OBJPROP_COLOR, color_16); if (ObjectFind("LV") < 0) { ObjectCreate("LV", OBJ_LABEL, 0, 0, 0); ObjectSetText("LV", "VOLATILITY FACTOR", 9, "Tahoma Bold", White); ObjectSet("LV", OBJPROP_CORNER, 0); ObjectSet("LV", OBJPROP_BACK, FALSE); ObjectSet("LV", OBJPROP_XDISTANCE, 13); ObjectSet("LV", OBJPROP_YDISTANCE, 23); } if (ObjectFind("BKGR4") < 0) { ObjectCreate("BKGR4", OBJ_LABEL, 0, 0, 0); ObjectSetText("BKGR4", "g", 110, "Webdings", color_16); ObjectSet("BKGR4", OBJPROP_CORNER, 0); ObjectSet("BKGR4", OBJPROP_BACK, TRUE); ObjectSet("BKGR4", OBJPROP_XDISTANCE, 5); if (AutoMM > 0.0) ObjectSet("BKGR4", OBJPROP_YDISTANCE, 155); else ObjectSet("BKGR4", OBJPROP_YDISTANCE, 132); } else ObjectSet("BKGR4", OBJPROP_COLOR, color_16); if (IsTesting()) DST_Usage = FALSE; if (DST_Usage == TRUE) Ls_20 = "YES"; if (DST_Usage == FALSE) Ls_20 = "NO"; Ls_36 = Ls_36 + "\n " + "\n " + "\n Authorization - OK!" + "\n -----------------------------------------------" + "\n GMT : " + TimeToStr(TimeCurrent() - 3600 * Gi_404, TIME_DATE|TIME_MINUTES|TIME_SECONDS) + "\n Broker : " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS) + "\n Broker GMT Offset: " + Gi_404 + "\n DST_Usage: " + Ls_20 + "\n -----------------------------------------------" + "\n Force SL / TP = " + ForceLoss + " / " + ForceProfit + " pips" + "\n Fixed SL / TP = " + FixedStopLoss + " / " + FixedTakeProfit + " pips" + "\n Spread = " + DoubleToStr((Ask - Bid) / Gd_456, 1) + " pips"; if (Ask - Bid > MaxSpread * Gd_456) Ls_36 = Ls_36 + " - TOO HIGH"; else Ls_36 = Ls_36 + " - NORMAL"; Ls_36 = Ls_36 + "\n -----------------------------------------------"; if (AutoMM > 0.0) { Ls_36 = Ls_36 + "\n AutoMM - ENABLED" + "\n Risk = " + DoubleToStr(AutoMM, 1) + "%"; } Ls_36 = Ls_36 + "\n Lots = " + DoubleToStr(lots_44, 2); if (lots_44 <= 1.5 * Ld_52) Ls_36 = Ls_36 + " - LOW RISK"; if (lots_44 > 1.5 * Ld_52 && lots_44 <= 3.0 * Ld_52) Ls_36 = Ls_36 + " - MODERATE RISK"; if (lots_44 > 3.0 * Ld_52) Ls_36 = Ls_36 + " - HIGH RISK !!!"; Ls_36 = Ls_36 + "\n -----------------------------------------------"; if (RecoveryMode) { Ls_36 = Ls_36 + "\n Recovery Mode - ENABLED"; } else { Ls_36 = Ls_36 + "\n Recovery Mode - DISABLED"; } Ls_36 = Ls_36 + "\n -----------------------------------------------"; Ls_36 = Ls_36 + "\n Account Ballance = " + DoubleToStr(AccountBalance(), 2); if (count_156 == 0 && count_160 == 0) { Ls_36 = Ls_36 + "\n No active trades" + "\n"; } else { if (count_156 > 0) { Ls_36 = Ls_36 + "\n Buy average price " + DoubleToStr(Ld_108, Digits); } if (count_160 > 0) { Ls_36 = Ls_36 + "\n Sell average price " + DoubleToStr(Ld_116, Digits); } Ls_36 = Ls_36 + "\n Current trade " + DoubleToStr(Ld_68, 1) + " pips" + "\n Account Profit = " + DoubleToStr(Ld_76, 2); } Comment(Ls_36); } } if (Gi_144 && iVolume(NULL, PERIOD_M1, 0) > 1.0) return (0); HideTestIndicators(TRUE); double iopen_216 = iOpen(NULL, PERIOD_M1, 1); double iclose_224 = iClose(NULL, PERIOD_M1, 1); double ibands_232 = iBands(NULL, PERIOD_M15, G_period_232, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); double ibands_240 = iBands(NULL, PERIOD_M15, G_period_232, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); double ibands_248 = iBands(NULL, PERIOD_M15, G_period_236, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); double ibands_256 = iBands(NULL, PERIOD_M15, G_period_236, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); double ima_264 = iMA(NULL, PERIOD_H4, G_period_252, 0, MODE_SMMA, PRICE_CLOSE, 1); double ima_272 = iMA(NULL, PERIOD_H4, G_period_260, 0, MODE_SMMA, PRICE_CLOSE, 1); double iatr_280 = iATR(NULL, PERIOD_M15, G_period_232, 1); double irsi_288 = iRSI(NULL, PERIOD_M15, 0, G_period_232, 1); double iatr_296 = iATR(NULL, PERIOD_H4, G_period_252, 1); double irsi_304 = iRSI(NULL, PERIOD_H4, 0, G_period_252, 1); double ibands_312 = iBands(NULL, PERIOD_H4, G_period_300, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); double ibands_320 = iBands(NULL, PERIOD_H4, G_period_300, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); double ibands_328 = iBands(NULL, PERIOD_M15, G_period_328, 2, 0, PRICE_CLOSE, MODE_UPPER, 1); double ibands_336 = iBands(NULL, PERIOD_M15, G_period_328, 2, 0, PRICE_CLOSE, MODE_LOWER, 1); HideTestIndicators(FALSE); int Li_344 = -1000; if (CloseOnlyOnProfit) { Li_344 = MinProfitPips; Gi_268 = MinProfitPips; } if (count_156 > 0) { if (f0_11(Gi_392, iclose_224, ibands_232 + Gi_248 * Gd_456, ibands_240 - Gi_248 * Gd_456, Bid, f0_1(), iatr_280, irsi_288) == 0 && Bid >= Ld_108 + Li_344 * Gd_456) Li_140 = TRUE; if ((Bid >= Ld_108 + ForceProfit * Gd_456 && f0_4(Gi_392, TimeCurrent() - Li_148, iatr_296, irsi_304, Gi_336)) || Bid <= Ld_108 - ForceLoss * Gd_456) Li_140 = TRUE; if (Bid >= Ld_108 + Gi_268 * Gd_456 && f0_2(Gi_392, TimeCurrent() - Li_148, iatr_296, irsi_304, Gi_332)) Li_140 = TRUE; if (Bid >= Ld_108 + Gi_280 * Gd_456 && iopen_216 > iclose_224) Li_140 = TRUE; } if (count_160 > 0) { if (f0_11(Gi_392, iclose_224, ibands_232 + Gi_248 * Gd_456, ibands_240 - Gi_248 * Gd_456, Bid, f0_1(), iatr_280, irsi_288) == 1 && Ask <= Ld_116 - Li_344 * Gd_456) Li_144 = TRUE; if ((Ask <= Ld_116 - ForceProfit * Gd_456 && f0_4(Gi_392, TimeCurrent() - Li_152, iatr_296, irsi_304, Gi_336)) || Ask >= Ld_116 + ForceLoss * Gd_456) Li_144 = TRUE; if (Ask <= Ld_116 - Gi_268 * Gd_456 && f0_2(Gi_392, TimeCurrent() - Li_152, iatr_296, irsi_304, Gi_332)) Li_144 = TRUE; if (Ask <= Ld_116 - Gi_280 * Gd_456 && iopen_216 < iclose_224) Li_144 = TRUE; } if (Li_140 || Li_144) { for (pos_212 = 0; pos_212 <= OrdersTotal() - 1; pos_212++) { if (!OrderSelect(pos_212, SELECT_BY_POS, MODE_TRADES)) Print("Error in OrderSelect! Position:", pos_212); else { if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { if (OrderType() == OP_BUY && Li_140) { for (int Li_348 = 1; Li_348 <= MathMax(1, Gi_376); Li_348++) { RefreshRates(); if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Slippage, Violet)) { count_156--; pos_212--; break; } Sleep(MathMax(100, 1000 * Gi_380)); } Sleep(5000); continue; } if (OrderType() == OP_SELL && Li_144) { for (Li_348 = 1; Li_348 <= MathMax(1, Gi_376); Li_348++) { RefreshRates(); if (OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), Slippage, Violet)) { count_160--; pos_212--; break; } Sleep(MathMax(100, 1000 * Gi_380)); } Sleep(5000); } } } } } bool Li_352 = TRUE; bool Li_356 = TRUE; if (NFA == TRUE && count_160 > 0 || count_168 > 0 || count_164 > 0) Li_352 = FALSE; if (NFA == TRUE && count_156 > 0 || count_164 > 0 || count_168 > 0) Li_356 = FALSE; if (Gi_120 == TRUE && count_160 > 0 || count_168 > 0) Li_352 = FALSE; if (Gi_120 == TRUE && count_156 > 0 || count_164 > 0) Li_356 = FALSE; if (OrdersTotal() >= Gi_228) return (0); if (DayOfWeek() == 5 && Hour() >= Gi_404 && f0_1() >= Gi_284) return (0); if (ibands_248 - ibands_256 < Gi_272 * Gd_456) return (0); int cmd_360 = -1; if (count_156 <= MaxNegAdds) { if ((count_156 < 1 && Signal_1 == TRUE && f0_3(Gi_392, Bid, ibands_248 + Gi_240 * Gd_456, ibands_248 + Gi_244 * Gd_456, ibands_256 - Gi_240 * Gd_456, ibands_256 - Gi_244 * Gd_456, MathMin(ima_264 + Gi_256 * Gd_456, ima_272 + Gi_264 * Gd_456), MathMax(ima_264 - Gi_256 * Gd_456, ima_272 - Gi_264 * Gd_456)) == 0) || (count_156 < 1 && Signal_2 == TRUE && f0_8(Gi_392, Bid, ibands_248 + Gi_240 * Gd_456, ibands_248 + Gi_244 * Gd_456, ibands_256 - Gi_240 * Gd_456, ibands_256 - Gi_244 * Gd_456, f0_1(), Gi_340, Gi_344, Gi_348, Gi_352) == 0) || (count_156 < 1 && Gi_96 == TRUE && f0_10(Gi_392, Bid, MathMax(ibands_248 + Gi_288 * Gd_456, ibands_312 - Gi_296 * Gd_456), MathMin(ibands_256 - Gi_288 * Gd_456, ibands_320 + Gi_296 * Gd_456), iHigh(NULL, PERIOD_H4, 1), iLow(NULL, PERIOD_H4, 1), ibands_312 + Gi_292 * Gd_456, ibands_320 - Gi_292 * Gd_456, ibands_312 - ibands_320, Gi_304 * Gd_456) == 0) || (count_156 < 1 && Gi_100 == TRUE && f0_5(Gi_392, Bid, MathMax(ibands_328 + Gi_308 * Gd_456, iMA(NULL, PERIOD_H1, G_period_312, 0, MODE_SMA, PRICE_CLOSE, 1) + Gi_316 * Gd_456), iMA(NULL, PERIOD_H1, G_period_320, 0, MODE_SMMA, PRICE_CLOSE, 1) - Gi_324 * Gd_456, MathMin(ibands_336 - Gi_308 * Gd_456, iMA(NULL, PERIOD_H1, G_period_312, 0, MODE_SMA, PRICE_CLOSE, 1) - Gi_316 * Gd_456), iMA(NULL, PERIOD_H1, G_period_320, 0, MODE_SMMA, PRICE_CLOSE, 1) + Gi_324 * Gd_456) == 0) || (count_156 >= 1 && Ask < order_open_price_92 - BetterPricePips * Gd_456)) { if (Ask - Bid > MaxSpread * Gd_456) { Print("BUY not taken!!! - High spead..."); Sleep(1000); } else { if (!Li_352) { Print("BUY not taken!!! - No Hedge, or FIFO restriction ..."); Sleep(1000); } else { Ls_28 = "BUY"; cmd_360 = 0; color_8 = Aqua; RefreshRates(); price_0 = NormalizeDouble(Ask, Digits); } } } } if (count_160 <= MaxNegAdds) { if ((count_160 < 1 && Signal_1 == TRUE && f0_3(Gi_392, Bid, ibands_248 + Gi_240 * Gd_456, ibands_248 + Gi_244 * Gd_456, ibands_256 - Gi_240 * Gd_456, ibands_256 - Gi_244 * Gd_456, MathMin(ima_264 + Gi_256 * Gd_456, ima_272 + Gi_264 * Gd_456), MathMax(ima_264 - Gi_256 * Gd_456, ima_272 - Gi_264 * Gd_456)) == 1) || (count_160 < 1 && Signal_2 == TRUE && f0_8(Gi_392, Bid, ibands_248 + Gi_240 * Gd_456, ibands_248 + Gi_244 * Gd_456, ibands_256 - Gi_240 * Gd_456, ibands_256 - Gi_244 * Gd_456, f0_1(), Gi_340, Gi_344, Gi_348, Gi_352) == 1) || (count_160 < 1 && Gi_96 == TRUE && f0_10(Gi_392, Bid, MathMax(ibands_248 + Gi_288 * Gd_456, ibands_312 - Gi_296 * Gd_456), MathMin(ibands_256 - Gi_288 * Gd_456, ibands_320 + Gi_296 * Gd_456), iHigh(NULL, PERIOD_H4, 1), iLow(NULL, PERIOD_H4, 1), ibands_312 + Gi_292 * Gd_456, ibands_320 - Gi_292 * Gd_456, ibands_312 - ibands_320, Gi_304 * Gd_456) == 1) || (count_160 < 1 && Gi_100 == TRUE && f0_5(Gi_392, Bid, MathMax(ibands_328 + Gi_308 * Gd_456, iMA(NULL, PERIOD_H1, G_period_312, 0, MODE_SMA, PRICE_CLOSE, 1) + Gi_316 * Gd_456), iMA(NULL, PERIOD_H1, G_period_320, 0, MODE_SMMA, PRICE_CLOSE, 1) - Gi_324 * Gd_456, MathMin(ibands_336 - Gi_308 * Gd_456, iMA(NULL, PERIOD_H1, G_period_312, 0, MODE_SMA, PRICE_CLOSE, 1) - Gi_316 * Gd_456), iMA(NULL, PERIOD_H1, G_period_320, 0, MODE_SMMA, PRICE_CLOSE, 1) + Gi_324 * Gd_456) == 1) || (count_160 >= 1 && Bid > order_open_price_100 + BetterPricePips * Gd_456)) { if (Ask - Bid > MaxSpread * Gd_456) { Print("SELL not taken!!! - High spead..."); Sleep(1000); } else { if (!Li_356) { Print("SELL not taken!!! - No Hedge, or FIFO restriction ..."); Sleep(1000); } else { Ls_28 = "SELL"; cmd_360 = 1; color_8 = Red; RefreshRates(); price_0 = NormalizeDouble(Bid, Digits); } } } } if (cmd_360 >= OP_BUY && f0_6()) { for (Li_348 = 1; Li_348 <= MathMax(1, Gi_376); Li_348++) { ticket_12 = OrderSend(Symbol(), cmd_360, lots_44, price_0, Slippage * (Gd_456 / Point), 0, 0, EA_Comment, Magic, 0, color_8); if (ticket_12 >= 0) break; Sleep(MathMax(100, 1000 * Gi_380)); RefreshRates(); if (cmd_360 == OP_BUY) price_0 = NormalizeDouble(Ask, Digits); else if (cmd_360 == OP_SELL) price_0 = NormalizeDouble(Bid, Digits); } Sleep(1000); if (ticket_12 > 0) { if (OrderSelect(ticket_12, SELECT_BY_TICKET, MODE_TRADES)) { Print("Order " + Ls_28 + " opened!: ", OrderOpenPrice()); if (FixedTakeProfit > 0 || FixedStopLoss > 0) { if (OrderType() == OP_BUY) { if (count_156 == 0) { order_stoploss_180 = 0; order_takeprofit_188 = 0; if (FixedStopLoss > 0) order_stoploss_180 = MathMin(OrderOpenPrice() - FixedStopLoss * Gd_456, Bid - G_stoplevel_416 * Point); if (FixedTakeProfit > 0) order_takeprofit_188 = MathMax(OrderOpenPrice() + FixedTakeProfit * Gd_456, Ask + G_stoplevel_416 * Point); } if (MathAbs(order_stoploss_180 - OrderStopLoss()) >= Point || MathAbs(order_takeprofit_188 - OrderTakeProfit()) >= Point) OrderModify(OrderTicket(), OrderOpenPrice(), order_stoploss_180, order_takeprofit_188, 0, CLR_NONE); } else { if (OrderType() == OP_SELL) { if (count_160 == 0) { order_stoploss_196 = 0; order_takeprofit_204 = 0; if (FixedStopLoss > 0) order_stoploss_196 = MathMax(OrderOpenPrice() + FixedStopLoss * Gd_456, Ask + G_stoplevel_416 * Point); if (FixedTakeProfit > 0) order_takeprofit_204 = MathMin(OrderOpenPrice() - FixedTakeProfit * Gd_456, Bid - G_stoplevel_416 * Point); } if (MathAbs(order_stoploss_196 - OrderStopLoss()) >= Point || MathAbs(order_takeprofit_204 - OrderTakeProfit()) >= Point) OrderModify(OrderTicket(), OrderOpenPrice(), order_stoploss_196, order_takeprofit_204, 0, CLR_NONE); } } } } } else Print("Error opening " + Ls_28 + " order!: ", GetLastError()); Sleep(4000); } return (0); } // 9B1AEE847CFB597942D106A4135D4FE6 double f0_9() { double Ld_0; int count_8; double Ld_12; int Li_20; double Ld_24; int Li_32; double Ld_36; int Li_44; double Ld_48 = 1; if (Gd_368 > 0.0 && AutoMM > 0.0) { Ld_0 = 0; count_8 = 0; Ld_12 = 0; Li_20 = 0; Ld_24 = 0; Li_32 = 0; for (int pos_56 = OrdersHistoryTotal() - 1; pos_56 >= 0; pos_56--) { if (OrderSelect(pos_56, SELECT_BY_POS, MODE_HISTORY)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { count_8++; Ld_0 += OrderProfit(); if (Ld_0 > Ld_24) { Ld_24 = Ld_0; Li_32 = count_8; } if (Ld_0 < Ld_12) { Ld_12 = Ld_0; Li_20 = count_8; } if (count_8 >= Gi_356) break; } } } if (Li_32 <= Li_20) Ld_48 = MathPow(Gd_368, Li_20); else { Ld_0 = Ld_24; count_8 = Li_32; Ld_36 = Ld_24; Li_44 = Li_32; for (pos_56 = OrdersHistoryTotal() - Li_32 - 1; pos_56 >= 0; pos_56--) { if (OrderSelect(pos_56, SELECT_BY_POS, MODE_HISTORY)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { if (count_8 >= Gi_356) break; count_8++; Ld_0 += OrderProfit(); if (Ld_0 < Ld_36) { Ld_36 = Ld_0; Li_44 = count_8; } } } } if (Li_44 == Li_32 || Ld_36 == Ld_24) Ld_48 = MathPow(Gd_368, Li_20); else { if (MathAbs(Ld_12 - Ld_24) / MathAbs(Ld_36 - Ld_24) >= (Gd_360 + 100.0) / 100.0) Ld_48 = MathPow(Gd_368, Li_20); else Ld_48 = MathPow(Gd_368, Li_44); } } } for (double Ld_ret_60 = MathMax(G_minlot_420, MathMin(G_maxlot_428, MathCeil(MathMin(AutoMM_Max, Ld_48 * AutoMM) / Gd_472 / 100.0 * AccountFreeMargin() / G_lotstep_436 / (G_lotsize_444 / 100)) * G_lotstep_436)); Ld_ret_60 >= 2.0 * G_minlot_420 && 1.05 * (Ld_ret_60 * G_marginrequired_448) >= AccountFreeMargin(); Ld_ret_60 -= G_minlot_420) { } return (Ld_ret_60); } // 6ABA3523C7A75AAEA41CC0DEC7953CC5 int f0_6() { int datetime_0; bool Li_ret_4 = TRUE; if (Gi_384 > 0 && Gi_388 > 0) { datetime_0 = 0; for (int pos_8 = OrdersHistoryTotal() - 1; pos_8 >= 0; pos_8--) { if (OrderSelect(pos_8, SELECT_BY_POS, MODE_HISTORY)) { if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic) { if (!(((OrderType() == OP_BUY && (OrderClosePrice() - OrderOpenPrice()) / Gd_456 <= (-Gi_384)) || (OrderType() == OP_SELL && (OrderOpenPrice() - OrderClosePrice()) / Gd_456 <= (-Gi_384))))) break; datetime_0 = OrderCloseTime(); break; } } } if (TimeCurrent() - datetime_0 < 3600 * Gi_388) Li_ret_4 = FALSE; } return (Li_ret_4); } // 2569208C5E61CB15E209FFE323DB48B7 int f0_1() { int Li_ret_0 = Hour(); Li_ret_0 -= Gi_404; if (IsTesting()) DST_Usage = FALSE; if (DST_Usage == TRUE && (Month() > 3 && Month() < 11)) Li_ret_0++; if (Li_ret_0 > 23) Li_ret_0 -= 24; if (Li_ret_0 < 0) Li_ret_0 += 24; return (Li_ret_0); } // 09CBB5F5CE12C31A043D5C81BF20AA4A int f0_0() { if (Gi_180) Gs_396 = StringSubstr(Gs_gbpusd_184, 0, 6); else Gs_396 = StringSubstr(Symbol(), 0, 6); int Li_ret_0 = f0_14(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), Gs_396, TimeCurrent()); if (Li_ret_0 == -8 && StringFind(",GBPUSD,", "," + Gs_396 + ",") >= 0) { Comment("\nUpdating settings (" + Gs_396 + ")..."); Li_ret_0 = f0_12(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), Gs_396); Sleep(3000); Li_ret_0 = f0_14(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), Gs_396, TimeCurrent()); } if (Li_ret_0 >= 0) { f0_7(); if (!IsTesting() && AutoGMT_Offset == TRUE) Gi_404 = Gd_488; else Gi_404 = ManualGMT_Offset; if (Gs_396 == "GBPUSD") { if (BetterPricePips <= 0) BetterPricePips = 15; if (ForceProfit <= 0) ForceProfit = 11; if (ForceLoss <= 0) ForceLoss = 48; if (FixedTakeProfit <= 0) FixedTakeProfit = 0; if (FixedStopLoss <= 0) FixedStopLoss = 0; if (G_period_232 == 0) G_period_232 = 10; if (G_period_236 == 0) G_period_236 = 10; if (Gi_240 == FALSE) Gi_240 = TRUE; if (Gi_244 == 0) Gi_244 = 28; if (Gi_248 == FALSE) Gi_248 = TRUE; if (G_period_252 == 0) G_period_252 = 20; if (Gi_256 == 0) Gi_256 = 95; if (G_period_260 == 0) G_period_260 = 8; if (Gi_264 == 0) Gi_264 = 75; if (Gi_332 == 0) Gi_332 = 100; if (Gi_268 == 0) Gi_268 = -1; if (Gi_336 == FALSE) Gi_336 = FALSE; if (Gi_272 == 0) Gi_272 = 10; if (Gi_276 == 0) Gi_276 = 20; if (Gi_280 == 0) Gi_280 = 8; if (Gi_340 < 0) Gi_340 = 22; if (Gi_344 < 0) Gi_344 = 21; if (Gi_348 < 0) Gi_348 = 55; if (Gi_352 < 0) Gi_352 = 55; if (Gi_284 < 0) Gi_284 = 24; if (Gi_288 == 0) Gi_288 = 7; if (Gi_292 == 0) Gi_292 = 18; if (Gi_296 == 0) Gi_296 = 37; if (G_period_300 == 0) G_period_300 = 4; if (Gi_304 == 0) Gi_304 = 15; if (Gi_308 == 0) Gi_308 = 0; if (G_period_312 == 0) G_period_312 = 50; if (Gi_316 == 0) Gi_316 = 10; if (G_period_320 == 0) G_period_320 = 6; if (Gi_324 == FALSE) Gi_324 = FALSE; if (G_period_328 == 0) G_period_328 = 10; } else { if (Gs_396 == "EURUSD") { if (BetterPricePips <= 0) BetterPricePips = 7; if (ForceProfit <= 0) ForceProfit = 8; if (ForceLoss <= 0) ForceLoss = 49; if (FixedTakeProfit <= 0) FixedTakeProfit = 0; if (FixedStopLoss <= 0) FixedStopLoss = 0; if (G_period_232 == 0) G_period_232 = 25; if (G_period_236 == 0) G_period_236 = 12; if (Gi_240 == FALSE) Gi_240 = TRUE; if (Gi_244 == 0) Gi_244 = 64; if (Gi_248 == FALSE) Gi_248 = TRUE; if (G_period_252 == 0) G_period_252 = 23; if (Gi_256 == 0) Gi_256 = 80; if (G_period_260 == 0) G_period_260 = 5; if (Gi_264 == 0) Gi_264 = 60; if (Gi_332 == 0) Gi_332 = 60; if (Gi_268 == 0) Gi_268 = 5; if (Gi_336 == FALSE) Gi_336 = FALSE; if (Gi_272 == 0) Gi_272 = 8; if (Gi_280 == 0) Gi_280 = 6; if (Gi_340 < 0) Gi_340 = 21; if (Gi_344 < 0) Gi_344 = 4; if (Gi_348 < 0) Gi_348 = 5; if (Gi_352 < 0) Gi_352 = 55; if (Gi_284 < 0) Gi_284 = 24; if (Gi_288 == 0) Gi_288 = 7; if (Gi_292 == 0) Gi_292 = 28; if (Gi_296 == 0) Gi_296 = 42; if (G_period_300 == 0) G_period_300 = 5; if (Gi_304 == 0) Gi_304 = 5; if (Gi_308 == 0) Gi_308 = -1; if (G_period_312 == 0) G_period_312 = 55; if (Gi_316 == 0) Gi_316 = 60; if (G_period_320 == 0) G_period_320 = 9; if (Gi_324 == FALSE) Gi_324 = FALSE; if (G_period_328 == 0) G_period_328 = 4; } } } return (Li_ret_0); } // A9B24A824F70CC1232D1C2BA27039E8D int f0_13() { int Li_ret_0; if (Gi_180) Li_ret_0 = f0_12(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), StringSubstr(Gs_gbpusd_184, 0, 6)); else Li_ret_0 = f0_12(AccountNumber(), IsTesting(), IsDemo(), WindowHandle(Symbol(), Period()), StringSubstr(Symbol(), 0, 6)); return (Li_ret_0); } // C5E62F3FCB6155E3CE7D9E8F8E580D71 int f0_14(int Ai_unused_0, int Ai_unused_4, int Ai_unused_8, int Ai_unused_12, string As_unused_16, int Ai_unused_24) { return (1); } // A907CDC81AE71C6C45C17CAF37ABC58E int f0_12(int Ai_unused_0, int Ai_unused_4, int Ai_unused_8, int Ai_unused_12, string As_unused_16) { return (1); } // 32A37D425F204296E0E6671E97D2883F int f0_3(int Ai_unused_0, double Ad_4, double Ad_12, double Ad_20, double Ad_28, double Ad_36, double Ad_44, double Ad_52) { if (Ad_4 < Ad_28 && Ad_4 > Ad_36 && Ad_4 > Ad_44) return (0); if (Ad_4 > Ad_12 && Ad_4 < Ad_20 && Ad_4 < Ad_52) return (1); return (-1); } // 7D34D6503845354A681EEE905688E590 int f0_8(int Ai_unused_0, double Ad_4, double Ad_12, double Ad_20, double Ad_28, double Ad_36, int Ai_44, int Ai_48, int Ai_52, int Ai_56, int Ai_60) { if (Ad_4 < Ad_28 && Ad_4 > Ad_36 && Ai_44 == Ai_48 || Ai_44 == Ai_52 || Ai_44 == Ai_56 || Ai_44 == Ai_60) return (0); if (Ad_4 > Ad_12 && Ad_4 < Ad_20 && Ai_44 == Ai_48 || Ai_44 == Ai_52 || Ai_44 == Ai_56 || Ai_44 == Ai_60) return (1); return (-1); } // 9BB762BAB7EA8222855AA32771194502 int f0_10(int Ai_unused_0, double Ad_4, double Ad_12, double Ad_20, double Ad_28, double Ad_36, double Ad_44, double Ad_52, double Ad_60, double Ad_68) { if (Ad_4 < Ad_20 && Ad_36 < Ad_52 && Ad_60 > Ad_68) return (0); if (Ad_4 > Ad_12 && Ad_28 > Ad_44 && Ad_60 > Ad_68) return (1); return (-1); } // 4F7E59B4CBAA5A523B2D6F408DA2492B int f0_5(int Ai_unused_0, double Ad_4, double Ad_12, double Ad_20, double Ad_28, double Ad_36) { if (Ad_4 < Ad_28 && Ad_4 > Ad_36) return (0); if (Ad_4 > Ad_12 && Ad_4 < Ad_20) return (1); return (-1); } // A02221E0678121D3008A62C0EC1AC4B7 int f0_11(int Ai_unused_0, double Ad_unused_4, double Ad_12, double Ad_20, double Ad_28, int Ai_unused_36, double Ad_40, double Ad_48) { if (Ad_48 >= 0.0 && Ad_40 > 0.0) { if (Ad_28 > Ad_12) return (0); if (Ad_28 < Ad_20) return (1); } return (-1); } // 310497C7D447D6495B4F5507EF8701AB int f0_2(int Ai_unused_0, int Ai_4, double Ad_8, double Ad_16, int Ai_24) { if (Ad_16 >= 0.0 && Ad_8 > 0.0 && Ai_4 > 60 * Ai_24) return (1); return (0); } // 4B312AB5E5069DDD6F8D42DF31E5A606 int f0_4(int Ai_unused_0, int Ai_4, double Ad_8, double Ad_16, int Ai_24) { if (Ad_16 >= 0.0 && Ad_8 > 0.0 && Ai_4 > 60 * Ai_24) return (1); return (0); } // 7CEDCE18CA3510CF865D088D81449584 int f0_7() { int Li_0; int Li_4; int Li_8; bool Li_12; int Li_16; int Lia_20[16]; int Lia_24[100]; string str_concat_28; int str2time_36; double Ld_40; int Lia_48[4]; string Ls_52; string Ls_60; double Ld_68 = -100; if (Gi_484 == TRUE) return (0); Gd_488 = NormalizeDouble(ManualGMT_Offset, 1); while (Ld_68 < -12.0 || Ld_68 > 13.0 && Li_0 < 10) { Li_4 = 9; Li_12 = FALSE; Li_16 = 0; int Lia_76[5] = {218103810}; int Lia_80[8] = {317991872, 1694802820, 895544384, 487523969, 1711580036, 747408000, 1728357252, 1901185231, 470746753}; /*while (Li_8 < Li_4) { if (WSAStartup(514, Lia_24) == 0) { Li_16 = socket(2, 1, 0); if (Li_16 >= 0) { Lia_76[1] = Lia_80[Li_8]; if (connect(Li_16, Lia_76, 20) >= 0) { ArrayInitialize(Lia_20, 0); if (recv(Li_16, Lia_20, 64, 0) >= 0) { str_concat_28 = ""; str2time_36 = 0; for (int index_84 = 0; index_84 < 16; index_84++) { str_concat_28 = StringConcatenate(str_concat_28, CharToStr(Lia_20[index_84] & 255), CharToStr(Lia_20[index_84] >> 8 & 255), CharToStr(Lia_20[index_84] >> 16 & 255), CharToStr(Lia_20[index_84] >> 24 & 255)); } if (StringLen(str_concat_28) > 22) { str2time_36 = StrToTime(StringConcatenate("20", StringSubstr(str_concat_28, 7, 2), ".", StringSubstr(str_concat_28, 10, 2), ".", StringSubstr(str_concat_28, 13, 2), StringSubstr(str_concat_28, 15, 9))); } } } } if (Li_16 > 0) closesocket(Li_16); WSACleanup(); } if (str2time_36 != 0) break; Li_8++; Sleep(500); }*/ if (str2time_36 == 0) { Li_12 = TRUE; GetSystemTime(Lia_48); Ls_52 = Lia_48[0] & 65535; Ls_60 = Lia_48[0] >> 16 + 100; Ls_52 = Ls_52 + "." + StringSubstr(Ls_60, 1); Ls_60 = Lia_48[1] >> 16 + 100; Ls_52 = Ls_52 + "." + StringSubstr(Ls_60, 1); Ls_60 = Lia_48[2] & 65535 + 100; Ls_52 = Ls_52 + " " + StringSubstr(Ls_60, 1); Ls_60 = Lia_48[2] >> 16 + 100; Ls_52 = Ls_52 + ":" + StringSubstr(Ls_60, 1); Ls_60 = Lia_48[3] & 65535 + 100; Ls_52 = Ls_52 + ":" + StringSubstr(Ls_60, 1); str2time_36 = StrToTime(Ls_52); } Ld_40 = TimeCurrent() - str2time_36; Ld_40 /= 3600.0; Ld_68 = NormalizeDouble(Ld_40, 1); Li_0++; } if (Li_0 < 10) Gd_488 = Ld_68; if (Li_12 == TRUE) Print("Can not reach time servers, GMT offset (" + DoubleToStr(Gd_488, 1) + ") was calculated using local Windows settings (may be inaccurate)."); else Print("GMT offset (" + DoubleToStr(Gd_488, 1) + ") was obtained from a time server at " + TimeToStr(TimeLocal())); Gi_484 = TRUE; return (0); }