Navigation:Home > Content >

BTC_FapTurbo2_Premium-EDU.mq4

Time: 2016-04-18 | Download file:BTC_FapTurbo2_Premium-EDU.mq4

/*
   2013-12-12 by Capella at http://worldwide-invest.org/
	- No need for DLL-file from vendor ("Kernel32.dll" is part of Windows OS)
	- Overruled need for authentication 
	- Overruled broker company restrictions
	- Fixed bugs that caused compilation errors and warnings
	- Added alternative automatic GMT offset using local computer system time
*/
#property copyright "Copyright © BTC FAPTv2.0 Premium for Bitcoin"
#property link      "http://fapturbo2.com"

#import "Kernel32.dll"
   void GetSystemTime(int& a0[]);
#import

/*
#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

extern string EMail = "";
extern string ClickbankReceipt = "";
*/

extern string Copyrights = "FapTurbo2.com Premium Robot for Bitcoin";
int Gi_100 = 2;
int Gi_104 = 0;
int Gi_108 = 5;
int Gia_112[9] = {0, 1, 5, 15, 30, 60, 240, 10080, 43200};
int Gi_116 = 1;
int G_timeframe_120 = PERIOD_M1;
int Gi_124 = 1;
int G_datetime_128 = 0;
bool Gi_132;
bool Gi_136;
int G_datetime_140 = 0;
int G_datetime_144 = 0;
int Gi_148 = 0;
string Gs_152;
string Gs_160;
string Gs_168;
int Gi_unused_176 = -3;
int Gi_unused_180 = 3;
int G_digits_184 = 3;
int Gi_188 = 0;
string Gsa_192[2] = {"Scalper", "Medium-Term Trader"};
extern bool UseMediumTermStrategy = TRUE;
extern bool StealthMode = TRUE;
extern bool UseAutoGMToffset = TRUE;
extern int ManualGMToffset = 2;
bool Gi_unused_212 = FALSE;
string Gs_unused_216 = "BTCUSD_Ask";
extern string __MediumTermStrategy__ = "==== MTS on BTC/USD, H1 or higher ====";
extern double MTS_Lots = 0.01;
extern bool MTS_UseMM = FALSE;
extern double MTS_LotsRiskReductor = 5.0;
extern double MTS_MaxLots = 10.0;
extern string _MTS_Trade_Time_Options___;
extern int MTS_StartWorkTimeHour = 1;
extern int MTS_StartSessionMinute = 0;
extern int MTS_EndWorkTimeHour = 22;
extern int MTS_EndSessionMinute = 30;
extern bool MTS_TradeMonday = TRUE;
extern bool MTS_TradeFriday = TRUE;
extern bool MTS_TradeWeekend = TRUE;
extern int MTS_ForceCloseAtEOS = 2;
extern int MTS_AvoidDaysBefore = 0;
extern int MTS_AvoidDaysAfter = 0;
extern string _MTS_Trade_Settings___;
extern bool MTS_ReverseTrade = TRUE;
extern int MTS_TakeProfit = 35;
extern int MTS_StopLoss = 90;
int Gi_unused_328 = 2;
extern bool MTS_AddSpreadToTP = FALSE;
extern double MTS_ProfitLimit = 0.0;
extern double MTS_LossLimit = 0.0;
string Gs_unused_352 = "---------- main Indi params ----------";
int G_timeframe_360 = PERIOD_H4;
int Gi_364 = 6;
int G_period_368 = 30;
int Gi_372 = 0;
int Gi_376 = 15;
int Gi_380 = 55;
int Gi_384 = 1;
int G_period_388 = 25;
int Gi_392 = 1;
int Gi_396 = 25;
int Gi_400 = 75;
int G_timeframe_404 = PERIOD_M1;
int Gi_408 = 1;
int G_period_412 = 20;
int Gi_416 = 1;
int Gi_420 = 40;
extern string remMTSTF = "---------- Filters ----------";
string Gs_dummy_432;
extern bool MTS_UseCustomLevels = FALSE;
extern bool MTS_SimpleHeightFilter = FALSE;
extern int MTS_MaxBarHeight = 10;
int Gi_452 = 720;
int Gi_456 = 0;
int Gi_460 = 720;
int Gi_464 = 0;
int Gi_468 = 1440;
int Gi_472 = 2;
int Gi_476 = 2880;
int Gi_480 = 5;
int Gi_484 = 5760;
int Gi_488 = 5;
extern bool MTS_TrendFilter = TRUE;
extern int MTS_TF_MA_Period = 5;
int G_applied_price_500 = PRICE_CLOSE;
int G_ma_method_504 = MODE_SMA;
extern double MTS_TFMaxPercentMove = 11.5;
string Gs_dummy_516;
extern bool MTS_UseFilterMA = FALSE;
extern int MTS_TFNumFilterMA = 3;
int G_timeframe_532 = PERIOD_M15;
extern int MTS_PeriodFilterMA = 100;
int G_applied_price_540 = PRICE_CLOSE;
int G_ma_method_544 = MODE_SMA;
extern string remMTSOTP = "---------- Other trade params ----------";
extern int MTS_RelaxHours = 0;
extern int MTS_OneTrade = 1;
extern bool MTS_OneOpenTrade = FALSE;
string Gs_dummy_568;
extern double MTS_MaxSpread = 1.0;
extern double MTS_Slippage = 0.1;
int Gi_592 = 30;
extern string MTS_ExpertComment = "BTCPrem2MTS";
extern int MTS_MagicNumber = 20131101;
extern string _____Scalper_____ = "======= Scalper for BTCUSD, M1 =======";
extern double Scalper_Lots = 0.01;
extern bool Scalper_UseMM = FALSE;
extern double Scalper_LotsRiskReductor = 2.0;
extern double Scalper_MaxLots = 100.0;
extern string ___Trade_Time_Options____;
extern int Scalper_StartWorkTimeHour = 5;
extern int Scalper_StartSessionMinute = 0;
extern int Scalper_EndWorkTimeHour = 17;
extern int Scalper_EndSessionMinute = 0;
extern bool Scalper_TradeMonday = TRUE;
extern bool Scalper_TradeFriday = FALSE;
extern bool Scalper_TradeWeekend = FALSE;
extern int Scalper_ForceCloseAtEOS = 1;
extern int Scalper_AvoidDaysBefore = 0;
extern int Scalper_AvoidDaysAfter = 0;
extern string ___Trade_Settings____;
extern bool Scalper_ReverseTrade = FALSE;
extern int Scalper_TakeProfit = 9;
extern int Scalper_StopLoss = 8;
extern bool Scalper_AddSpreadToTP = TRUE;
double Gd_716;
extern double Scalper_ProfitLimit = 0.0;
extern double Scalper_LossLimit = 0.0;
string Gs_unused_740 = "---------- main Indi params ----------";
int G_timeframe_748 = PERIOD_M5;
int Gi_752 = 2;
int G_period_756 = 70;
int Gi_760 = 0;
int Gi_764 = 35;
int Gi_768 = 65;
int G_timeframe_772 = PERIOD_M1;
int Gi_776 = 1;
int G_period_780 = 80;
int Gi_784 = 1;
int Gi_788 = 25;
int Gi_792 = 85;
int G_timeframe_796 = PERIOD_H1;
int Gi_800 = 5;
int G_period_804 = 50;
int Gi_808 = 0;
int Gi_812 = 100;
extern string remTF = "---------- Scalper Filters ----------";
string Gs_dummy_824;
extern bool Scalper_UseCustomLevels = FALSE;
extern bool Scalper_SimpleHeightFilter = FALSE;
extern int Scalper_MaxBarHeight = 6;
int Gi_844 = 60;
int Gi_848 = 0;
int Gi_852 = 90;
int Gi_856 = 0;
int Gi_860 = 120;
int Gi_864 = 0;
int Gi_868 = 150;
int Gi_872 = 0;
int Gi_876 = 180;
int Gi_880 = 0;
extern bool Scalper_TrendFilter = TRUE;
extern int Scalper_TF_MA_Period = 40;
int G_applied_price_892 = PRICE_CLOSE;
int G_ma_method_896 = MODE_SMA;
extern double Scalper_TFMaxPercentMove = 8.0;
double Gd_908 = -100.0;
string Gs_dummy_916;
extern bool Scalper_UseFilterMA = FALSE;
extern int Scalper_TFNumFilterMA = 3;
int G_timeframe_932 = PERIOD_M15;
extern int Scalper_PeriodFilterMA = 100;
int G_applied_price_940 = PRICE_CLOSE;
int G_ma_method_944 = MODE_SMA;
extern string remOTP = "---------- Other Scalper trade params ----------";
extern int Scalper_RelaxHours = 0;
extern int Scalper_OneTrade = 1;
extern bool Scalper_OneOpenTrade = FALSE;
string Gs_dummy_968;
extern double Scalper_MaxSpread = 1.0;
extern int Scalper_Slippage = 0;
int Gi_988 = 15;
extern string Scalper_ExpertComment = "BTCPrem2Sclp";
extern int Scalper_MagicNumber = 20131115;
string Gs_unused_1004 = "-------------- NEWS ----------------";
bool Gi_1012 = FALSE;
int Gi_1016 = 60;
int Gi_1020 = 30;
int Gi_1024 = 0;
int Gi_1028 = 20;
int Gi_1032 = 20;
bool Gi_1036 = FALSE;
color G_color_1040 = Gray;
int Gi_1044 = 0;
string Gs_1048 = "";
int Gi_1056 = 0;
string Gs_1060 = "";
int Gi_1068 = 0;
string Gs_1072 = "";
int Gi_1080 = 0;
string Gs_1084 = "";
int Gi_1092 = 0;
string Gs_1096 = "";
int Gi_1104 = 0;
string Gs_1108 = "";
int Gi_1116 = 0;
string Gs_1120 = "";
int Gi_1128 = 0;
string Gs_1132 = "";
int Gi_1140 = 0;
string Gs_1144 = "";
int Gi_1152 = 0;
string Gs_1156 = "";
string Gs_unused_1164 = "-------------------------------------";
bool Gi_1172 = TRUE;
int Gi_1176 = D'30.03.2008 03:00';
int Gi_1180 = D'26.10.2008 03:00';
int Gi_1184 = D'29.03.2009 03:00';
int Gi_1188 = D'25.10.2009 03:00';
int Gi_1192 = D'28.03.2010 03:00';
int Gi_1196 = D'31.10.2010 03:00';
int Gi_1200 = D'27.03.2011 03:00';
int Gi_1204 = D'30.10.2011 03:00';
int Gi_1208 = D'25.03.2012 03:00';
int Gi_1212 = D'28.10.2012 03:00';
int Gi_1216 = D'31.03.2013 03:00';
int Gi_1220 = D'27.10.2013 03:00';
int Gi_1224 = D'30.03.2013 03:00';
int Gi_1228 = D'26.10.2013 03:00';
int Gi_1232 = D'29.03.2013 03:00';
int Gi_1236 = D'25.10.2013 03:00';
int Gi_1240 = D'01.01.2013 01:00';
extern string ___Other_Parameters___ = "-----------------------------------------";
extern bool TradeMicroLots = FALSE;
extern bool SendEmail = FALSE;
extern bool SoundAlert = FALSE;
extern string SoundFileAtOpen = "alert.wav";
extern string SoundFileAtClose = "alert.wav";
extern color ColorBuy = Blue;
extern color ColorSell = Red;
extern bool WriteLog = TRUE;
extern bool WriteDebugLog = FALSE;
extern bool PrintLogOnChart = TRUE;
bool Gi_1300 = FALSE;
int Gi_1308 = 10;
int Gi_1312 = 4;
int Gi_1316 = 3;
bool Gi_1320 = TRUE;
bool Gi_1324 = TRUE;
int Gi_1328 = 50;
int Gi_1332 = 50;
int Gi_1336 = 50;
int Gi_1340 = 50;
bool Gi_1344 = FALSE;
int Gi_1348 = 0;
string Gs_1352 = "http://fapturbo2.com/gmt.php";
string Gs_1360 = "AlexGmtOffset 1.0";
int Gi_1368 = -1;
int Gi_1372 = 1;
int Gi_1376 = 1;
bool Gi_1380;
bool G_bool_1388;
int Gi_1392;
int G_magic_1396;
int G_digits_1400;
int G_acc_number_1412;
int Gi_1432 = 2;
int Gi_1436 = 1;
int G_slippage_1440;
double G_point_1444;
double Gd_1452;
double Gd_1460;
double G_lotstep_1468;
double Gd_1476;
double Gd_1484;
string Gs_1492;
string Gs_1500 = "New Trade Information";
string Gs_1508 = "New Trade Information";
string Gs_1516 = "Новая торговая информация";
string Gs_1524 = "Новая торговая информация";
bool Gi_1532;
bool Gi_1536 = TRUE;
bool Gi_1540 = TRUE;
int Gi_1544;
int G_datetime_1548;
int G_datetime_1552;
int Gi_1556;
int Gi_1560;
int Gi_1564;
int Gi_1568;
int Gi_1572;
int Gi_1576;
int Gi_1580;
int Gi_1584;
int Gi_1588;
int Gi_1592;
int Gi_1596;
int Gi_1600;
int Gi_1604;
int Gi_1608;
int Gi_1612;
int Gi_1616;
int Gi_1620;
int Gi_1624;
int Gi_1628;
int Gi_1632;
int Gi_1636;
double Gd_1640;
double Gd_1648;
double Gd_1656;
double Gd_1664;
double Gd_1672;
double Gd_1680;
double Gd_1688;
double Gd_1696;
double Gd_1704;
double Gd_1712;
double Gd_1720;
string G_str_concat_1728;
int Gi_1736;
int Gi_1740;
int Gi_1744;
int Gia_1748[10];
string Gsa_1752[10];
bool Gi_1756;
int Gi_1760;
double G_price_1764 = 0.0;
double G_price_1772 = 0.0;
double G_price_1780 = 0.0;
double G_price_1788 = 0.0;
int Gia_1796[8];
int Gia_1800[8];
int Gi_1804 = 0;
string Gs_1808;
string Gsa_1816[7] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
double Gd_1820;
double Gd_1828;
int Gi_1836;
double Gda_1840[8] = {0};
string Gs_1844 = "";
int Gi_1852 = 0;
bool Gi_1856 = FALSE;
int Gi_1860 = 0;
bool Gi_1864 = FALSE;
bool Gba_1868[7];
int Gi_1872;
int Gi_1876;
int Gi_1880 = 60;
string Gs_1884;
string Gs_1892 = "";
string Gs_1904 = "";
string Gsa_1912[2] = {"false", "true"};
string Gs_1916;
int Gi_1924;
int Gi_1928;
int Gi_1932;
int G_datetime_1936;
int G_month_1940;
bool Gi_1944 = FALSE;
bool Gi_1948 = TRUE;
string gs_548 = "";

// E37F0136AA3FFAF149B351F6A4C948E9
int init() {
   string Ls_8;
   string Ls_24;
   string Ls_32;
   string Ls_44;
   Gi_1380 = TRUE;
   if (IsTesting() || IsOptimization() && (!IsVisualMode())) PrintLogOnChart = FALSE;
   if (!PrintLogOnChart) Comment("");
   string Ls_0 = "\nBTC FapTurbo2 Premium advisory: this robot comes pre-installed on this broker\'s MT4 but to complete your installation of this robot, you must\n" +
      "activate this live account# (if you haven\'t yet) on the License Management page in FAPT2 Members Area at http://fapturbo2.com/members\n" + "If you face any issues with setting up any of our FAPT2 Premium robots, please contact us at [email protected]";
   Comment(Ls_0);
   if (!IsDllsAllowed()) {
      if (Gi_1348 == 0) Comment("Warning: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors.");
      else Comment("Предупреждение: Установите параметер \"AllowDLL Imports\" ВКЛ в меню Сервис -> Настройки -> Советники.");
      Gi_1372 = 0;
      return (0);
   }
   Gi_1372 = 1;
   if (Gi_1372 < 0) Comment("Логическая переменная меньше нуля.");
   Gs_1492 = Symbol();
   if (WriteDebugLog) Print("Broker => " + AccountCompany() + " | " + AccountServer());
/*	
   if (AccountCompany() != "FX Choice Limited" && AccountCompany() != "Tallinex Ou") 
	{
      Ls_8 = "BTC FAPT2 Premium will run ONLY on MyFxChoice OR Tallinex. You cannot use this version on any other broker!";
      if (PrintLogOnChart) {
         Comment("\n" 
         + Ls_8);
      } else Print(Ls_8);
      Gi_1372 = 0;
      return (0);
   }
*/	
   Gi_1944 = FALSE;
/*	
   if (AccountCompany() == "Tallinex Ou") 
	{
      Gi_1944 = TRUE;
      MTS_ExpertComment = MTS_ExpertComment + "\t";
      Scalper_ExpertComment = Scalper_ExpertComment + "\t";
   }
*/	
   if (IsDemo()) Gs_1884 = "Demo";
   else Gs_1884 = "Live";
   Gs_1916 = StringSubstr(Gs_1492, 0, 6);
   string Ls_16 = "M1";
   if (UseMediumTermStrategy) Ls_16 = "preferably H1 or higher";
   if (Gs_1916 != "BTCUSD" && Gs_1916 != "BITCOI") {
      if (Gi_1348 == 0) {
         Ls_24 = "Error: Wrong Currency Pair! Run this BTC FAPT2 Premium version on BITCOIN (BTC/USD), " + Ls_16 + " only";
         Alert(Ls_24);
         Print(Ls_24);
         Comment(Ls_24 
         + "\nRead robot manual for instructions!");
      } else {
         Ls_24 = "Error: Используйте BTC FAPT2 Premium систему только на BITCOIN (BTC/USD), " + Ls_16 + " only";
         Alert(Ls_24);
         Print(Ls_24);
         Comment(Ls_24 
         + "\nОшибка: Неверная валютная пара! Читайте инструкции!");
      }
      Gi_1372 = 0;
      return (0);
   }
   Gi_1372 = 1;
   f0_19();
/*	
   if (Gi_1852 != 1) 
	{
      if (Gi_1852 == -6 || Gi_1852 == -4) Print("This Account# " + AccountNumber() + " is " + Gs_1884);
      if (Gi_1300) Ls_32 = "AuthError(" + Gi_1852 + ") ";
      Print(Ls_32 + Gs_1844);
      Comment("\nBTC FapTurbo2 error: " + Gs_1844);
      Gi_1372 = 0;
      return (0);
   }
*/	
   Gi_1372 = 1;
   if (Gi_1880 > 300) Gi_1880 = 300;
   if (Gi_1880 < 1) Gi_1880 = 1;
   Gi_1856 = FALSE;
   Gi_1860 = TimeCurrent() + 60 * Gi_1880;
   if (Gi_1300) {
      Print("Init: AuthTime=" + TimeToStr(Gi_1860) + ", Result=" + Gi_1852 + ", AuthComment=" + Gs_1844);
      for (int Li_40 = 6; Li_40 >= 0; Li_40--) Print(Gsa_1816[Li_40] + "=" + Gba_1868[Li_40]);
      Print("AllowedDays WeekStart=" + TimeToStr(Gi_1872) + ", WeekEnd=" + TimeToStr(Gi_1876));
   }
   G_point_1444 = Point;
   G_digits_1400 = Digits;
   G_digits_184 = G_digits_1400;
   if (G_digits_1400 == 0) Comment("Неверное значение переменной.");
   Gd_1452 = MarketInfo(Gs_1492, MODE_MAXLOT);
   Gd_1460 = MarketInfo(Gs_1492, MODE_MINLOT);
   G_lotstep_1468 = MarketInfo(Gs_1492, MODE_LOTSTEP);
   Gd_1476 = MarketInfo(Gs_1492, MODE_MARGINREQUIRED) * G_lotstep_1468;
   if (TradeMicroLots) Gi_1392 = 2;
   else Gi_1392 = 1;
   if (UseMediumTermStrategy) {
      Scalper_Lots = MTS_Lots * MathPow(10.0, Gi_188);
      Scalper_MaxLots = MTS_MaxLots * MathPow(10.0, Gi_188);
      Scalper_StartWorkTimeHour = MTS_StartWorkTimeHour;
      Scalper_StartSessionMinute = MTS_StartSessionMinute;
      Scalper_EndWorkTimeHour = MTS_EndWorkTimeHour;
      Scalper_EndSessionMinute = MTS_EndSessionMinute;
      Scalper_TradeMonday = MTS_TradeMonday;
      Scalper_TradeFriday = MTS_TradeFriday;
      Scalper_TradeWeekend = MTS_TradeWeekend;
      Scalper_ForceCloseAtEOS = MTS_ForceCloseAtEOS;
      Scalper_AvoidDaysBefore = MTS_AvoidDaysBefore;
      Scalper_AvoidDaysAfter = MTS_AvoidDaysAfter;
      Scalper_ReverseTrade = MTS_ReverseTrade;
      Scalper_AddSpreadToTP = MTS_AddSpreadToTP;
      Gi_1564 = MTS_TakeProfit * MathPow(10.0, G_digits_184);
      Gi_1568 = MTS_StopLoss * MathPow(10.0, G_digits_184);
      Scalper_ProfitLimit = MTS_ProfitLimit;
      Scalper_LossLimit = MTS_LossLimit;
      G_timeframe_748 = G_timeframe_360;
      Gi_752 = Gi_364;
      G_period_756 = G_period_368;
      Gi_760 = Gi_372;
      Gi_764 = Gi_376;
      Gi_768 = Gi_380;
      Gi_776 = Gi_384;
      G_period_780 = G_period_388;
      Gi_784 = Gi_392;
      Gi_788 = Gi_396;
      Gi_792 = Gi_400;
      G_timeframe_796 = G_timeframe_404;
      Gi_800 = Gi_408;
      G_period_804 = G_period_412;
      Gi_808 = Gi_416;
      Gi_812 = Gi_420;
      Scalper_UseCustomLevels = MTS_UseCustomLevels;
      Scalper_SimpleHeightFilter = MTS_SimpleHeightFilter;
      Scalper_MaxBarHeight = MTS_MaxBarHeight * MathPow(10.0, G_digits_184);
      Gi_1572 = Gi_452;
      Gi_1580 = Gi_1572 + Gi_460;
      Gi_1588 = Gi_1580 + Gi_468;
      Gi_1596 = Gi_1588 + Gi_476;
      Gi_1604 = Gi_1596 + Gi_484;
      Gi_1576 = Gi_456 * MathPow(10.0, G_digits_184);
      Gi_1584 = Gi_464 * MathPow(10.0, G_digits_184);
      Gi_1592 = Gi_472 * MathPow(10.0, G_digits_184);
      Gi_1600 = Gi_480 * MathPow(10.0, G_digits_184);
      Gi_1608 = Gi_488 * MathPow(10.0, G_digits_184);
      Scalper_TrendFilter = MTS_TrendFilter;
      Scalper_TF_MA_Period = MTS_TF_MA_Period;
      G_applied_price_892 = G_applied_price_500;
      G_ma_method_896 = G_ma_method_504;
      Scalper_TFMaxPercentMove = MTS_TFMaxPercentMove;
      Scalper_UseFilterMA = MTS_UseFilterMA;
      Scalper_TFNumFilterMA = MTS_TFNumFilterMA;
      G_timeframe_932 = G_timeframe_532;
      Scalper_PeriodFilterMA = MTS_PeriodFilterMA;
      G_applied_price_940 = G_applied_price_540;
      G_ma_method_944 = G_ma_method_544;
      Scalper_RelaxHours = MTS_RelaxHours;
      Scalper_OneTrade = MTS_OneTrade;
      Scalper_OneOpenTrade = MTS_OneOpenTrade;
      Scalper_MaxSpread = MTS_MaxSpread * MathPow(10.0, G_digits_184);
      Scalper_Slippage = MTS_Slippage * MathPow(10.0, G_digits_184);
      Gi_988 = Gi_592;
      Scalper_ExpertComment = MTS_ExpertComment;
      Scalper_MagicNumber = MTS_MagicNumber;
   } else {
      Scalper_Lots *= MathPow(10.0, Gi_188);
      Scalper_MaxLots *= MathPow(10.0, Gi_188);
      Gi_1564 = Scalper_TakeProfit * MathPow(10.0, G_digits_184);
      Gi_1568 = Scalper_StopLoss * MathPow(10.0, G_digits_184);
      Scalper_MaxBarHeight = Scalper_MaxBarHeight * MathPow(10.0, G_digits_184);
      Gi_1572 = Gi_844;
      Gi_1580 = Gi_1572 + Gi_852;
      Gi_1588 = Gi_1580 + Gi_860;
      Gi_1596 = Gi_1588 + Gi_868;
      Gi_1604 = Gi_1596 + Gi_876;
      Gi_1576 = Gi_848 * MathPow(10.0, G_digits_184);
      Gi_1584 = Gi_856 * MathPow(10.0, G_digits_184);
      Gi_1592 = Gi_864 * MathPow(10.0, G_digits_184);
      Gi_1600 = Gi_872 * MathPow(10.0, G_digits_184);
      Gi_1608 = Gi_880 * MathPow(10.0, G_digits_184);
      Scalper_MaxSpread *= MathPow(10.0, G_digits_184);
      Scalper_Slippage = Scalper_Slippage * MathPow(10.0, G_digits_184);
   }
   if (Scalper_AvoidDaysBefore < 0 || Scalper_AvoidDaysBefore > 31 || Scalper_AvoidDaysAfter < 0 || Scalper_AvoidDaysAfter > 31) {
      if (Scalper_AvoidDaysBefore < 0 || Scalper_AvoidDaysBefore > 31) Ls_44 = "Scalper_AvoidDaysBefore";
      else
         if (Scalper_AvoidDaysAfter < 0 || Scalper_AvoidDaysAfter > 31) Ls_44 = "Scalper_AvoidDaysAfter";
      Ls_24 = Ls_44 + " should be a valid integer from 0 to 31!";
      Alert(Ls_24);
      Print(Ls_24);
      Gi_1372 = 0;
      return (0);
   }
   Gd_1648 = NormalizeDouble((-1 * Gi_1568) * G_point_1444, G_digits_1400);
   Gd_1640 = NormalizeDouble(Gi_1564 * G_point_1444, G_digits_1400);
   Gi_1612 = 60 * Gi_1572;
   Gi_1616 = 60 * Gi_1580;
   Gi_1620 = 60 * Gi_1588;
   Gi_1624 = 60 * Gi_1596;
   Gi_1628 = 60 * Gi_1604;
   Gd_1656 = Gi_1576 * G_point_1444;
   Gd_1664 = Gi_1584 * G_point_1444;
   Gd_1672 = Gi_1592 * G_point_1444;
   Gd_1680 = Gi_1600 * G_point_1444;
   Gd_1688 = Gi_1608 * G_point_1444;
   Gd_1720 = NormalizeDouble(Scalper_MaxBarHeight * G_point_1444, G_digits_1400);
   Gd_1696 = NormalizeDouble(Scalper_MaxSpread * G_point_1444, G_digits_1400);
   Gd_1704 = NormalizeDouble(Gi_1568 * G_point_1444, G_digits_1400);
   Gd_1712 = NormalizeDouble(Gd_1704 / 2.0, G_digits_1400);
   if (Gi_752 >= 0 && Gi_752 <= 8) G_timeframe_748 = Gia_112[Gi_752];
   if (Gi_776 >= 0 && Gi_776 <= 8) G_timeframe_772 = Gia_112[Gi_776];
   if (Gi_800 >= 0 && Gi_800 <= 8) G_timeframe_796 = Gia_112[Gi_800];
   if (Gi_768 <= 0 || Gi_768 >= 100) Gi_768 = 100 - Gi_764;
   if (Gi_792 <= 0 || Gi_792 >= 100) Gi_792 = 100 - Gi_788;
   Gi_1556 = Gi_812 / 2 + 50;
   Gi_1560 = 50 - Gi_812 / 2;
   if (Scalper_TFNumFilterMA >= 0 && Scalper_TFNumFilterMA <= 8) G_timeframe_932 = Gia_112[Scalper_TFNumFilterMA];
   if (Scalper_PeriodFilterMA <= 0) Scalper_UseFilterMA = FALSE;
   if (G_applied_price_940 < PRICE_CLOSE || G_applied_price_940 > PRICE_WEIGHTED) Scalper_UseFilterMA = FALSE;
   if (G_ma_method_944 < MODE_SMA || G_ma_method_944 > MODE_LWMA) Scalper_UseFilterMA = FALSE;
   double leverage_52 = AccountLeverage();
   Gd_1484 = NormalizeDouble(Scalper_LotsRiskReductor * (100 / leverage_52), 2);
   G_magic_1396 = Scalper_MagicNumber;
   G_slippage_1440 = Scalper_Slippage * MathPow(10, Digits - G_digits_1400);
   Gi_1836 = Scalper_EndSessionMinute;
   Gi_1864 = FALSE;
   G_datetime_140 = iTime(NULL, PERIOD_D1, 0);
   G_datetime_144 = TimeCurrent();
   int Li_60 = (G_datetime_144 - G_datetime_140) / Gi_108;
   Gi_148 = G_datetime_140 + Gi_108 * Li_60;
   if (Gi_116 >= 0 && Gi_116 <= 8) G_timeframe_120 = Gia_112[Gi_116];
   if (PrintLogOnChart) Comment("BTC FAPTv2.0 Premium initializing...");
   if (WriteDebugLog) Print("BTC FAPTv2.0 Premium initializing...");
   G_datetime_1936 = TimeCurrent();
   return (0);
}
	 		 		  	 		 		    	 		 	  		  	    		  	 		     	 				 		    			   	 	 	   	   		 		 	    	 	  	  	 	 				 		 	 	    	  		      		  		    	   	
// 52D46093050F38C27267BCE42543EF60
int deinit() {
   if (Gi_1036) {
      ObjectDelete("info_str0");
      ObjectDelete("info_str1");
   }
   return (0);
}
				  	    					 	  				    	   		    	    			   		 	 		  	  	 		      	          	 	  	 	  			     			 	 		  	 			  	 	 			 	   			 			 	  		  	
// EA2B2676C28C0DB26D39331A336C6B92
int start() {
   int Li_12;
   int Li_16;
   Gi_1924++;
   int datetime_0 = TimeCurrent();
   int Li_4 = datetime_0 - G_datetime_1936;
   G_datetime_1936 = datetime_0;
   Gi_132 = FALSE;
   int datetime_8 = iTime(NULL, G_timeframe_120, 0);
   if (G_datetime_128 != datetime_8) {
      Gi_1932++;
      Gs_160 = "";
      G_datetime_128 = datetime_8;
      Gi_132 = TRUE;
   }
   Gi_136 = FALSE;
   if (Gi_104 > 0 && TimeCurrent() >= Gi_148) {
      Gi_1928++;
      Gi_136 = TRUE;
      Li_12 = (TimeCurrent() - G_datetime_140) / Gi_108;
      Gi_148 = G_datetime_140 + Gi_108 * (Li_12 + 1);
   }
   Gs_152 = Gs_160 + Gs_168;
   if (Gi_136) G_datetime_144 = TimeCurrent();
   if (Gi_1380) {
      if (UseAutoGMToffset) {
         if (!IsTesting()) {
//            ManualGMToffset = f0_14();
					ManualGMToffset = GMTOffset();    // Added
            if (ManualGMToffset <= -2147483647) {
               Sleep(60000);
               return (0);
            }
         } else {
            Comment("Warning, use manual GMToffsets only on backtest.", 
               "\n", "Automatic GMT offset calculation works only on live/demo trading", 
            "\n", "and should be set as FALSE for backtests - strategy testing.");
            Alert("Warning, use manual GMToffsets only on backtest.", 
               "\n", "Automatic GMT offset calculation works only on live/demo trading", 
            "\n", "and should be set as FALSE for backtests - strategy testing.");
            if (WriteLog) Print("Warning, use manual GMToffsets only on backtest! Set UseAutoGMToffset = False.");
            Gi_1372 = 0;
         }
         Gs_1808 = " (automatic)";
      } else Gs_1808 = " (manual)";
      G_str_concat_1728 = StringConcatenate("Gmt Offset : ", DoubleToStr(ManualGMToffset, 1), Gs_1808, 
      "\n");
      Gi_1632 = Scalper_StartWorkTimeHour + ManualGMToffset;
      Gi_1636 = Scalper_EndWorkTimeHour + ManualGMToffset;
      Gd_1820 = Gi_1632 + Scalper_StartSessionMinute / 100.0;
      Gd_1828 = Gi_1636 + Scalper_EndSessionMinute / 100.0;
      while (true) {
         if (Gi_1632 >= 24) Gi_1632 -= 24;
         else {
            if (Gi_1632 >= 0) break;
            Gi_1632 += 24;
         }
      }
      while (true) {
         if (Gi_1636 >= 24) Gi_1636 -= 24;
         else {
            if (Gi_1636 >= 0) break;
            Gi_1636 += 24;
         }
      }
      if (Scalper_StartSessionMinute < 0 || Scalper_StartSessionMinute > 59) Scalper_StartSessionMinute = 0;
      if (Scalper_EndSessionMinute < 0 || Scalper_EndSessionMinute > 59) Scalper_EndSessionMinute = 0;
      if (Gi_1632 != Gi_1636 || Scalper_StartSessionMinute != Scalper_EndSessionMinute) {
         if (Gi_1308 > 0) {
            Scalper_EndSessionMinute -= Gi_1308;
            if (Scalper_EndSessionMinute < 0) {
               Scalper_EndSessionMinute += 60;
               Gi_1636--;
               if (Gi_1636 < 0) Gi_1636 += 24;
            }
         }
      }
      if (Gi_1012) {
         Gia_1748[0] = Gi_1044 + 3600 * ManualGMToffset;
         Gia_1748[1] = Gi_1056 + 3600 * ManualGMToffset;
         Gia_1748[2] = Gi_1068 + 3600 * ManualGMToffset;
         Gia_1748[3] = Gi_1080 + 3600 * ManualGMToffset;
         Gia_1748[4] = Gi_1092 + 3600 * ManualGMToffset;
         Gia_1748[5] = Gi_1104 + 3600 * ManualGMToffset;
         Gia_1748[6] = Gi_1116 + 3600 * ManualGMToffset;
         Gia_1748[7] = Gi_1128 + 3600 * ManualGMToffset;
         Gia_1748[8] = Gi_1140 + 3600 * ManualGMToffset;
         Gia_1748[9] = Gi_1152 + 3600 * ManualGMToffset;
         Gsa_1752[0] = Gs_1048;
         Gsa_1752[1] = Gs_1060;
         Gsa_1752[2] = Gs_1072;
         Gsa_1752[3] = Gs_1084;
         Gsa_1752[4] = Gs_1096;
         Gsa_1752[5] = Gs_1108;
         Gsa_1752[6] = Gs_1120;
         Gsa_1752[7] = Gs_1132;
         Gsa_1752[8] = Gs_1144;
         Gsa_1752[9] = Gs_1156;
         if (Gi_1036) {
            f0_1("info_str0", 10, 10, G_color_1040);
            f0_1("info_str1", 10, 25, G_color_1040);
         }
         Gi_1736 = 60 * Gi_1016;
         Gi_1740 = 60 * Gi_1020;
         Gi_1744 = 60 * Gi_1024;
      }
      if (Gi_1172) {
         Gia_1796[0] = Gi_1176 + 3600 * ManualGMToffset;
         Gia_1796[1] = Gi_1184 + 3600 * ManualGMToffset;
         Gia_1796[2] = Gi_1192 + 3600 * ManualGMToffset;
         Gia_1796[3] = Gi_1200 + 3600 * ManualGMToffset;
         Gia_1796[4] = Gi_1208 + 3600 * ManualGMToffset;
         Gia_1796[5] = Gi_1216 + 3600 * ManualGMToffset;
         Gia_1796[6] = Gi_1224 + 3600 * ManualGMToffset;
         Gia_1796[7] = Gi_1232 + 3600 * ManualGMToffset;
         Gia_1800[0] = Gi_1180 + 3600 * ManualGMToffset;
         Gia_1800[1] = Gi_1188 + 3600 * ManualGMToffset;
         Gia_1800[2] = Gi_1196 + 3600 * ManualGMToffset;
         Gia_1800[3] = Gi_1204 + 3600 * ManualGMToffset;
         Gia_1800[4] = Gi_1212 + 3600 * ManualGMToffset;
         Gia_1800[5] = Gi_1220 + 3600 * ManualGMToffset;
         Gia_1800[6] = Gi_1228 + 3600 * ManualGMToffset;
         Gia_1800[7] = Gi_1236 + 3600 * ManualGMToffset;
      }
      if (!(IsTesting() || IsOptimization()) && StringLen(AccountName()) <= 0) {
         if (Gi_1348 == 0) {
            Comment("BTC FapTurbo2 EA needs to have an online Terminal.");
            if (Gi_1948) Alert("BTC FapTurbo2 EA needs to have an online Terminal: Connected=" + IsConnected() + ", AccountName=" + AccountName() + " & Account#=" + AccountNumber());
            if (WriteLog) Print("BTC FapTurbo2 EA need have on-line Terminal.");
         } else {
            Comment("Советнику BTC FapTurbo2 нужно, чтобы Терминал был on-line.");
            if (Gi_1948) Alert("Советнику BTC FapTurbo2 нужно, чтобы Терминал был on-line.");
            if (WriteLog) Print("Советнику BTC FapTurbo2 нужно, чтобы Терминал был on-line.");
         }
         Gi_1948 = FALSE;
         if (!(!(IsTesting() || IsOptimization()))) return (0);
         while (StringLen(AccountName()) <= 0 && !IsConnected()) {
            Sleep(5000);
            RefreshRates();
         }
         return (0);
      }
      G_bool_1388 = IsDemo();
      G_acc_number_1412 = AccountNumber();
      Gi_1380 = FALSE;
   }
   if ((!IsTesting()) && !IsOptimization()) {
      if (Gi_1856 && Gi_1860 < TimeCurrent()) {
         Gi_1856 = FALSE;
         Li_16 = 60 * f0_0(24);
         if (Gi_1864) Li_16 = Gi_1880;
         Gi_1860 = TimeCurrent() + 60 * Li_16;
         if (WriteDebugLog) Print("Next Server check will be @ " + TimeToStr(Gi_1860) + " (broker time)");
      }
      if (!Gi_1856 && TimeCurrent() > Gi_1860) {
         Gi_1856 = TRUE;
         f0_19();
      }
      if (Gi_1852 != 1) {
         Gi_1376 = 0;
         Gi_1372 = 0;
         if (Gi_1348 == 0) Comment("\nBTC FapTurbo2 error: " + Gs_1844);
         else Comment("\nBTC FapTurbo2 ??????: " + Gs_1844);
         return (-1);
      }
      Gi_1376 = 1;
   }
   if (!Gi_1372) return (0);
   if (Gi_1372 < 0) Comment("Привет с большого бодуна.");
/*	
   if (!Gi_1376) 
	{
      if (Gi_1348 == 0) Alert("BTC FapTurbo2: Authentication failed! Your copy is not activated.\n" + Gs_1844);
      else Alert("Ваша копия не активирована. \n" + Gs_1844);
      return (0);
   }
*/	
   if (Gi_1376 < 0) Comment("Хрень какая-то.");
   if (Gi_1012) Gi_1756 = f0_21();
   if (Gi_1172 && IsTesting()) Gi_1804 = f0_5();
   else Gi_1804 = 0;
   f0_2();
   return (0);
}
	  	 	 	 				     	 	    		 					 	  	 	 				 		    		   	    	 			  		  		  			 	  			   	 	  	 		 	  			 	 	 		     	    	  		   	      	 	 			
// 2E04D211E5E011E580FC0663E9A8CA5E
void f0_2() {
   double Ld_28;
   int Li_36;
   string Ls_40;
   int bool_48;
   string Ls_52;
   double Ld_60;
   string Ls_68;
   string Ls_76;
   string Ls_84;
   string Ls_92;
   string str_concat_100;
   int bool_108;
   bool Li_112;
   int month_116;
   string Ls_120;
   bool bool_128;
   int Li_132;
   int Li_136;
   string Ls_140;
   double irsi_148;
   double irsi_156;
   double ima_164;
   int Li_172;
   int Li_176;
   string Ls_unused_180;
   int count_188;
   double ima_192;
   Gi_1544 = TimeCurrent() - Gi_1804;
   int Li_0 = Gi_1544 - 3600 * ManualGMToffset;
   int day_of_week_4 = TimeDayOfWeek(Li_0);
   int day_8 = TimeDay(Li_0);
   double Ld_12 = NormalizeDouble(Ask - Bid, Digits);
   if (Ld_12 < 0.0) Ld_12 = NormalizeDouble(MarketInfo(Gs_1492, MODE_SPREAD) * Point, Digits);
   string str_concat_20 = "";
   if (Scalper_ProfitLimit > 0.0 || Scalper_LossLimit > 0.0) {
      if (Gi_1632 != Gi_1636 || Scalper_StartSessionMinute != Scalper_EndSessionMinute) {
         Ld_28 = f0_7();
         if (Gi_1348 == 0) {
            str_concat_20 = StringConcatenate("Current Profit:            ", DoubleToStr(Ld_28, 2), " ", AccountCurrency(), 
            "\n");
         } else {
            str_concat_20 = StringConcatenate("Текущая прибыль:            ", DoubleToStr(Ld_28, 2), " ", AccountCurrency(), 
            "\n");
         }
         if (Scalper_ProfitLimit > 0.0) {
            if (Gi_1348 == 0) {
               str_concat_20 = StringConcatenate(str_concat_20, "Profit Limit:                ", DoubleToStr(Scalper_ProfitLimit, 2), " ", AccountCurrency(), 
               "\n");
            } else {
               str_concat_20 = StringConcatenate(str_concat_20, "Ограничение прибыли:                ", DoubleToStr(Scalper_ProfitLimit, 2), " ", AccountCurrency(), 
               "\n");
            }
         }
         if (Scalper_LossLimit > 0.0) {
            if (Gi_1348 == 0) {
               str_concat_20 = StringConcatenate(str_concat_20, "Loss Limit:                  ", DoubleToStr(-1.0 * Scalper_LossLimit, 2), " ", AccountCurrency(), 
               "\n");
            } else {
               str_concat_20 = StringConcatenate(str_concat_20, "Ограничение убытка:                  ", DoubleToStr(-1.0 * Scalper_LossLimit, 2), " ", AccountCurrency(), 
               "\n");
            }
         }
      }
   }
   if (PrintLogOnChart) {
      if (!(WriteDebugLog || Gi_1300)) Gs_1904 = "";
      Li_36 = f0_10();
      Ls_40 = "T/P=" + Gi_1564 + " pips, S/L=" + Gi_1568 + " pips\n";
      bool_48 = Scalper_UseMM;
      Ls_52 = "LRR=" + DoubleToStr(Scalper_LotsRiskReductor, 2);
      if (!Scalper_UseMM) Ls_52 = "LotSize=" + DoubleToStr(Scalper_Lots, 2);
      Ld_60 = Ld_12 * MathPow(10, G_digits_1400);
      Ls_68 = "Current Spread: " + DoubleToStr(Ld_60, 0) + " pips, MaxSpread: " + DoubleToStr(Scalper_MaxSpread, 0) + " pips \n";
      G_str_concat_1728 = StringConcatenate("Gmt Offset : ", DoubleToStr(ManualGMToffset + Gi_1804 / 3600, 1), Gs_1808, 
      "\n");
      Ls_76 = "Broker Time: " + TimeToStr(TimeCurrent()) + " " + Gsa_1816[DayOfWeek()];
      if (Gi_1300) Ls_76 = Ls_76 + ", EffCurrent Time=" + TimeToStr(Gi_1544);
      Ls_84 = "GMT  Time : " + TimeToStr(Li_0) + " " + Gsa_1816[day_of_week_4];
      Ls_92 = "Active Time: " + Scalper_StartWorkTimeHour + ":" + f0_3(Scalper_StartSessionMinute) + " to " + Scalper_EndWorkTimeHour + ":" + f0_3(Gi_1836) + " (GMT)";
      if (Gi_1348 == 0) {
         if (Gi_1852 != 1) str_concat_100 = "";
         else {
            str_concat_100 = StringConcatenate("------------------------------------------------\n", "Num of Open trades on " + Gs_1492 + " = " + Li_36 
               + "\n", Ls_40 + "MM=" + Gsa_1912[bool_48] + ", " + Ls_52 
               + "\n" 
               + Ls_68 + str_concat_20 + "------------------------------------------------\n", Ls_76 
               + "\n" 
               + Ls_84 
               + "\n" 
               + G_str_concat_1728 + Ls_92 
               + "\n" 
               + Gs_1904 + "------------------------------------------------\n", "BROKER INFORMATION:\n" + "Broker Company:      " + AccountCompany() 
               + "\n" 
               + "------------------------------------------------\n", "ACCOUNT INFORMATION:\n" + "Account Name:         " + AccountName() 
               + "\n" 
               + "Account Number:      " + AccountNumber() 
               + "\n" 
               + "Account Type:          " + Gs_1884 
               + "\n" 
               + "Account Leverage:     " + DoubleToStr(AccountLeverage(), 0) 
               + "\n" 
               + "Account Balance:       " + DoubleToStr(AccountBalance(), 2) 
               + "\n" 
               + "Account Currency:     " + AccountCurrency() 
               + "\n" 
               + "Account Equity:         " + DoubleToStr(AccountEquity(), 2) 
               + "\n" 
               + "------------------------------------------------\n", "MARGIN INFORMATION:\n" + "Free Margin:            " + DoubleToStr(AccountFreeMargin(), 2) 
               + "\n" 
               + "Used Margin:            " + DoubleToStr(AccountMargin(), 2) 
               + "\n" 
            + "------------------------------------------------\n", "No time limitation");
         }
      } else {
         if (Gi_1852 != 1) str_concat_100 = "";
         else {
            str_concat_100 = StringConcatenate("------------------------------------------------\n", "Num of Open trades on " + Gs_1492 + " = " + Li_36 
               + "\n", Ls_40 + "MM=" + Gsa_1912[bool_48] + ", " + Ls_52 
               + "\n" 
               + Ls_68 + str_concat_20 + "------------------------------------------------\n", Ls_76 
               + "\n" 
               + Ls_84 
               + "\n" 
               + G_str_concat_1728 + Ls_92 
               + "\n" 
               + Gs_1904 + "------------------------------------------------\n", "Информация о брокере:" 
               + "\n" 
               + "Брокерская компания:      " + AccountCompany() 
               + "\n" 
               + "------------------------------------------------\n", "Информация о счёте:" 
               + "\n" 
               + "Название счёта:          " + AccountName() 
               + "\n" 
               + "Номер счёта:       " + AccountNumber() 
               + "\n" 
               + "Account Type:        " + Gs_1884 
               + "\n" 
               + "Плечо счёта:     " + DoubleToStr(AccountLeverage(), 0) 
               + "\n" 
               + "Баланс:       " + DoubleToStr(AccountBalance(), 2) 
               + "\n" 
               + "Валюта счёта:     " + AccountCurrency() 
               + "\n" 
               + "Средства:         " + DoubleToStr(AccountEquity(), 2) 
               + "\n" 
               + "------------------------------------------------\n", "Информация о марже:" 
               + "\n" 
               + "Свободная маржа:              " + DoubleToStr(AccountFreeMargin(), 2) 
               + "\n" 
               + "Используемая маржа:              " + DoubleToStr(AccountMargin(), 2) 
               + "\n" 
            + "------------------------------------------------");
         }
      }
      bool_108 = UseMediumTermStrategy;
      Comment("\n BTC FAPTv2.0 " + Gsa_192[bool_108] + ": " + Gs_1844 
         + "\n" 
      + Gs_1892 + str_concat_100);
   }
   Gs_1892 = "";
   Gs_1904 = "";
   if (Li_0 >= Gi_1240) {
      if (Gi_100 > 0 && Gi_124 == 1) {
         if (Gi_100 == 1 && !Gi_136) return;
         if (Gi_100 == 2 && !Gi_132) return;
      }
      if (StealthMode) f0_26();
      if (Scalper_UseCustomLevels) f0_16();
      f0_11();
      if (Gi_1632 != Gi_1636 || Scalper_StartSessionMinute != Scalper_EndSessionMinute) {
         if (Scalper_ProfitLimit > 0.0) {
            if (Ld_28 >= Scalper_ProfitLimit) {
               f0_18("ALL");
               Gs_1904 = Gs_1904 + "Profit taken\n";
               return;
            }
         }
         if (Scalper_LossLimit > 0.0) {
            if (Ld_28 <= -1.0 * Scalper_LossLimit) {
               f0_18("ALL");
               Gs_1904 = Gs_1904 + "Loss hit\n";
               return;
            }
         }
      }
      if (Gi_100 > 0) {
         if (Gi_100 == 1 && !Gi_136) return;
         if (Gi_100 == 2 && !Gi_132) return;
      }
      Li_112 = f0_4();
      month_116 = TimeMonth(Li_0);
      if (Scalper_ForceCloseAtEOS == 3 && G_month_1940 != month_116) {
         if (Li_112) {
            Ls_120 = "Starting new Monthly Session, closing any open trades";
            Print("ForceCloseAtEOM: " + Ls_120);
            f0_18(Symbol());
         }
         G_month_1940 = month_116;
      } else {
         bool_128 = TimeHour(Li_0) == 22;
         Li_132 = TimeMinute(Li_0) >= 55;
         Li_136 = TimeHour(Li_0) >= 23;
         if (Scalper_ForceCloseAtEOS == 2 && day_of_week_4 == 5 && (bool_128 && Li_132) || Li_136) {
            if (Li_112) {
               Ls_140 = "Weekly Session over on Friday, closing any open trades";
               Print("ForceCloseAtEOW: " + Ls_140);
               f0_18(Symbol());
            }
         } else {
            if (Scalper_AvoidDaysBefore > 0 && day_8 <= Scalper_AvoidDaysBefore) Gs_1904 = "AvoidDaysBefore filter\n";
            else {
               if (Scalper_AvoidDaysAfter > 0 && day_8 >= Scalper_AvoidDaysAfter) Gs_1904 = "AvoidDaysAfter filter\n";
               else {
                  if (day_of_week_4 == 0 || day_of_week_4 > 5 && (!Scalper_TradeWeekend)) Gs_1904 = "Weekend filter\n";
                  else {
                     if (!Scalper_TradeFriday) {
                        if (day_of_week_4 == 5) {
                           Gs_1904 = "TradeFriday filter\n";
                           return;
                        }
                     }
                     if (!Scalper_TradeMonday) {
                        if (day_of_week_4 <= 1) {
                           Gs_1904 = "TradeMonday filter\n";
                           return;
                        }
                     }
                     if (day_of_week_4 == 1 && TimeHour(Li_0) < Scalper_StartWorkTimeHour || (TimeHour(Li_0) == Scalper_StartWorkTimeHour && TimeMinute(Li_0) < Scalper_StartSessionMinute)) Gs_1904 = "Early Monday trading not allowed\n";
                     else {
                        if (!Gba_1868[day_of_week_4] && Li_0 >= Gi_1872 && Li_0 < Gi_1876) Gs_1892 = "\nBTC Fapturbo2 will not trade on this day of this week due to possible volatile news/events/holidays!\n";
                        else {
                           if (!f0_15(Gi_1544, Gi_1632, Scalper_StartSessionMinute, Gi_1636, Scalper_EndSessionMinute)) {
                              Gs_1904 = Gs_1904 + "Not Time to Trade\n";
                              if (Scalper_ForceCloseAtEOS == 1 && Gi_1864) {
                                 if (f0_4() == TRUE) {
                                    Print("ForceCloseAtEOD: Session over, closing any open trades");
                                    f0_18(Symbol());
                                 }
                              }
                              Gi_1864 = FALSE;
                              if (!f0_4()) {
                                 Gi_1540 = TRUE;
                                 Gi_1536 = TRUE;
                              }
                           } else {
                              if (!Gi_1864) {
                                 Gi_1864 = TRUE;
                                 if (WriteDebugLog) Print("BTC FAPT2 Premium trading is in session: checking server...");
                                 if ((!IsTesting()) && !IsOptimization()) {
                                    Gi_1856 = TRUE;
                                    f0_19();
                                    Gi_1860 = TimeCurrent();
                                    Gi_1320 = TRUE;
                                 }
                                 if (!f0_4()) {
                                    Gi_1540 = TRUE;
                                    Gi_1536 = TRUE;
                                 }
                              }
                              if (Scalper_RelaxHours > 0) {
                                 if (f0_27() == TRUE) {
                                    Gs_1904 = "RelaxHours filter\n";
                                    return;
                                 }
                              }
                              if (Scalper_SimpleHeightFilter) {
                                 if (f0_28() == TRUE) {
                                    Gs_1904 = "SimpleHeight Filter\n";
                                    return;
                                 }
                              }
                              if (Scalper_TrendFilter) {
                                 if (f0_9() == TRUE) {
                                    Gs_1904 = "Trend Filter\n";
                                    return;
                                 }
                              }
                              if (Scalper_OneTrade != 0) {
                                 if (f0_12() == TRUE) {
                                    if (Gi_1300) {
                                       if (Gi_1348 == 0) Print("Already have one trade inside this interval of time.");
                                       else Print("Уже есть одна сделка внутри этого интервала времени.");
                                    }
                                    Gs_1904 = "OneTrade filter: Already have one trade inside this interval of time\n";
                                    return;
                                 }
                              }
                              if (Scalper_OneOpenTrade) {
                                 if (f0_23() > 0) {
                                    if (Gi_1300) {
                                       if (Gi_1348 == 0) Print("Already have open order with MagicNumber = ", G_magic_1396);
                                       else Print("Уже есть один ордер с MagicNumber = ", G_magic_1396);
                                    }
                                    Gs_1904 = "OpenOneTrade filter: Already have open order with MagicNumber = " + G_magic_1396 
                                    + "\n";
                                    return;
                                 }
                              }
                              if (Gi_1012) {
                                 if (Gi_1756) {
                                    Gs_1904 = "News Filter\n";
                                    return;
                                 }
                              }
                              if (Ld_12 > Gd_1696) {
                                 if (WriteLog && (!Gi_1532)) {
                                    if (Gi_1348 == 0) {
                                       Print("Trade signal is missed due to invalid high spread. BTC Fapturbo2 will try again later when spreads come to normal. Current spread = ", DoubleToStr(Ld_12, Digits),
                                          ",  MaxSpread = ", DoubleToStr(Gd_1696, Digits));
                                    } else {
                                       Print("Торговый сигнал пропущен из-за большого спреда.");
                                       Print("Текущий спред = ", DoubleToStr(Ld_12, Digits), ",  MaxSpread = ", DoubleToStr(Gd_1696, Digits));
                                       Print("FapTurbo2 будет пробовать позже, когда спред станет допустимым.");
                                    }
                                 }
                                 Gi_1532 = TRUE;
                              } else {
                                 HideTestIndicators(TRUE);
                                 irsi_148 = iRSI(NULL, G_timeframe_748, G_period_756, PRICE_CLOSE, Gi_760);
                                 irsi_156 = iRSI(NULL, G_timeframe_772, G_period_780, PRICE_CLOSE, Gi_784);
                                 ima_164 = iMA(NULL, G_timeframe_796, G_period_804, 0, MODE_SMA, PRICE_MEDIAN, Gi_808);
                                 HideTestIndicators(FALSE);
                                 Li_172 = f0_4();
                                 if (Scalper_ReverseTrade == FALSE) Li_176 = !Li_172 && irsi_148 < Gi_764 || irsi_156 < Gi_788 && ima_164 >= Ask + 0.0002;
                                 else {
                                    Li_176 = !Li_172 && irsi_148 > Gi_768 || irsi_156 > Gi_792 && ima_164 <= Bid - 0.0002;
                                    Ls_unused_180 = "(ReversedTrade) ";
                                 }
                                 if (Li_176 == 1) {
                                    if (Gi_1536) {
                                       if (!Scalper_UseFilterMA) count_188 = 0;
                                       else {
                                          ima_192 = iMA(NULL, G_timeframe_932, Scalper_PeriodFilterMA, 0, G_ma_method_944, G_applied_price_940, 0);
                                          if (Close[0] <= ima_192) count_188++;
                                       }
                                       if (count_188 == 0) {
                                          f0_13(OP_BUY, Gi_1564, Gi_1568);
                                          Gi_1536 = FALSE;
                                          Gi_1540 = TRUE;
                                       }
                                    }
                                 }
                                 Li_172 = f0_4();
                                 if (Scalper_ReverseTrade == FALSE) Li_176 = !Li_172 && irsi_148 > Gi_768 || irsi_156 > Gi_792 && ima_164 <= Bid - 0.0002;
                                 else Li_176 = !Li_172 && irsi_148 < Gi_764 || irsi_156 < Gi_788 && ima_164 >= Ask + 0.0002;
                                 if (Li_176 == 1) {
                                    if (Gi_1540) {
                                       if (!Scalper_UseFilterMA) count_188 = 0;
                                       else {
                                          ima_192 = iMA(NULL, PERIOD_M15, Scalper_PeriodFilterMA, 0, G_ma_method_944, G_applied_price_940, 0);
                                          if (Close[0] >= ima_192) count_188++;
                                       }
                                       if (count_188 == 0) {
                                          f0_13(OP_SELL, Gi_1564, Gi_1568);
                                          Gi_1540 = FALSE;
                                          Gi_1536 = TRUE;
                                       }
                                    }
                                 }
                                 if (irsi_148 < Gi_1556 && irsi_148 > Gi_1560) {
                                    Gi_1540 = TRUE;
                                    Gi_1536 = TRUE;
                                 }
                              }
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
}
			 		 		       		 	    	  	 			 	 			 		     						 	  	 			 	    				 	  						 		 		 		 	   		  	   	  	 		 	 				 	 			 	 					 	   		 	  		 
// 2FDD172D8DFADBAEDD3582F64A4AC280
string f0_3(int Ai_0) {
   string Ls_4;
   if (Ai_0 < 10) Ls_4 = "0";
   else Ls_4 = "";
   return (Ls_4 + "" + Ai_0);
}
		  	     	  	 	 			 	 	  		  	 					     	  		  	 	   	   						 			 		  			 	    	  		 			 	    		 	  	   	   		 					 	  			  	  		 	 			 		 	
// FBC8B84378C5BE93622295AD2B5DB6D4
int f0_27() {
   int datetime_16;
   bool Li_20;
   double Ld_24;
   double Ld_32;
   double Ld_40;
   int datetime_52;
   int ticket_0 = -1;
   int Li_4 = OrdersHistoryTotal() - 1;
   int datetime_8 = -2147483647;
   for (int pos_12 = Li_4; pos_12 >= 0; pos_12--) {
      if (OrderSelect(pos_12, SELECT_BY_POS, MODE_HISTORY)) {
         if (OrderMagicNumber() == G_magic_1396) {
            if (OrderSymbol() == Gs_1492) {
               datetime_16 = OrderCloseTime();
               if (datetime_8 < datetime_16) {
                  datetime_8 = datetime_16;
                  ticket_0 = OrderTicket();
               }
            }
         }
      }
   }
   if (ticket_0 < 0) return (0);
   if (OrderSelect(ticket_0, SELECT_BY_TICKET)) {
      Li_20 = FALSE;
      Ld_24 = NormalizeDouble(OrderOpenPrice(), Digits);
      Ld_32 = NormalizeDouble(OrderClosePrice(), Digits);
      Ld_40 = NormalizeDouble(OrderStopLoss(), Digits);
      if (OrderType() == OP_BUY) {
         if (Ld_32 <= Ld_40 && Ld_40 != 0.0) Li_20 = TRUE;
         else
            if (NormalizeDouble(Ld_24 - Ld_32, Digits) >= Gd_1712) Li_20 = TRUE;
      } else {
         if (Ld_32 >= Ld_40 && Ld_40 != 0.0) Li_20 = TRUE;
         else
            if (NormalizeDouble(Ld_32 - Ld_24, Digits) >= Gd_1712) Li_20 = TRUE;
      }
   } else return (0);
   if (!Li_20) return (0);
   int shift_48 = iBarShift(NULL, PERIOD_H1, datetime_8, FALSE);
   if (shift_48 < Scalper_RelaxHours) {
      datetime_52 = iTime(NULL, PERIOD_H1, 0);
      if (G_datetime_1552 == datetime_52) return (1);
      if (WriteLog) {
         if (Gi_1348 == 0) Print("Relax Hours Left = " + DoubleToStr(shift_48 - Scalper_RelaxHours, 0) + " (after StopLoss).");
         else Print("Осталось Relax часов = " + DoubleToStr(shift_48 - Scalper_RelaxHours, 0) + " (после StopLoss).");
      }
      G_datetime_1552 = datetime_52;
      return (1);
   }
   return (0);
}
			         		 	 	 			 	   		 	 		 	        			  				  	  		 				  	  		   	  	   			 		 	 			     			  	 	     				 			 		  		  		  	 	 	 				 	
// 5E4BB5D9B4EB32C0588068B9C5F804C7
int f0_9() {
   double Ld_4;
   double Ld_12;
   double Ld_20;
   bool Li_28;
   if (Gi_1312 <= 0 || Gi_1316 < 0 || Gi_1316 > 100) return (0);
   for (int Li_0 = 0; Li_0 <= Gi_1316; Li_0++) {
      Ld_4 = NormalizeDouble(iMA(NULL, PERIOD_M15, Scalper_TF_MA_Period, 0, G_ma_method_896, G_applied_price_892, Li_0), G_digits_1400);
      Ld_12 = NormalizeDouble(iMA(NULL, PERIOD_M15, Scalper_TF_MA_Period, 0, G_ma_method_896, G_applied_price_892, Li_0 + Gi_1312), G_digits_1400);
      if (Ld_12 > 0.0) Ld_20 = 100.0 * MathAbs(Ld_4 - Ld_12) / Ld_12;
      if (Gd_908 < Ld_20) Gd_908 = Ld_20;
      Li_28 = FALSE;
      if (Ld_20 > Scalper_TFMaxPercentMove) Li_28 = TRUE;
      if (Li_28) break;
   }
   if (Li_0 > Gi_1316) return (0);
   if (Gi_1320 && WriteDebugLog || Gi_1300) {
      if (Gi_1348 == 0) Print("Market is risky at the moment. Trading is temporarily forbidden by the filter TrendFilter.");
      else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром TrendFilter.");
      if (Li_0 != 0) {
         if (Gi_1348 == 0) Print("Relax Bars Left = " + DoubleToStr(Gi_1316 - Li_0, 0) + " (after MaxPercentMove).");
         else Print("Осталось Relax баров = " + DoubleToStr(Gi_1316 - Li_0, 0) + " (после MaxPercentMove).");
      }
      Gi_1320 = FALSE;
   }
   return (1);
}
			 	   	    	 			 	 	 		  	  	  	 		   	    		 				   		 						   		 			  		 	 	 		  				 	 	  	  	 	    	 	    										 			 			 		 			 	 		  
// FD7C17F9E8FFB4CD334C8A8C01FCE02A
int f0_28() {
   int datetime_4;
   bool Li_0 = FALSE;
   if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 1) - iLow(NULL, PERIOD_M15, 1), G_digits_1400) > Gd_1720) Li_0 = TRUE;
   if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 2) - iLow(NULL, PERIOD_M15, 2), G_digits_1400) > Gd_1720) Li_0 = TRUE;
   if (Li_0) {
      datetime_4 = iTime(NULL, PERIOD_M15, 0);
      if (G_datetime_1548 == datetime_4) return (1);
      if (Gi_1324 && WriteDebugLog || Gi_1300) {
         Gi_1324 = FALSE;
         if (Gi_1348 == 0) Print("Market is risky at the moment. Trading is temporarily forbidden by the filter SimpleHeightFilter.");
         else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром SimpleHeightFilter.");
      }
      G_datetime_1548 = datetime_4;
      return (1);
   }
   return (0);
}
	 		  	 		 						   						  	         	 		 			  	 	 	 					  	 	 	     			      			 	  		   			 		  			  			  	   	  	 		 		 	  	 		 				   		   
// AA3497737B53671269D7F7CBCE5ADEB4
bool f0_15(int Ai_0, int Ai_4, int Ai_8, int Ai_12, int Ai_16) {
   int Li_28;
   int Li_32;
   int hour_20 = TimeHour(Ai_0);
   int minute_24 = TimeMinute(Ai_0);
   if (Ai_4 == Ai_12 && Ai_8 == Ai_16) return (TRUE);
   if (Ai_16 == 0) {
      if (Ai_12 == 0) Li_28 = 23;
      else Li_28 = Ai_12 - 1;
      Li_32 = 59;
   } else {
      Li_28 = Ai_12;
      Li_32 = Ai_16 - 1;
   }
   double Ld_36 = Ai_4 + Ai_8 / 100.0;
   double Ld_44 = Li_28 + Li_32 / 100.0;
   double Ld_52 = hour_20 + minute_24 / 100.0;
   bool Li_ret_60 = FALSE;
   if (Ld_36 < Ld_44 && Ld_36 <= Ld_52 && Ld_52 <= Ld_44) Li_ret_60 = TRUE;
   if (Ld_36 > Ld_44 && Ld_36 <= Ld_52 || Ld_52 <= Ld_44) Li_ret_60 = TRUE;
   return (Li_ret_60);
}
	 		 	 			 		   	   	   		  				     	 			 		 			 	 		  			   	  	   		 		   						 			 	   	  			  	  	 			 	 	  	   	 	 		  			 		    	   	 		 
// 3070E883A104FCC047A1A6B240434873
int f0_4() {
   int Li_0 = OrdersTotal() - 1;
   for (int pos_4 = Li_0; pos_4 >= 0; pos_4--) {
      if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) {
         if (OrderMagicNumber() == G_magic_1396) {
            if (OrderSymbol() == Gs_1492)
               if (OrderType() <= OP_SELL) return (1);
         }
      }
   }
   return (0);
}
	     	 			 					 											     		  	 			 		  	  		 				 	 	 	 			   					    		 		  		 					 							  	    	    	 	 		    	  	    				 				   
// A076F38073ABEC669F1459B783418EA6
int f0_13(int A_cmd_0, int Ai_unused_4, int Ai_unused_8) {
   int Li_12;
   double price_24;
   color color_32;
   int ticket_40;
   int error_44;
   string Ls_48;
   double price_56;
   if (Gi_988 > 0) {
      Li_12 = f0_0(Gi_988);
      if ((!IsTesting()) && !IsOptimization()) Sleep(1000 * Li_12);
   }
   double Ld_16 = NormalizeDouble(f0_24(), 2);
   if (AccountFreeMarginCheck(Gs_1492, A_cmd_0, Ld_16) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) {
      if (Gi_1348 == 0) {
         Print("You don\'t have free margin.");
         Comment("You don\'t have free margin.");
      } else {
         Print("Для открытия ордера недостаточно свободной маржи.");
         Comment("Для открытия ордера недостаточно свободной маржи.");
      }
      return (-1);
   }
   RefreshRates();
   if (A_cmd_0 == OP_BUY) {
      price_24 = Ask;
      color_32 = ColorBuy;
   } else {
      price_24 = Bid;
      color_32 = ColorSell;
   }
   int Li_36 = Gi_1432;
   while (Li_36 > 0) {
      if (Scalper_AddSpreadToTP) Gd_716 = MarketInfo(Gs_1492, MODE_SPREAD) * MathPow(10, G_point_1444 - Point);
      ticket_40 = OrderSend(Gs_1492, A_cmd_0, Ld_16, price_24, G_slippage_1440, 0, 0, Scalper_ExpertComment, G_magic_1396, 0, color_32);
      Sleep(MathRand() / 1000);
      if (ticket_40 < 0) {
         error_44 = GetLastError();
         if (WriteDebugLog) {
            if (A_cmd_0 == OP_BUY) Ls_48 = "OP_BUY";
            else Ls_48 = "OP_SELL";
            Print("Open: OrderSend(", Ls_48, ") error = ", f0_22(error_44));
         }
         if (error_44 != 136/* OFF_QUOTES */) break;
         if (!(Gi_1344)) break;
         Sleep(6000);
         RefreshRates();
         if (A_cmd_0 == OP_BUY) price_56 = Ask;
         else price_56 = Bid;
         Print("div#4");
         if (NormalizeDouble(MathAbs((price_56 - price_24) / G_point_1444), 0) > Gi_1436) break;
         price_24 = price_56;
         Li_36--;
         if (Li_36 > 0) {
            if (Gi_1348 == 0) Print("... Possible to open order.");
            else Print("... Возможно открыть ордер.");
         }
         Ld_16 = NormalizeDouble(Ld_16 / 2.0, Gi_1392);
         if (Ld_16 < Gd_1460) Ld_16 = Gd_1460;
      } else {
         if (OrderSelect(ticket_40, SELECT_BY_TICKET)) price_24 = OrderOpenPrice();
         if (SendEmail) {
            if (Gi_1348 == 0) {
               SendMail(Gs_1500, StringConcatenate("BTC Fapturbo2 Trade Information\nCurrency Pair: ", StringSubstr(Gs_1492, 0, 6), 
                  "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), 
                  "\nOrder Type: ", f0_25(A_cmd_0), 
                  "\nPrice: ", DoubleToStr(price_24, Digits), 
                  "\nLot size: ", DoubleToStr(Ld_16, Gi_1392), 
                  "\nEvent: Trade Opened", 
                  "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), 
               "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency()));
            } else {
               SendMail(Gs_1516, StringConcatenate("BTC Fapturbo2 торговая информация\nВалютная пара: ", StringSubstr(Gs_1492, 0, 6), 
                  "\nВремя: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), 
                  "\nТип ордера: ", f0_25(A_cmd_0), 
                  "\nЦена: ", DoubleToStr(price_24, Digits), 
                  "\nРазмер лота: ", DoubleToStr(Ld_16, Gi_1392), 
                  "\nСобытие: открытие ордера", 
                  "\n\nТекущий баланс: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), 
               "\nТекущие средства: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency()));
            }
         }
         if (!(SoundAlert)) break;
         PlaySound(SoundFileAtOpen);
         break;
      }
   }
   return (ticket_40);
}
	   		  			    		 		   					 		   				  			   	 	  	 	 			 		 		 														 		 	 				 		    				     	  		     		 			   	 	 	   	  		 		  	  
// B59EAB0C7109E29D53AB58CE25ADBF1B
void f0_16() {
   int Li_12;
   double Ld_16;
   double Ld_24;
   int Li_32;
   double Ld_36;
   string Ls_44;
   int Li_unused_0 = MarketInfo(Gs_1492, MODE_SPREAD);
   int Li_4 = OrdersTotal() - 1;
   for (int pos_8 = Li_4; pos_8 >= 0; pos_8--) {
      if (!OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) {
         if (WriteDebugLog) Print("NoiseFilter: OrderSelect() error = ", GetLastError());
      } else {
         if (OrderMagicNumber() == G_magic_1396) {
            if (OrderType() <= OP_SELL) {
               if (OrderSymbol() == Gs_1492) {
                  Li_12 = Gi_1544 - OrderOpenTime();
                  if (Li_12 > Gi_1612) {
                     Ld_16 = NormalizeDouble(OrderClosePrice(), Digits);
                     Ld_24 = NormalizeDouble(OrderOpenPrice(), Digits);
                     Li_32 = 0;
                     if (OrderType() == OP_BUY) Ld_36 = Ld_16 - Ld_24;
                     else Ld_36 = Ld_24 - Ld_16;
                     if (Li_12 < Gi_1616 && Ld_36 >= Gd_1656) Li_32 = 1;
                     else {
                        if (Li_12 > Gi_1616 && Li_12 < Gi_1620 && Ld_36 >= Gd_1664) Li_32 = 2;
                        else {
                           if (Li_12 > Gi_1620 && Li_12 < Gi_1624 && Ld_36 >= Gd_1672) Li_32 = 3;
                           else {
                              if (Li_12 > Gi_1624 && Li_12 < Gi_1628 && Ld_36 >= Gd_1680) Li_32 = 4;
                              else
                                 if (Li_12 > Gi_1628 && Ld_36 >= Gd_1688) Li_32 = 5;
                           }
                        }
                     }
                     if (Li_32 != 0) {
                        Ls_44 = "NoiseFilter => Profit=" + DoubleToStr(Ld_36 / G_point_1444, 2) + ", Level#" + Li_32;
                        if (WriteDebugLog) Print(Ls_44);
                        f0_20(OrderTicket(), OrderLots(), OrderType(), G_slippage_1440, Ls_44);
                     }
                  }
               }
            }
         }
      }
   }
}
						     	   	 	     	     		 		  		     	  	  		  	 	  	 	 			   				    			   	  			 	              	 				  			 	 		 				 	  				  	 	    	 	
// F7F05CD58384F11F2D4F8C4A7DEE6806
void f0_26() {
   double Ld_12;
   double Ld_20;
   double Ld_28;
   if (Gi_1564 <= 0 && Gi_1568 <= 0) return;
   int Li_unused_0 = MarketInfo(Gs_1492, MODE_SPREAD);
   int Li_4 = OrdersTotal() - 1;
   for (int pos_8 = Li_4; pos_8 >= 0; pos_8--) {
      if (!OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) {
         if (WriteDebugLog) Print("WatchLevels: OrderSelect() error = ", GetLastError());
      } else {
         if (OrderMagicNumber() == G_magic_1396) {
            if (OrderType() <= OP_SELL) {
               if (OrderSymbol() == Gs_1492) {
                  Ld_12 = NormalizeDouble(OrderClosePrice(), Digits);
                  Ld_20 = NormalizeDouble(OrderOpenPrice(), Digits);
                  if (Scalper_AddSpreadToTP > FALSE) Gd_1640 = NormalizeDouble((Gi_1564 + Gd_716) * Point, G_digits_1400);
                  if (OrderType() == OP_BUY) {
                     Ld_28 = Ld_12 - Ld_20;
                     if (!((Gd_1640 > 0.0 && Ld_28 >= Gd_1640) || (Gd_1648 < 0.0 && Ld_28 <= Gd_1648))) continue;
                     if (WriteDebugLog) {
                        if (Gi_1348 == 0) Print("WatchLevels: level for close BUY");
                        else Print("WatchLevels: уровень для закрытия BUY");
                     }
                     f0_20(OrderTicket(), OrderLots(), 0, G_slippage_1440, "WatchLevel => Profit=" + DoubleToStr(Ld_28 / G_point_1444, 2));
                     continue;
                  }
                  Ld_28 = Ld_20 - Ld_12;
                  if ((Gd_1640 > 0.0 && Ld_28 >= Gd_1640) || (Gd_1648 < 0.0 && Ld_28 <= Gd_1648)) {
                     if (WriteDebugLog) {
                        if (Gi_1348 == 0) Print("WatchLevels: level for close SELL");
                        else Print("WatchLevels: уровень для закрытия SELL");
                     }
                     f0_20(OrderTicket(), OrderLots(), 1, G_slippage_1440, "WatchLevel => Profit=" + DoubleToStr(Ld_28 / G_point_1444, 2));
                  }
               }
            }
         }
      }
   }
}
	   	 		 		  		   		 		  			   		 			 		 		  	 	   	  	  	 			  					    				  	 	 	      		 			 			 					  	 			  			      		 	    			   		 	 		
// EBFE91FAEB07FF5788FD1001AD46AE29
double f0_24() {
   if (!Scalper_UseMM) return (Scalper_Lots);
   double Ld_0 = AccountFreeMargin() * Gd_1484 / 100.0;
   double Ld_ret_8 = NormalizeDouble(MathFloor(Ld_0 / Gd_1476) * G_lotstep_1468, Gi_1392);
   if (Ld_ret_8 < Gd_1460) Ld_ret_8 = Gd_1460;
   if (Ld_ret_8 > Gd_1452) Ld_ret_8 = Gd_1452;
   if (Ld_ret_8 > Scalper_MaxLots) Ld_ret_8 = Scalper_MaxLots;
   return         

Recommend