#property copyright "Copyright © 2008, FAPTURBO.com Licensed till 2009.05.17" #property link "http://fapturbo.com" #import "FapTurbo3.dll" int fun1(int a0, int a1, double a2, double a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11, int a12, int a13, int a14, int a15, int& a16[], int& a17[], int& a18[], int a19, int& a20[], int& a21[], int a22, int& a23[]); int fun2(double a0, int a1, double a2, double a3, int a4, int a5, double a6, int a7, int a8, int& a9[], int& a10[], int& a11[], int a12, int& a13[], int& a14[], int a15, int& a16[]); int fun3(double a0, int a1, double a2, double a3, int a4, int a5, double a6, int a7, int a8, int& a9[], int& a10[], int& a11[], int a12, int& a13[], int& a14[], int a15, int& a16[]); bool fun4(double a0, int a1, int a2); #import int gi_76 = 0; extern string ____Scalper___________ = "--- Scalper EURCHF, EURGPB, GBPCHF or USDCAD M15 ---"; extern bool UseScalperStrategy = TRUE; extern double Scalper_Lots = 0.1; extern bool Scalper_UseMM = TRUE; extern double Scalper_LotsRiskReductor = 5.0; extern double Scalper_MaxLots = 10.0; extern int Scalper_GMTOffset = 1; int gi_124 = 21; int gi_128 = 1; int gi_132 = 6; int gi_136 = 112; int gi_140 = 5; int gi_144 = 53; int gi_148 = 10; int gi_152 = 75; int gi_156 = 10; int gi_160 = 58; extern bool Scalper_StealthMode = TRUE; extern double Scalper_ProfitLimit = 0.0; extern double Scalper_LossLimit = 0.0; extern bool Scalper_UseCustomLevels = TRUE; extern int Scalper_RelaxHours = 0; extern bool Scalper_SimpleHeightFilter = TRUE; extern bool Scalper_TrendFilter = TRUE; extern bool Scalper_TradeFriday = FALSE; extern int Scalper_OneTrade = 0; extern bool Scalper_OneOpenTrade = FALSE; extern bool Scalper_UseFilterMA = FALSE; extern int Scalper_PeriodFilterMA = 100; extern int Scalper_PriceFilterMA = 0; extern int Scalper_MethodFilterMA = 0; extern double Scalper_MaxSpread = 5.0; extern int Scalper_Slippage = 6; int gi_240 = 5; extern string Scalper_ExpertComment = "FapTurboScalper"; extern int Scalper_MagicNumber = 12464336; extern string ____FapTurbo__________ = "---------- FapTurbo EUR/USD M1 ----------"; extern double FapTurbo_Lots = 0.01; extern double FapTurbo_LotsRiskReductor = 1.0; extern int FapTurbo_MaxOrders = 2; extern int FapTurbo_MaxLots = 10; extern int FapTurbo_StopTime = 9; extern int FapTurbo_aaa = 35; extern int FapTurbo_bbb = 48; extern double FapTurbo_TakeProfit = 140.0; extern double FapTurbo_StopLoss = 500.0; extern double FapTurbo_TrailingStop = 0.0; extern int FapTurbo_DurationInHours = 0; extern int FapTurbo_CloseAfterXmonths = 1; extern int FapTurbo_PeriodMALarge = 100; extern int FapTurbo_PeriodMASmall = 30; extern int FapTurbo_PriceMA_0_6 = 0; extern int FapTurbo_TypeMA_0_3 = 0; extern int FapTurbo_ShiftMALarge = 3; extern int FapTurbo_ShiftMASmall = 1; extern int FapTurbo_LookForDays = 2; extern int FapTurbo_CriticalDays = 45; extern int FapTurbo_RelaxDays = 0; extern double FapTurbo_HedgingLotReducer = 0.0; extern int FapTurbo_Hedging = 0; extern int FapTurbo_TradeNFP = 1; extern int FapTurbo_TradeFriday = 1; extern int FapTurbo_Prudent = 0; extern int FapTurbo_SymAlligatorOnCritica = 1; extern int FapTurbo_FixedDirection = 1; extern int FapTurbo_ClsLsrOnMrktChnge = 0; extern int FapTurbo_AlwaysTrade = 0; extern double FapTurbo_LowLot = 0.1; extern int FapTurbo_TooGoodToBeTrue = 50; extern int FapTurbo_PrudentPeriod = 30; extern int FapTurbo_StartWorkTimeHour = 0; extern int FapTurbo_StartWorkTimeMin = 0; extern int FapTurbo_EndWorkTimeHour = 0; extern int FapTurbo_EndWorkTimeMin = 0; extern int FapTurbo_OneTrade = 0; extern double FapTurbo_SpanGator = 0.5; extern int FapTurbo_SlipPage = 3; extern string FapTurbo_ExpertComment = "FapTurboEA"; extern int FapTurbo_MagicNumber = 12464337; extern string ____Other_Parameters__ = "-----------------------------------------"; extern bool TradeMicroLots = TRUE; 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; extern string KEY = "012345"; int gi_532 = 25; int gi_536 = 60; int gi_540 = 3; int gi_544 = 140; int gi_548 = 2; int gi_552 = 170; int gi_556 = 0; int gi_560 = 200; int gi_564 = -1; int gi_568 = 240; int gi_572 = -4; double gd_576 = 0.3; int gi_584 = 25; int gi_588 = 75; int gi_592 = 3; int gi_596 = 100; int gi_600 = 2; int gi_604 = 135; int gi_608 = 0; int gi_612 = 210; int gi_616 = -1; int gi_620 = 245; int gi_624 = -4; double gd_628 = 0.2; int gi_636 = 75; int gi_640 = 80; int gi_644 = 3; int gi_648 = 145; int gi_652 = 2; int gi_656 = 180; int gi_660 = 0; int gi_664 = 205; int gi_668 = -1; int gi_672 = 250; int gi_676 = -4; double gd_680 = 0.15; int gi_688 = 23; int gi_692 = 80; int gi_696 = 3; int gi_700 = 145; int gi_704 = 2; int gi_708 = 180; int gi_712 = 0; int gi_716 = 205; int gi_720 = -1; int gi_724 = 250; int gi_728 = -4; double gd_732 = 0.35; int gi_740 = 50; int g_period_744 = 8; int g_period_748 = 6; int gi_752 = 30; int g_period_756 = 20; int gi_760 = 36; int gi_764 = 20; int g_period_768 = 5; int g_applied_price_772 = PRICE_CLOSE; int g_ma_method_776 = MODE_SMA; int gi_780 = 4; int gi_784 = 3; int gi_788 = 150; int gi_792 = 21; int gi_796 = 40; int gi_800 = 21; bool gi_804 = FALSE; int gi_808 = 0; bool gi_812 = TRUE; bool gi_816 = TRUE; bool gi_820; bool gi_824; int g_bool_828; int gi_832; int g_magic_836; int gi_840; int gia_844[1]; int gia_848[1]; int g_acc_number_852; int gia_856[100]; int gia_860[100]; int gia_864[100]; int gia_868[100]; int gi_872 = 2; int gi_876 = 1; int g_slippage_880; double gd_884; double g_maxlot_892; double g_minlot_900; double g_lotstep_908; double gd_916; double gd_924; string g_symbol_932; string gs_940 = "New Trade Information"; string gs_948 = "New Trade Information"; string gs_956 = "Новая торговая информация"; string gs_964 = "Новая торговая информация"; bool gi_972; bool gi_976 = TRUE; bool gi_980 = TRUE; int g_datetime_984; int g_datetime_988; int g_datetime_992; int gi_996; int gi_1000; int gi_1004; int gi_1008; int gi_1012; int gi_1016; int gi_1020; int gi_1024; int gi_1028; int gi_1032; int gi_1036; int gi_1040; int gi_1044; int gi_1048; int gi_1052; int gi_1056; int gi_1060; int gi_1064; int gi_1068; int gi_1072; int gi_1076; int gi_1080; int gi_1084; int gi_1088; double gd_1092; double gd_1100; double gd_1108; double gd_1116; double gd_1124; double gd_1132; double gd_1140; double gd_1148; double gd_1156; double gd_1164; double gd_1172; bool gi_1180; bool gi_1184; bool gi_1188; bool gi_1192; bool gi_1196; bool gi_1200; int g_datetime_1204; int g_datetime_1212; int gi_1216; int gi_1220; double g_icustom_1224; double g_icustom_1232; double g_icustom_1240; double g_digits_1248; double g_str2dbl_1256; double g_ifractals_1264; double g_ifractals_1272; double g_ima_1280; double g_ima_1288; double g_ima_1296; double g_ima_1304; double g_ima_1312; double g_ima_1320; double gda_1328[]; double gda_1332[]; string g_dbl2str_1336; string gs_1344; string gs_1352; bool gi_1360 = TRUE; bool gi_1364 = TRUE; int init() { double ld_0; string ls_8; int li_ret_16; int l_pos_24; int l_cmd_28; bool l_ord_delete_32; gi_820 = TRUE; if (!PrintLogOnChart) Comment(""); if (!IsDllsAllowed()) { if (gi_808 == 0) Comment("Warning: Set Parameter \"AllowDLL Imports\" ON in menu Tools -> Options -> ExpertAdvisors."); else Comment("Предупреждение: Установите параметер \"AllowDLL Imports\" ВКЛ в меню Сервис -> Настройки -> Советники."); gi_812 = FALSE; return (0); } gi_812 = TRUE; if (gi_812 < 0) Comment("Логическая переменная меньше нуля."); g_symbol_932 = Symbol(); if (Digits < 4) { gd_884 = 0.01; gi_840 = 2; } else { gd_884 = 0.0001; gi_840 = 4; } if (gi_840 == 0) Comment("Неверное значение переменной."); g_maxlot_892 = MarketInfo(g_symbol_932, MODE_MAXLOT); g_minlot_900 = MarketInfo(g_symbol_932, MODE_MINLOT); g_lotstep_908 = MarketInfo(g_symbol_932, MODE_LOTSTEP); gd_916 = MarketInfo(g_symbol_932, MODE_MARGINREQUIRED) * g_lotstep_908; if (TradeMicroLots) gi_832 = 2; else gi_832 = 1; if (!UseScalperStrategy) { if (StringSubstr(g_symbol_932, 0, 6) != "EURUSD" || Period() != PERIOD_M1) { if (gi_808 == 0) { Alert("Use Fapturbo system only on EURUSD M1."); Print("Use Fapturbo system only on EURUSD M1."); Comment("Error: Wrong TimeFrame or Currency Pair! Read instructions!"); } else { Alert("Используйте Fapturbo систему только на EURUSD M1."); Print("Используйте Fapturbo систему только на EURUSD M1."); Comment("Ошибка: Неверный таймфрейм или валютная пара! Читайте инструкции!"); } gi_812 = FALSE; return (0); } gi_812 = TRUE; if (gi_812 < 0) Comment("Логическая переменная меньше нуля."); if (FapTurbo_StartWorkTimeHour < 0 || FapTurbo_StartWorkTimeHour > 23) FapTurbo_StartWorkTimeHour = 0; if (FapTurbo_StartWorkTimeMin < 0 || FapTurbo_StartWorkTimeMin > 59) FapTurbo_StartWorkTimeMin = 0; if (FapTurbo_EndWorkTimeHour < 0 || FapTurbo_EndWorkTimeHour > 23) FapTurbo_EndWorkTimeHour = 0; if (FapTurbo_EndWorkTimeMin < 0 || FapTurbo_EndWorkTimeMin > 59) FapTurbo_EndWorkTimeMin = 0; if (FapTurbo_CloseAfterXmonths < 0) FapTurbo_CloseAfterXmonths = 0; if (FapTurbo_CloseAfterXmonths > 12) FapTurbo_CloseAfterXmonths = 12; ld_0 = AccountLeverage(); gd_924 = NormalizeDouble(FapTurbo_LotsRiskReductor * (100 / ld_0), 2); g_magic_836 = FapTurbo_MagicNumber; g_slippage_880 = FapTurbo_SlipPage * MathPow(10, Digits - gi_840); } else { ls_8 = StringSubstr(g_symbol_932, 0, 6); if (gi_76 == 0 && ls_8 == "EURUSD") { if (gi_808 == 0) { Alert("Use scalper system only on EURCHF, EURGPB, GBPCHF or USDCAD M15."); Print("Use scalper system only on EURCHF, EURGPB, GBPCHF or USDCAD M15."); Comment("Error: Wrong TimeFrame or Currency Pair! Read instructions!"); } else { Alert("Используйте Scalper систему только на EURCHF, EURGPB, GBPCHF или USDCAD M15."); Print("Используйте Scalper систему только на EURCHF, EURGPB, GBPCHF или USDCAD M15."); Comment("Ошибка: Неверный таймфрейм или валютная пара! Читайте инструкции!"); } gi_812 = FALSE; return (0); } if ((ls_8 != "EURGBP" && ls_8 != "EURCHF" && ls_8 != "GBPCHF" && ls_8 != "USDCAD") || Period() != PERIOD_M15) { if (gi_808 == 0) { Alert("Use scalper system only on EURCHF, EURGPB, GBPCHF or USDCAD M15."); Print("Use scalper system only on EURCHF, EURGPB, GBPCHF or USDCAD M15."); Comment("Error: Wrong TimeFrame or Currency Pair! Read instructions!"); } else { Alert("Используйте Scalper систему только на EURCHF, EURGPB, GBPCHF или USDCAD M15."); Print("Используйте Scalper систему только на EURCHF, EURGPB, GBPCHF или USDCAD M15."); Comment("Ошибка: Неверный таймфрейм или валютная пара! Читайте инструкции!"); } gi_812 = FALSE; return (0); } gi_812 = TRUE; if (gi_812 < 0) Comment("Логическая переменная меньше нуля."); if (ls_8 == "EURGBP") { gi_1012 = gi_132; gi_1016 = gi_136; gi_1020 = gi_532; gd_1092 = gd_576; gi_1024 = gi_536; gi_1032 = gi_544; gi_1040 = gi_552; gi_1048 = gi_560; gi_1056 = gi_568; gi_1028 = gi_540; gi_1036 = gi_548; gi_1044 = gi_556; gi_1052 = gi_564; gi_1060 = gi_572; } else { if (ls_8 == "EURCHF") { gi_1012 = gi_140; gi_1016 = gi_144; gi_1020 = gi_584; gd_1092 = gd_628; gi_1024 = gi_588; gi_1032 = gi_596; gi_1040 = gi_604; gi_1048 = gi_612; gi_1056 = gi_620; gi_1028 = gi_592; gi_1036 = gi_600; gi_1044 = gi_608; gi_1052 = gi_616; gi_1060 = gi_624; } else { if (ls_8 == "GBPCHF") { gi_1012 = gi_148; gi_1016 = gi_152; gi_1020 = gi_636; gd_1092 = gd_680; gi_1024 = gi_640; gi_1032 = gi_648; gi_1040 = gi_656; gi_1048 = gi_664; gi_1056 = gi_672; gi_1028 = gi_644; gi_1036 = gi_652; gi_1044 = gi_660; gi_1052 = gi_668; gi_1060 = gi_676; } else { if (ls_8 == "USDCAD") { gi_1012 = gi_156; gi_1016 = gi_160; gi_1020 = gi_688; gd_1092 = gd_732; gi_1024 = gi_692; gi_1032 = gi_700; gi_1040 = gi_708; gi_1048 = gi_716; gi_1056 = gi_724; gi_1028 = gi_696; gi_1036 = gi_704; gi_1044 = gi_712; gi_1052 = gi_720; gi_1060 = gi_728; } } } } gd_1108 = NormalizeDouble((-1 * gi_1016) * gd_884, gi_840); gd_1100 = NormalizeDouble(gi_1012 * gd_884, gi_840); gi_1064 = 60 * gi_1024; gi_1068 = 60 * gi_1032; gi_1072 = 60 * gi_1040; gi_1076 = 60 * gi_1048; gi_1080 = 60 * gi_1056; gd_1116 = gi_1028 * gd_884; gd_1124 = gi_1036 * gd_884; gd_1132 = gi_1044 * gd_884; gd_1140 = gi_1052 * gd_884; gd_1148 = gi_1060 * gd_884; gd_1172 = NormalizeDouble(gi_1020 * gd_884, gi_840); gd_1156 = NormalizeDouble(Scalper_MaxSpread * gd_884, gi_840 + 1); gd_1164 = NormalizeDouble(gi_1016 * gd_884, gi_840); gi_996 = 100 - gi_752; gi_1000 = 100 - gi_760; gi_1004 = gi_764 / 2 + 50; gi_1008 = 50 - gi_764 / 2; gi_1084 = gi_124 + Scalper_GMTOffset; gi_1088 = gi_128 + Scalper_GMTOffset; while (true) { if (gi_1084 >= 24) { gi_1084 -= 24; continue; } if (gi_1084 >= 0) break; gi_1084 += 24; } while (true) { if (gi_1088 >= 24) { gi_1088 -= 24; continue; } if (gi_1088 >= 0) break; gi_1088 += 24; } if (Scalper_PeriodFilterMA <= 0) Scalper_UseFilterMA = FALSE; if (Scalper_PriceFilterMA < PRICE_CLOSE || Scalper_PriceFilterMA > PRICE_WEIGHTED) Scalper_UseFilterMA = FALSE; if (Scalper_MethodFilterMA < MODE_SMA || Scalper_MethodFilterMA > MODE_LWMA) Scalper_UseFilterMA = FALSE; ld_0 = AccountLeverage(); gd_924 = NormalizeDouble(Scalper_LotsRiskReductor * (100 / ld_0), 2); g_magic_836 = Scalper_MagicNumber; g_slippage_880 = Scalper_Slippage * MathPow(10, Digits - gi_840); } return (0); while (true) { if (!OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("CloseAllSymbols: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { l_cmd_28 = OrderType(); RefreshRates(); while (!IsTradeAllowed()) Sleep(1000); if (l_cmd_28 <= OP_SELL) l_ord_delete_32 = CloseOrder(OrderTicket(), OrderLots(), l_cmd_28, g_slippage_880); else { l_ord_delete_32 = OrderDelete(OrderTicket()); if (!l_ord_delete_32) if (WriteDebugLog) Print("CloseAllSymbols: OrderDelete() error = ", GetLastError()); } if (!l_ord_delete_32) li_ret_16 = -1; } } l_pos_24--; if (l_pos_24 >= 0) continue; break; } return (li_ret_16); } int deinit() { int li_16; int l_datetime_20; int l_hour_24; int li_unused_28; return (0); double ld_ret_0 = 0; int li_8 = OrdersTotal() - 1; for (int l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (!OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("CalculateProfitSession: OrderSelect() error = ", GetLastError()); } else if (OrderMagicNumber() == g_magic_836) ld_ret_0 += OrderProfit() + OrderSwap() + OrderCommission(); } if (gi_124 == gi_128) li_16 = 0; else { l_datetime_20 = TimeCurrent(); li_16 = iTime(NULL, PERIOD_D1, 0); l_hour_24 = TimeHour(l_datetime_20); li_unused_28 = 0; if (gi_124 > gi_128) if (l_hour_24 < gi_124) li_16 -= 86400; li_16 += 3600 * gi_124; } li_8 = OrdersHistoryTotal() - 1; for (l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (!OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY)) { if (WriteDebugLog) Print("CalculateProfitSession: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) if (OrderCloseTime() >= li_16) ld_ret_0 += OrderProfit() + OrderSwap() + OrderCommission(); } } return (ld_ret_0); } int start() { int li_0; int li_ret_4; int l_pos_12; if (gi_820) { if (StringLen(AccountName()) <= 0) { if (gi_808 == 0) { Comment("FapTurbo EA need have on-line Terminal."); if (gi_1360) Alert("FapTurbo EA need have on-line Terminal."); if (WriteLog) Print("FapTurbo EA need have on-line Terminal."); } else { Comment("Советнику FapTurbo нужно, чтобы Терминал был on-line."); if (gi_1360) Alert("Советнику FapTurbo нужно, чтобы Терминал был on-line."); if (WriteLog) Print("Советнику FapTurbo нужно, чтобы Терминал был on-line."); } gi_1360 = FALSE; return (0); } Comment(""); g_bool_828 = IsDemo(); g_acc_number_852 = AccountNumber(); Compress(gia_856, AccountName()); Compress(gia_860, AccountCompany()); Compress(gia_864, AccountCurrency()); Compress(gia_868, KEY); li_0 = fun3(Bid - 0.0002, ExistPosition(), 53.2489, 67.8991, 33, 84, 1.3481, g_acc_number_852, g_acc_number_852, gia_856, gia_860, gia_864, TimeCurrent(), gia_868, gia_844, g_bool_828, gia_848); if (li_0 == 16) { if (gi_808 == 0) { Alert("Your copy is not activated. Please activate your copy." + "\n" + " Your expert ID = " + gia_844[0]); } else { Alert("Ваша копия не активирована. Пожалуйста, активируйте Вашу копию." + "\n" + " ID Вашего советника = " + gia_844[0]); } gi_816 = FALSE; } else gi_816 = TRUE; li_0 = fun2(Ask + 0.0002, ExistPosition(), 45.4511, 34.1139, 67, 16, 1.3483, g_acc_number_852, g_acc_number_852, gia_856, gia_860, gia_864, TimeCurrent(), gia_868, gia_844, g_bool_828, gia_848); if (li_0 == 32) gi_824 = TRUE; gi_820 = FALSE; } if (!gi_812) return (0); if (gi_812 < 0) Comment("Привет с большого бодуна."); if (!gi_816) { if (gi_808 == 0) { Comment("Your copy is not activated. Please activate your copy." + "\n" + "Your expert ID = " + gia_844[0]); } else { Comment("Ваша копия не активирована. Пожалуйста, активируйте Вашу копию." + "\n" + "ID Вашего советника = " + gia_844[0]); } return (0); } if (gi_816 < 0) Comment("Хрень какая-то."); if (gi_824) { if (gi_808 == 0) { Comment("FapTurbo EA has Expired." + "\n" + "Download new version in the member area."); if (gi_1364) Alert("FapTurbo License has Expired. Download new version in the member area."); if (WriteLog) Print("FapTurbo License has Expired. Download new version in the member area."); } else { Comment("Лицензия советника FapTurbo устарела." + "\n" + "Скачайте новую версию."); if (gi_1364) Alert("Лицензия советника FapTurbo устарела. Скачайте новую версию."); if (WriteLog) Print("Лицензия советника FapTurbo устарела. Скачайте новую версию."); } gi_1364 = FALSE; } if (gi_824 < 0) Comment("Даёшь пиратству бой!"); if (!UseScalperStrategy) FapTurbo(); else Scalper(); return (0); while (true) { if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) if (OrderMagicNumber() == g_magic_836) li_ret_4++; l_pos_12--; if (l_pos_12 >= 0) continue; break; } return (li_ret_4); } void FapTurbo() { int l_datetime_0; bool li_4; bool li_8; bool li_12; bool li_16; bool li_20; string ls_24; int li_36; int li_40; double l_price_44; double l_price_52; int li_64; int li_76; int l_datetime_80; int l_pos_84; int l_datetime_88; g_digits_1248 = MarketInfo(g_symbol_932, MODE_DIGITS); g_dbl2str_1336 = DoubleToStr(g_str2dbl_1256, g_digits_1248); g_str2dbl_1256 = StrToDouble(g_dbl2str_1336); if (IsTradeAllowed()) { if (IsConnected()) { if (IsStopped() == 0) { if (IsTradeContextBusy()) { if (WriteLog) { if (gi_808 == 0) Print("Trade context is busy!"); else Print("Торговый контекст занят!"); } } else { if (IsDateTimeEnabled(TimeCurrent())) { if (CheckParams()) { if (PrepareIndicators()) { l_datetime_0 = iTime(NULL, PERIOD_D1, 0); if (g_datetime_1212 != l_datetime_0) { g_datetime_1212 = l_datetime_0; gs_1352 = ""; if (WriteLog) { if (gi_808 == 0) Print("---------------------- Start New Daily Bar: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS), " ----------------------"); else Print("---------------------- Старт нового дневного бара: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS), " ----------------------"); } if (WriteDebugLog) PrintDebugLog(); gi_1184 = FALSE; gi_1188 = FALSE; gi_1192 = FALSE; gi_1196 = FALSE; if (FapTurbo_FixedDirection != 0) gi_1200 = TRUE; li_4 = TRUE; li_8 = TRUE; li_12 = FALSE; li_16 = TRUE; li_20 = FALSE; if (!Rule1(0)) { if (gi_808 == 0) ls_24 = "Critical Day. Expected Cross in " + gi_1216 + " days."; else ls_24 = "Критический день. Ожидается пересечение в ближайшие " + gi_1216 + " суток."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_4 = FALSE; } else { if (!Relax1()) { if (gi_808 == 0) ls_24 = "Relax Days Left = " + gi_1220 + " (after Cross)."; else ls_24 = "Relax Days Left = " + gi_1220 + " (после пересечения)."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_4 = FALSE; } else { if (gi_808 == 0) ls_24 = "NO Expected Cross. -> Possible to trade."; else ls_24 = "Не ожидается пересечения. -> Возможно торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); } } if (!Rule2(0)) { if (FapTurbo_Prudent != 0) { if (gi_808 == 0) ls_24 = "Prudent Day. No Trading."; else ls_24 = "Prudent Day. Не торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_8 = FALSE; } else { if (gi_808 == 0) ls_24 = "Prudent Day Trading."; else ls_24 = "Prudent Day Trading."; if (FapTurbo_SymAlligatorOnCritica != 0) { if (gi_808 == 0) ls_24 = ls_24 + " Trading SymAlligator today."; else ls_24 = ls_24 + " Сегодня торговать SymAlligator."; gi_1184 = TRUE; } else { if (gi_808 == 0) ls_24 = ls_24 + " Simple Trading today."; else ls_24 = ls_24 + " Сегодня обычная торговля."; } gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1188 = TRUE; li_12 = TRUE; } } else { if (!Relax2()) { if (gi_808 == 0) ls_24 = "Relax Days Left = " + gi_1220 + " (after Prudent)."; else ls_24 = "Relax Days Left = " + gi_1220 + " (после Prudent)."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_8 = FALSE; } else { if (gi_808 == 0) ls_24 = "NO Prudent Day. -> Possible to trade."; else ls_24 = "Не Prudent день. -> Возможно торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); } } if (!Rule3(0)) { gi_1200 = FALSE; if (gi_808 == 0) ls_24 = "TooGoodToBeTrue Day (Start from " + TimeToStr(iTime(NULL, PERIOD_D1, gi_1220), TIME_DATE) + ")."; else ls_24 = "TooGoodToBeTrue день (начало с " + TimeToStr(iTime(NULL, PERIOD_D1, gi_1220), TIME_DATE) + ")."; if (FapTurbo_Prudent != 0) { if (gi_808 == 0) ls_24 = ls_24 + " No Trading."; else ls_24 = ls_24 + " Не торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_16 = FALSE; } else { if (FapTurbo_SymAlligatorOnCritica != 0) { if (gi_808 == 0) ls_24 = ls_24 + " Trading SymAlligator today."; else ls_24 = ls_24 + " Сегодня торговать SymAlligator."; gi_1184 = TRUE; } else { if (gi_808 == 0) ls_24 = ls_24 + " Simple Trading today."; else ls_24 = ls_24 + " Сегодня обычная торговля."; } gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1188 = TRUE; li_20 = TRUE; } } else { if (!Relax3()) { gi_1200 = FALSE; if (gi_808 == 0) ls_24 = "Prudent Period TooGoodToBeTrue day left = " + gi_1220 + "."; else ls_24 = "Prudent период TooGoodToBeTrue осталось дней = " + gi_1220 + "."; if (FapTurbo_Prudent != 0) { if (gi_808 == 0) ls_24 = ls_24 + " No Trading."; else ls_24 = ls_24 + " Не торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); li_16 = FALSE; } else { if (FapTurbo_SymAlligatorOnCritica != 0) { if (gi_808 == 0) ls_24 = ls_24 + " Trading SymAlligator today."; else ls_24 = ls_24 + " Сегодня торговать SymAlligator."; gi_1184 = TRUE; } else { if (gi_808 == 0) ls_24 = ls_24 + " Simple Trading today."; else ls_24 = ls_24 + " Сегодня обычная торговля."; } gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1188 = TRUE; li_20 = TRUE; } } else { if (gi_808 == 0) ls_24 = "NO TooGoodToBeTrue Day. -> Possible to trade."; else ls_24 = "Не TooGoodToBeTrue день. -> Возможно торговать."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); } } if (li_4 && li_8 && !li_12 && li_16 && !li_20) { if (gi_808 == 0) ls_24 = "Simple Trading Day."; else ls_24 = "Сегодня обычная торговля."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1188 = TRUE; gi_1180 = TRUE; gi_1192 = FALSE; } else { if (FapTurbo_AlwaysTrade != 0) { gi_1192 = TRUE; gi_1184 = TRUE; if (gi_808 == 0) ls_24 = "AlwaysTrade: Trading SymAlligator today with LowLot."; else ls_24 = "AlwaysTrade: Сегодня торговать SymAlligator c LowLot."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); } } if (li_12 || li_20) gi_1180 = TRUE; if (!li_4 || !li_8 || !li_16) gi_1180 = FALSE; if (FapTurbo_TradeNFP == 0) { if (TimeDayOfWeek(l_datetime_0) == 5 && TimeDay(l_datetime_0) <= 7) { if (gi_808 == 0) ls_24 = "Does not trade on the first Friday of month."; else ls_24 = "Не торговать в первую пятницу месяца."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1196 = TRUE; } } if (FapTurbo_TradeFriday == 0) { if (TimeDayOfWeek(l_datetime_0) == 5) { if (gi_808 == 0) ls_24 = "Does not trade on the Friday."; else ls_24 = "Не торговать в пятницу."; gs_1352 = gs_1352 + ls_24 + "\n"; if (WriteLog) Print(ls_24); gi_1196 = TRUE; } } if (gi_1196) { if (gi_808 == 0) ls_24 = "The final resolution: NO TRADE today."; else ls_24 = "Итоговое решение: Не торговать сегодня."; } else { if (!gi_1180) { if (!gi_1192) { if (gi_808 == 0) ls_24 = "The final resolution: NO TRADE today."; else ls_24 = "Итоговое решение: Не торговать сегодня."; } else { if (gi_808 == 0) ls_24 = "The final resolution: to TRADE WITH LOWLOT today."; else ls_24 = "Итоговое решение: Сегодня торговать с LowLot."; } } else { if (gi_808 == 0) ls_24 = "The final resolution: to TRADE today."; else ls_24 = "Итоговое решение: Сегодня торговать."; } } gs_1352 = gs_1352 + ls_24; if (WriteLog) { Print(ls_24); Print("------------------------------------------------------------------------------------------------"); } } if (PrintLogOnChart) { if (gi_808 == 0) { Comment("" + "\n" + "FapTurbo" + "\n" + "------------------------------------------------" + "\n" + "BROKER INFORMATION:" + "\n" + "Broker Company: " + AccountCompany() + "\n" + "------------------------------------------------" + "\n" + "ACCOUNT INFORMATION:" + "\n" + "Account Name: " + AccountName() + "\n" + "Account Number: " + AccountNumber() + "\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" + "Actual Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + "\n" + "Licensed Till: " + TimeToStr(gia_848[0], TIME_DATE) + "\n" + "Current Spread: " + DoubleToStr(MarketInfo(g_symbol_932, MODE_SPREAD) / MathPow(10, Digits - gi_840), Digits - gi_840) + "\n" + "------------------------------------------------" + "\n" + "STRATEGY INFORMATION:" + "\n" + gs_1352 + "\n" + "------------------------------------------------" + "\n" + "DEBUG INFORMATION:" + "\n" + "lastMALarge = " + DoubleToStr(g_ima_1288, gi_840) + ", prevMALarge = " + DoubleToStr(g_ima_1280, gi_840) + ", farMALarge = " + DoubleToStr(g_ima_1312, gi_840) + "\n" + "lastMASmall = " + DoubleToStr(g_ima_1304, gi_840) + ", prevMASmall = " + DoubleToStr(g_ima_1296, gi_840) + ", farMASmall = " + DoubleToStr(g_ima_1320, gi_840)); } else { Comment("" + "\n" + "FapTurbo" + "\n" + "------------------------------------------------" + "\n" + "Информация о брокере:" + "\n" + "Брокерская компания: " + AccountCompany() + "\n" + "------------------------------------------------" + "\n" + "Информация о счёте:" + "\n" + "Название счёта: " + AccountName() + "\n" + "Номер счёта: " + AccountNumber() + "\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" + "------------------------------------------------" + "\n" + "Текущее время сервера: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + "\n" + "Лицензия до: " + TimeToStr(gia_848[0], TIME_DATE) + "\n" + "Текущий спред: " + DoubleToStr(MarketInfo(g_symbol_932, MODE_SPREAD) / MathPow(10, Digits - gi_840), Digits - gi_840) + "\n" + "------------------------------------------------" + "\n" + "Информация стратегии:" + "\n" + gs_1352 + "\n" + "------------------------------------------------" + "\n" + "Отладочная информация:" + "\n" + "lastMALarge = " + DoubleToStr(g_ima_1288, gi_840) + ", prevMALarge = " + DoubleToStr(g_ima_1280, gi_840) + ", farMALarge = " + DoubleToStr(g_ima_1312, gi_840) + "\n" + "lastMASmall = " + DoubleToStr(g_ima_1304, gi_840) + ", prevMASmall = " + DoubleToStr(g_ima_1296, gi_840) + ", farMASmall = " + DoubleToStr(g_ima_1320, gi_840)); } } li_36 = CalculateCurrentOrders(); if (li_36 > 0) { for (int li_32 = li_36 - 1; li_32 >= 0; li_32--) { if (GetOrderByPos(li_32)) { if (OrderMagicNumber() == g_magic_836) { if (TradeSignalCloseOrder() || TradeSignalCloseOrderOnTime(li_32)) CloseOrder(OrderTicket(), OrderLots(), OrderType(), g_slippage_880); else { if (FapTurbo_TakeProfit != 0.0 && NormalizeDouble(OrderTakeProfit(), gi_840) == 0.0) { if (OrderType() == OP_BUY) { li_40 = NormalizeDouble((OrderClosePrice() - OrderOpenPrice()) / gd_884, gi_840); l_price_44 = NormalizeDouble(OrderOpenPrice() + FapTurbo_TakeProfit * gd_884, gi_840); } else { li_40 = NormalizeDouble((OrderOpenPrice() - OrderClosePrice()) / gd_884, gi_840); l_price_44 = NormalizeDouble(OrderOpenPrice() - FapTurbo_TakeProfit * gd_884, gi_840); } if (li_40 >= FapTurbo_TakeProfit) { if (gi_808 == 0) gs_1344 = "Price at level TakeProfit."; else gs_1344 = "Цена достигла уровня TakeProfit."; CloseOrder(OrderTicket(), OrderLots(), OrderType(), g_slippage_880); return; } if (FapTurbo_TakeProfit * gd_884 > MarketInfo(g_symbol_932, MODE_STOPLEVEL) * Point) { while (!IsTradeAllowed()) Sleep(1000); OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), l_price_44, 0, Red); } } if (FapTurbo_StopLoss != 0.0 && NormalizeDouble(OrderStopLoss(), gi_840) == 0.0) { if (OrderType() == OP_BUY) { li_40 = NormalizeDouble((OrderClosePrice() - OrderOpenPrice()) / gd_884, gi_840); l_price_52 = NormalizeDouble(OrderOpenPrice() - FapTurbo_StopLoss * gd_884, gi_840); } else { li_40 = NormalizeDouble((OrderOpenPrice() - OrderClosePrice()) / gd_884, gi_840); l_price_52 = NormalizeDouble(OrderOpenPrice() + FapTurbo_StopLoss * gd_884, gi_840); } if (li_40 <= -1.0 * FapTurbo_StopLoss) { if (gi_808 == 0) gs_1344 = "Price at level StopLoss."; else gs_1344 = "Цена достигла уровня StopLoss."; CloseOrder(OrderTicket(), OrderLots(), OrderType(), g_slippage_880); return; } if (FapTurbo_StopLoss * gd_884 > MarketInfo(g_symbol_932, MODE_STOPLEVEL) * Point) { while (!IsTradeAllowed()) Sleep(1000); OrderModify(OrderTicket(), OrderOpenPrice(), l_price_52, OrderTakeProfit(), 0, Red); } } if (FapTurbo_TrailingStop > 0.0) TrailOrderStop(); } } } } if (li_36 < FapTurbo_MaxOrders) if ((TimeCurrent() - g_datetime_1204) / 60 >= FapTurbo_StopTime) TrueOpen(); } else { TrueOpen(); return; while (true) { if (OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_88 = OrderOpenTime(); if (l_datetime_80 < l_datetime_88) l_datetime_80 = l_datetime_88; } } } l_pos_84--; if (l_pos_84 >= 0) continue; break; } if (l_datetime_80 < li_64) { li_76 = OrdersHistoryTotal() - 1; l_datetime_80 = -2147483648; for (l_pos_84 = li_76; l_pos_84 >= 0; l_pos_84--) { if (OrderSelect(l_pos_84, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_88 = OrderOpenTime(); if (l_datetime_80 < l_datetime_88) l_datetime_80 = l_datetime_88; } } } } if (l_datetime_80 < li_64) { } } } } } } } } } } } int CalculateCurrentOrders() { int li_ret_0; double ld_8; double ld_20; double l_price_28; double ld_36; double ld_44; bool li_52; int li_56; int li_60; double l_price_64; double l_price_72; bool l_bool_80; for (int l_pos_4 = 0; l_pos_4 < OrdersTotal(); l_pos_4++) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) if (OrderMagicNumber() == g_magic_836 && OrderSymbol() == g_symbol_932) li_ret_0++; } return (li_ret_0); while (true) { if (!OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("SetOrderLevels: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { ld_20 = NormalizeDouble(OrderClosePrice(), gi_840); l_price_28 = NormalizeDouble(OrderOpenPrice(), gi_840); ld_36 = NormalizeDouble(OrderStopLoss(), gi_840); ld_44 = NormalizeDouble(OrderTakeProfit(), gi_840); li_52 = TRUE; li_56 = 0; li_60 = 0; if (ld_36 == 0.0) { if (Scalper_StealthMode) li_56 = gi_788 + MathRand() % gi_792; else li_56 = gi_1016; if (li_56 != 0) { if (OrderType() == OP_BUY) { l_price_64 = NormalizeDouble(l_price_28 - li_56 * gd_884, gi_840); if (ld_20 - l_price_64 <= ld_8) li_52 = FALSE; } else { l_price_64 = NormalizeDouble(l_price_28 + li_56 * gd_884, gi_840); if (l_price_64 - ld_20 <= ld_8) li_52 = FALSE; } } } else l_price_64 = ld_36; if (ld_44 == 0.0) { if (Scalper_StealthMode) li_60 = gi_796 + MathRand() % gi_800; else li_60 = gi_1012; if (li_60 != 0) { if (OrderType() == OP_BUY) { l_price_72 = NormalizeDouble(l_price_28 + li_60 * gd_884, gi_840); if (l_price_72 - ld_20 <= ld_8) li_52 = FALSE; } else { l_price_72 = NormalizeDouble(l_price_28 - li_60 * gd_884, gi_840); if (ld_20 - l_price_72 <= ld_8) li_52 = FALSE; } } } else l_price_72 = ld_44; if (li_56 != 0 && li_60 != 0 && li_52) { while (!IsTradeAllowed()) Sleep(1000); l_bool_80 = OrderModify(OrderTicket(), l_price_28, l_price_64, l_price_72, 0, CLR_NONE); if (!l_bool_80) if (WriteDebugLog) Print("SetOrderLevels: OrderModify(OP_SELL) error = ", GetLastError()); } } } } } l_pos_4--; if (l_pos_4 >= 0) continue; break; } return (0); } int TrueOpen() { int li_4; int li_8; double l_minlot_12; double l_minlot_20; double ld_28; if (gi_824) return (0); if (!IsTradeTime(TimeCurrent())) return (0); int li_0 = TradeSignalOpenOrder(); if (li_0 == 0) return (0); if (FapTurbo_OneTrade != 0) { if (HaveTrade()) { if (WriteDebugLog) { if (gi_808 == 0) Print("Already have one trade inside this interval of time."); else Print("Уже есть одна сделка в течении этого интервала времени."); } return (0); } } if (FapTurbo_Hedging != 0) { li_4 = FapTurbo_MaxOrders / 2; if (FapTurbo_MaxOrders % 2 != 0) li_4++; if (li_0 == 1) { li_8 = HavePositions(OP_BUY); if (li_8 >= li_4) { if (WriteLog) { if (gi_808 == 0) Print("Hedging: already there are open " + li_8 + " orders. The signal to BUY is blocked."); else Print("Hedging: уже есть открытых " + li_8 + " ордеров. Сигнал к покупке блокируется."); } return (0); } } else { li_8 = HavePositions(OP_SELL); if (li_8 >= li_4) { if (WriteLog) { if (gi_808 == 0) Print("Hedging: already there are open " + li_8 + " orders. The signal to SELL is blocked."); else Print("Hedging: уже есть открытых " + li_8 + " ордеров. Сигнал к продаже блокируется."); } return (0); } } } if (FapTurbo_HedgingLotReducer != 0.0) { if (li_0 == 1) l_minlot_12 = NormalizeDouble(OpenPosVol(OP_BUY) / FapTurbo_HedgingLotReducer, gi_832); else l_minlot_12 = NormalizeDouble(OpenPosVol(OP_SELL) / FapTurbo_HedgingLotReducer, gi_832); if (l_minlot_12 != 0.0) { l_minlot_20 = MarketInfo(g_symbol_932, MODE_MINLOT); if (l_minlot_12 < l_minlot_20) l_minlot_12 = l_minlot_20; if (!gi_1192) { ld_28 = l_minlot_12; if (WriteLog) { if (gi_808 == 0) Print("HedgingLot: the order will be open by the reduced lots."); else Print("HedgingLot: ордер будет открыт с уменьшенным лотом."); } } else { if (l_minlot_12 > FapTurbo_LowLot) { ld_28 = FapTurbo_LowLot; if (WriteLog) { if (gi_808 == 0) Print("HedgingLot: the reduced lots more than LowLot, the order will be open by the LowLot lots."); else Print("HedgingLot: уменьшенный лот больше чем LowLot, ордер будет открыт с LowLot лотом."); } } else { ld_28 = l_minlot_12; if (WriteLog) { if (gi_808 == 0) Print("HedgingLot: the order will be open by the reduced lots."); else Print("HedgingLot: ордер будет открыт с уменьшенным лотом."); } } } } else { if (!gi_1192) ld_28 = CalcLotsVolume(); else ld_28 = FapTurbo_LowLot; } } else { if (!gi_1192) ld_28 = CalcLotsVolume(); else ld_28 = FapTurbo_LowLot; } if (ld_28 == 0.0 || !CheckAccount(DirectionOrderType(li_0), ld_28)) return (0); int li_36 = OpenOrder(li_0, ld_28, FapTurbo_ExpertComment); return (0); } int CheckParams() { int l_pos_8; double ld_12; double ld_20; double ld_28; if (Bars < 100) { if (gi_808 == 0) Print("Bars less than 100"); else Print("На графике меньше 100 баров"); return (0); } if (FapTurbo_TakeProfit < 10.0) { if (gi_808 == 0) Print("FapTurbo_TakeProfit is less than 10"); else Print("FapTurbo_TakeProfit меньше 10"); return (0); } if (FapTurbo_Lots <= 0.0 && FapTurbo_LotsRiskReductor < 0.0) { if (gi_808 == 0) Print("FapTurbo_LotsRiskReductor is less than 0"); else Print("FapTurbo_LotsRiskReductor меньше 0"); return (0); } return (1); while (true) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("WatchLevels: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { ld_12 = NormalizeDouble(OrderClosePrice(), Digits); ld_20 = NormalizeDouble(OrderOpenPrice(), Digits); if (OrderType() == OP_BUY) { ld_28 = ld_12 - ld_20; if ((gd_1100 > 0.0 && ld_28 >= gd_1100) || (gd_1108 < 0.0 && ld_28 <= gd_1108)) { if (WriteDebugLog) { if (gi_808 == 0) Print("WatchLevels: level for close BUY"); else Print("WatchLevels: уровень для закрытия BUY"); } CloseOrder(OrderTicket(), OrderLots(), 0, g_slippage_880); } } else { ld_28 = ld_20 - ld_12; if ((gd_1100 > 0.0 && ld_28 >= gd_1100) || (gd_1108 < 0.0 && ld_28 <= gd_1108)) { if (WriteDebugLog) { if (gi_808 == 0) Print("WatchLevels: level for close SELL"); else Print("WatchLevels: уровень для закрытия SELL"); } CloseOrder(OrderTicket(), OrderLots(), 1, g_slippage_880); } } } } } } l_pos_8--; if (l_pos_8 >= 0) continue; break; } return (0); } bool CheckAccount(int a_cmd_0, double ad_4) { int l_pos_32; int li_36; double ld_40; double ld_48; int li_56; double ld_60; bool li_ret_12 = TRUE; double ld_16 = AccountFreeMarginCheck(g_symbol_932, a_cmd_0, ad_4); if (GetLastError() == 134/* NOT_ENOUGH_MONEY */) li_ret_12 = FALSE; if (!li_ret_12) { if (gi_808 == 0) Print("No money to open more orders.", " Lot=", ad_4, " Free Margin = ", AccountFreeMargin(), " Balance = ", AccountBalance()); else Print("Нет денег для открытия ордеров.", " Lot=", ad_4, " Свободная маржа = ", AccountFreeMargin(), " Баланс = ", AccountBalance()); } return (li_ret_12); while (true) { if (!OrderSelect(l_pos_32, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("NoiseFilter: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { li_36 = g_datetime_984 - OrderOpenTime(); if (li_36 > gi_1064) { ld_40 = NormalizeDouble(OrderClosePrice(), Digits); ld_48 = NormalizeDouble(OrderOpenPrice(), Digits); li_56 = 0; if (OrderType() == OP_BUY) ld_60 = ld_40 - ld_48; else ld_60 = ld_48 - ld_40; if (li_36 < gi_1068 && ld_60 >= gd_1116) li_56 = 1; else { if (li_36 > gi_1068 && li_36 < gi_1072 && ld_60 >= gd_1124) li_56 = 2; else { if (li_36 > gi_1072 && li_36 < gi_1076 && ld_60 >= gd_1132) li_56 = 3; else { if (li_36 > gi_1076 && li_36 < gi_1080 && ld_60 >= gd_1140) li_56 = 4; else if (li_36 > gi_1080 && ld_60 >= gd_1148) li_56 = 5; } } } if (li_56 != 0) CloseOrder(OrderTicket(), OrderLots(), OrderType(), g_slippage_880); } } } } } l_pos_32--; if (l_pos_32 >= 0) continue; break; } return (FALSE); } double CalcLotsVolume() { double ld_ret_0; int l_pos_12; if (FapTurbo_Lots > 0.0) ld_ret_0 = NormalizeLot(FapTurbo_Lots, 0, ""); else { ld_ret_0 = NormalizeDouble(MathFloor(AccountFreeMargin() * gd_924 / 100.0 / gd_916) * g_lotstep_908, gi_832); if (ld_ret_0 < g_minlot_900) ld_ret_0 = g_minlot_900; if (ld_ret_0 > g_maxlot_892) ld_ret_0 = g_maxlot_892; } if (ld_ret_0 > FapTurbo_MaxLots) ld_ret_0 = FapTurbo_MaxLots; return (ld_ret_0); while (true) { if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) if (OrderType() <= OP_SELL) return (1); } } l_pos_12--; if (l_pos_12 >= 0) continue; break; } return (0); } int PrepareIndicators() { double l_ifractals_20; g_icustom_1224 = iCustom(NULL, 0, "Alligator", 13, 8, 8, 5, 5, 3, 0, 0); g_icustom_1232 = iCustom(NULL, 0, "Alligator", 13, 8, 8, 5, 5, 3, 1, 0); g_icustom_1240 = iCustom(NULL, 0, "Alligator", 13, 8, 8, 5, 5, 3, 2, 0); int li_8 = 3; g_ifractals_1264 = 0; g_ifractals_1272 = 0; for (int li_4 = 0; li_4 <= li_8; li_4++) { l_ifractals_20 = iFractals(NULL, 0, MODE_LOWER, li_4); if (l_ifractals_20 != 0.0) g_ifractals_1264 = l_ifractals_20; l_ifractals_20 = iFractals(NULL, 0, MODE_UPPER, li_4); if (l_ifractals_20 != 0.0) g_ifractals_1272 = l_ifractals_20; } li_8 = 0; ArrayResize(gda_1328, li_8 + 1); ArrayResize(gda_1332, li_8 + 1); for (li_4 = 0; li_4 <= li_8; li_4++) { gda_1328[li_4] = iDeMarker(NULL, 0, FapTurbo_aaa, li_4); gda_1332[li_4] = (-iWPR(NULL, 0, FapTurbo_bbb, li_4 + 1)) / 100.0; } g_ima_1280 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMALarge); g_ima_1288 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, 0); g_ima_1296 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMASmall); g_ima_1304 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, 0); g_ima_1312 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMALarge); g_ima_1320 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMASmall); return (1); int l_hour_28 = TimeHour(g_datetime_984); if (gi_1084 < gi_1088 && l_hour_28 < gi_1084 || l_hour_28 >= gi_1088) { } if (gi_1084 > gi_1088 && (l_hour_28 < gi_1084 && l_hour_28 >= gi_1088)) return (0); if (gi_1088 == 0) gi_1088 = 24; if (Hour() == gi_1088 - 1 && Minute() >= gi_740) return (0); return (1); } int TradeSignalOpenOrder() { int l_datetime_8; int li_ret_0 = fun1(gi_1196, gi_1180, g_ima_1280, g_ima_1288, gi_1192, gi_1184, IsGatorActiveUp(), IsGatorActiveDown(), WasWPROverBuy(), WasWPROverSell(), IsFractalLower(), IsFractalUpper(), WasDemarkerHigh(), WasDemarkerLow(), g_acc_number_852, g_acc_number_852, gia_856, gia_860, gia_864, TimeCurrent(), gia_868, gia_844, g_bool_828, gia_848); if (li_ret_0 == 16) { gi_816 = FALSE; return (0); } if (li_ret_0 == 32) { gi_824 = TRUE; return (0); } if (li_ret_0 == 0) return (0); if (gi_1200) { if (li_ret_0 == 1) { if (g_ima_1280 > g_ima_1288 && g_ima_1296 > g_ima_1304) li_ret_0 = 0; else { if (WriteLog) { if (gi_808 == 0) Print("Filter FixedDirection allow a signal to BUY."); else Print("Фильтр FixedDirection пропускает сигнал к покупке."); } } } else { if (g_ima_1280 < g_ima_1288 && g_ima_1296 < g_ima_1304) li_ret_0 = 0; else { if (WriteLog) { if (gi_808 == 0) Print("Filter FixedDirection allow a signal to SELL."); else Print("Фильтр FixedDirection пропускает сигнал к продаже."); } } } } if (li_ret_0 == 0) return (0); if (gi_1188 && WriteLog) { if (IsGatorActiveUp()) { if (gi_808 == 0) Print("Alligator on BUY."); else Print("Alligator раскрыт к покупке."); } else { if (gi_808 == 0) Print("Alligator on SELL."); else Print("Alligator раскрыт к продаже."); } } if (WriteDebugLog) PrintDebugLog(); return (li_ret_0); bool li_4 = FALSE; if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 1) - iLow(NULL, PERIOD_M15, 1), gi_840) > gd_1172) li_4 = TRUE; if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 2) - iLow(NULL, PERIOD_M15, 2), gi_840) > gd_1172) li_4 = TRUE; if (li_4) { l_datetime_8 = iTime(NULL, PERIOD_M15, 0); if (g_datetime_988 != l_datetime_8) { if (WriteLog) { if (gi_808 == 0) Print("Today market is in risky conditions. Trade is forbidden by the filter SimpleHeightFilter."); else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром SimpleHeightFilter."); } g_datetime_988 = l_datetime_8; } return (1); } return (0); } int TradeSignalCloseOrder() { int li_0; double ld_4; double ld_12; double ld_20; if (FapTurbo_ClsLsrOnMrktChnge != 0) { if (OrderProfit() < 0.0 && TimeDay(OrderOpenTime()) != TimeDay(Time[0])) { if (OrderType() == OP_BUY) { if (g_ima_1296 > g_ima_1304) { if (WriteDebugLog) PrintDebugLog(); if (gi_808 == 0) gs_1344 = "MASmall going down."; else gs_1344 = "MASmall направлена вниз."; return (1); } } else { if (g_ima_1296 < g_ima_1304) { if (WriteDebugLog) PrintDebugLog(); if (gi_808 == 0) gs_1344 = "MASmall going up."; else gs_1344 = "MASmall направлена вверх."; return (1); } } } } return (!IsOrderProfitable()); while (true) { ld_4 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_0), gi_840); ld_12 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_0 + gi_780), gi_840); ld_20 = 100.0 * MathAbs(ld_4 - ld_12) / ld_12; if (ld_20 > gd_1092) break; li_0++; if (li_0 <= gi_784) continue; break; } if (li_0 > gi_784) return (0); if (WriteDebugLog) { if (gi_808 == 0) Print("Today market is in risky conditions. Trading is forbidden by the filter TrendFilter."); else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром TrendFilter."); if (li_0 != 0) { if (gi_808 == 0) Print("Relax Bars Left = " + DoubleToStr(gi_784 - li_0, 0) + " (after MaxPercentMove)."); else Print("Осталось Relax баров = " + DoubleToStr(gi_784 - li_0, 0) + " (после MaxPercentMove)."); } } return (1); } double NormalizeLot(double ad_0, bool ai_8 = FALSE, string a_symbol_12 = "") { double ld_ret_20; double ld_28; int l_ticket_60; int l_datetime_68; int l_pos_72; int l_datetime_76; bool li_80; double ld_84; double ld_92; double ld_100; int l_datetime_112; if (a_symbol_12 == "" || a_symbol_12 == "0") a_symbol_12 = g_symbol_932; double l_lotstep_36 = MarketInfo(a_symbol_12, MODE_LOTSTEP); double l_minlot_44 = MarketInfo(a_symbol_12, MODE_MINLOT); double l_maxlot_52 = MarketInfo(a_symbol_12, MODE_MAXLOT); if (l_minlot_44 == 0.0) l_minlot_44 = 0.1; if (l_maxlot_52 == 0.0) l_maxlot_52 = 100; if (l_lotstep_36 > 0.0) ld_28 = 1 / l_lotstep_36; else ld_28 = 1 / l_minlot_44; if (ai_8) ld_ret_20 = MathCeil(ad_0 * ld_28) / ld_28; else ld_ret_20 = MathFloor(ad_0 * ld_28) / ld_28; if (ld_ret_20 < l_minlot_44) ld_ret_20 = l_minlot_44; if (ld_ret_20 > l_maxlot_52) ld_ret_20 = l_maxlot_52; return (ld_ret_20); while (true) { if (OrderSelect(l_pos_72, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_76 = OrderCloseTime(); if (l_datetime_68 < l_datetime_76) { l_datetime_68 = l_datetime_76; l_ticket_60 = OrderTicket(); } } } } l_pos_72--; if (l_pos_72 >= 0) continue; break; } if (l_ticket_60 < 0) return (0); if (OrderSelect(l_ticket_60, SELECT_BY_TICKET)) { li_80 = FALSE; ld_84 = NormalizeDouble(OrderOpenPrice(), gi_840); ld_92 = NormalizeDouble(OrderClosePrice(), gi_840); ld_100 = NormalizeDouble(OrderStopLoss(), gi_840); if (OrderType() == OP_BUY) { if (ld_92 <= ld_100 && ld_100 != 0.0) li_80 = TRUE; else if (ld_84 - ld_92 >= gd_1164) li_80 = TRUE; } else { if (ld_92 >= ld_100 && ld_100 != 0.0) li_80 = TRUE; else if (ld_92 - ld_84 >= gd_1164) li_80 = TRUE; } } else return (0); if (!li_80) return (0); int l_shift_108 = iBarShift(NULL, PERIOD_H1, l_datetime_68, FALSE); if (l_shift_108 < Scalper_RelaxHours) { l_datetime_112 = iTime(NULL, PERIOD_H1, 0); if (g_datetime_992 != l_datetime_112) { if (WriteLog) { if (gi_808 == 0) Print("Relax Hours Left = " + DoubleToStr(l_shift_108 - Scalper_RelaxHours, 0) + " (after StopLoss)."); else Print("Осталось Relax часов = " + DoubleToStr(l_shift_108 - Scalper_RelaxHours, 0) + " (после StopLoss)."); } g_datetime_992 = l_datetime_112; } return (1); } return (0); } int TradeSignalCloseOrderOnTime(int ai_unused_0) { int l_month_4; int li_8; int li_16; int l_datetime_32; int l_pos_36; int l_datetime_40; if (FapTurbo_DurationInHours > 0) { if (TimeCurrent() - OrderOpenTime() >= 3600 * FapTurbo_DurationInHours) { if (gi_808 == 0) gs_1344 = "Limite duration of open position, after " + FapTurbo_DurationInHours + " hours."; else gs_1344 = "Ограничение длительности открытой позиции, после " + FapTurbo_DurationInHours + " часов."; return (1); } } if (FapTurbo_CloseAfterXmonths > 0) { l_month_4 = TimeMonth(OrderOpenTime()); li_8 = TimeMonth(TimeCurrent()); if (l_month_4 != li_8) { if (l_month_4 > li_8) li_8 += 12; if (li_8 - l_month_4 >= FapTurbo_CloseAfterXmonths) { if (gi_808 == 0) gs_1344 = "Start new month, after " + FapTurbo_CloseAfterXmonths + " months."; else gs_1344 = "Начало нового месяца, после " + FapTurbo_CloseAfterXmonths + " месяцев."; return (1); } } } return (0); while (true) { if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_40 = OrderOpenTime(); if (l_datetime_32 < l_datetime_40) l_datetime_32 = l_datetime_40; } } } l_pos_36--; if (l_pos_36 >= 0) continue; break; } if (l_datetime_32 >= li_16) return (1); int li_28 = OrdersHistoryTotal() - 1; l_datetime_32 = -2147483648; for (l_pos_36 = li_28; l_pos_36 >= 0; l_pos_36--) { if (OrderSelect(l_pos_36, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_40 = OrderOpenTime(); if (l_datetime_32 < l_datetime_40) l_datetime_32 = l_datetime_40; } } } } if (l_datetime_32 >= li_16) return (1); return (0); } int IsDateTimeEnabled(int ai_0) { int li_20; int li_24; int l_day_of_year_4 = TimeDayOfYear(ai_0); int l_day_of_week_8 = TimeDayOfWeek(ai_0); return (l_day_of_week_8 > 0 && l_day_of_week_8 < 6 && l_day_of_year_4 > 7 && l_day_of_year_4 < 360); int l_hour_12 = TimeHour(TimeCurrent()); int l_minute_16 = TimeMinute(TimeCurrent()); if (FapTurbo_StartWorkTimeHour == FapTurbo_EndWorkTimeHour && FapTurbo_StartWorkTimeMin == FapTurbo_EndWorkTimeMin) { } if (FapTurbo_EndWorkTimeMin == 0) { if (FapTurbo_EndWorkTimeHour == 0) li_20 = 23; else li_20 = FapTurbo_EndWorkTimeHour - 1; li_24 = 59; } else { li_20 = FapTurbo_EndWorkTimeHour; li_24 = FapTurbo_EndWorkTimeMin - 1; } if (FapTurbo_StartWorkTimeHour == li_20) { if (FapTurbo_StartWorkTimeMin == li_24) return (1); if (FapTurbo_StartWorkTimeMin < li_24) { if (l_hour_12 != FapTurbo_StartWorkTimeHour) return (0); if (l_minute_16 < FapTurbo_StartWorkTimeMin || l_minute_16 > li_24) return (0); return (1); } if (FapTurbo_StartWorkTimeMin > li_24) { if (l_hour_12 == FapTurbo_StartWorkTimeHour) if (l_minute_16 < FapTurbo_StartWorkTimeMin && l_minute_16 > li_24) return (0); return (1); } } if (FapTurbo_StartWorkTimeHour < li_20) { if (l_hour_12 < FapTurbo_StartWorkTimeHour || l_hour_12 > li_20) return (0); if (l_hour_12 == FapTurbo_StartWorkTimeHour && l_minute_16 < FapTurbo_StartWorkTimeMin) return (0); if (l_hour_12 == li_20 && l_minute_16 > li_24) return (0); return (1); } if (FapTurbo_StartWorkTimeHour > li_20) { if (l_hour_12 < FapTurbo_StartWorkTimeHour && l_hour_12 > li_20) return (0); if (l_hour_12 == FapTurbo_StartWorkTimeHour && l_minute_16 < FapTurbo_StartWorkTimeMin) return (0); if (l_hour_12 == li_20 && l_minute_16 > li_24) return (0); return (1); } return (1); } bool IsGatorActiveUp() { return (g_icustom_1240 - g_icustom_1232 >= FapTurbo_SpanGator * gd_884 && g_icustom_1232 - g_icustom_1224 >= FapTurbo_SpanGator * gd_884 && g_icustom_1240 - g_icustom_1224 >= FapTurbo_SpanGator * gd_884); } int IsGatorActiveDown() { return (g_icustom_1232 - g_icustom_1240 >= FapTurbo_SpanGator * gd_884 && g_icustom_1224 - g_icustom_1232 >= FapTurbo_SpanGator * gd_884 && g_icustom_1224 - g_icustom_1240 >= FapTurbo_SpanGator * gd_884); } int IsFractalLower() { return (g_ifractals_1264 != 0.0); } int IsFractalUpper() { return (g_ifractals_1272 != 0.0); } bool IsOrderProfitable() { return (TRUE); } int WasDemarkerLow() { return (ArrayMinValue(gda_1328) < 0.5); } int WasDemarkerHigh() { return (ArrayMaxValue(gda_1328) > 0.5); } int WasWPROverBuy() { return (ArrayMinValue(gda_1332) <= 0.25); } int WasWPROverSell() { return (ArrayMaxValue(gda_1332) >= 0.75); } int OpenOrder(int ai_0, double a_lots_4, string a_comment_12 = "") { int l_ticket_44; int li_56; int l_error_60; string ls_64; double l_price_72; double l_ord_lots_80; int l_datetime_88; int li_92; int l_pos_96; int l_datetime_100; double l_price_28 = 0; double l_price_36 = 0; double l_price_20 = PriceOpen(ai_0); l_price_36 = l_price_20 + FapTurbo_TakeProfit * gd_884 * ai_0; if (FapTurbo_StopLoss > 0.0) l_price_28 = PriceClose(ai_0) - FapTurbo_StopLoss * gd_884 * ai_0; int l_cmd_48 = DirectionOrderType(ai_0); int li_52 = gi_872; while (li_52 > 0) { l_ticket_44 = OrderSend(g_symbol_932, l_cmd_48, a_lots_4, l_price_20, g_slippage_880, 0, 0, a_comment_12, g_magic_836, 0, ColorOpen(ai_0)); Sleep(MathRand() / 1000); if (l_ticket_44 >= 0) { if (OrderSelect(l_ticket_44, SELECT_BY_TICKET)) l_price_20 = OrderOpenPrice(); if (SendEmail) { if (gi_808 == 0) { SendMail(gs_940, StringConcatenate("Fapturbo Trade Information\nCurrency Pair: ", StringSubstr(g_symbol_932, 0, 6), "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nOrder Type: ", OrderTypeToStr(l_cmd_48), "\nPrice: ", DoubleToStr(l_price_20, Digits), "\nLot size: ", DoubleToStr(a_lots_4, gi_832), "\nEvent: Trade Opened", "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } else { SendMail(gs_956, StringConcatenate("Fapturbo торговая информация\nВалютная пара: ", StringSubstr(g_symbol_932, 0, 6), "\nВремя: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nТип ордера: ", OrderTypeToStr(l_cmd_48), "\nЦена: ", DoubleToStr(l_price_20, Digits), "\nРазмер лота: ", DoubleToStr(a_lots_4, gi_832), "\nСобытие: открытие ордера", "\n\nТекущий баланс: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nТекущие средства: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } } if (SoundAlert) PlaySound(SoundFileAtOpen); li_56 = MarketInfo(g_symbol_932, MODE_STOPLEVEL) * Point; if (FapTurbo_TakeProfit * gd_884 > li_56 || FapTurbo_TakeProfit == 0.0) if (FapTurbo_StopLoss * gd_884 > li_56 || FapTurbo_StopLoss == 0.0) OrderModify(l_ticket_44, l_price_20, l_price_28, l_price_36, 0, Red); g_datetime_1204 = iTime(g_symbol_932, 0, 0); break; } l_error_60 = GetLastError(); if (WriteDebugLog) { if (l_cmd_48 == OP_BUY) ls_64 = "OP_BUY"; else ls_64 = "OP_SELL"; Print("Open: OrderSend(", ls_64, ") error = ", ErrorDescription(l_error_60)); } if (l_error_60 != 136/* OFF_QUOTES */) break; Sleep(6000); RefreshRates(); if (l_cmd_48 == OP_BUY) l_price_72 = Ask; else l_price_72 = Bid; if (NormalizeDouble(MathAbs((l_price_72 - l_price_20) / gd_884), 0) > gi_876) break; l_price_20 = l_price_72; li_52--; if (li_52 > 0) { if (gi_808 == 0) Print("... Possible to open order."); else Print("... Возможно открыть ордер."); } a_lots_4 = NormalizeDouble(a_lots_4 / 2.0, gi_832); if (a_lots_4 < g_minlot_900) a_lots_4 = g_minlot_900; } return (0); while (true) { if (OrderSelect(l_pos_96, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderMagicNumber() == g_magic_836) { if (OrderType() == OP_BUY) { if (OrderSymbol() == g_symbol_932) { l_datetime_100 = OrderOpenTime(); if (l_datetime_100 > l_datetime_88) { l_datetime_88 = l_datetime_100; l_ord_lots_80 = OrderLots(); } } } } l_pos_96++; if (l_pos_96 < li_92) continue; break; } return (l_ord_lots_80); } bool GetOrderByPos(int a_pos_0) { return (OrderSelect(a_pos_0, SELECT_BY_POS, MODE_TRADES) && OrderType() <= OP_SELL && OrderSymbol() == g_symbol_932); } void TrailOrderStop() { int li_0; double ld_4; double ld_12; double l_price_20; double ld_28; double ld_36; int li_44; int li_48; int l_pos_56; if (OrderTicket() > 0) { li_0 = OrderTypeDirection(); ld_4 = NormalizeDouble(FapTurbo_TrailingStop * gd_884 * li_0, gi_840); ld_12 = NormalizeDouble(iif(li_0 > 0 || OrderStopLoss() != 0.0, OrderStopLoss(), C'0x3F,0x42,0x0F'), gi_840); l_price_20 = NormalizeDouble(PriceClose(li_0) - ld_4, gi_840); ld_28 = NormalizeDouble(l_price_20 - OrderOpenPrice(), gi_840); ld_36 = NormalizeDouble(l_price_20 - ld_12, gi_840); if (ld_28 * li_0 > 0.0 && ld_36 * li_0 >= gd_884) { if (OrderType() == OP_BUY) li_44 = (Bid - l_price_20) / gd_884; else li_44 = (l_price_20 - Ask) / gd_884; if (li_44 > MarketInfo(g_symbol_932, MODE_STOPLEVEL) * Point) { while (!IsTradeAllowed()) Sleep(1000); OrderModify(OrderTicket(), OrderOpenPrice(), l_price_20, OrderTakeProfit(), 0, ColorOpen(li_0)); return; while (true) { if (OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderType() == OP_SELL) if (OrderSymbol() == g_symbol_932) li_48++; } } l_pos_56--; if (l_pos_56 >= 0) continue; break; } } } } } int OrderTypeDirection() { int li_ret_0 = 0; if (OrderType() == OP_BUY) li_ret_0 = 1; if (OrderType() == OP_SELL) li_ret_0 = -1; return (li_ret_0); } int DirectionOrderType(int ai_0) { return (iif(ai_0 > 0, 0, 1)); } int ColorOpen(int ai_0) { return (iif(ai_0 > 0, ColorBuy, ColorSell)); } double PriceOpen(int ai_0) { return (iif(ai_0 > 0, Ask, Bid)); } double PriceClose(int ai_0) { return (iif(ai_0 > 0, Bid, Ask)); } double iif(bool ai_0, double ad_4, double ad_12) { if (ai_0) return (ad_4); return (ad_12); } string ErrorDescription(int ai_0) { string ls_ret_4; int li_16; switch (ai_0) { case 0: case 1: ls_ret_4 = "no error"; break; case 2: ls_ret_4 = "common error"; break; case 3: ls_ret_4 = "invalid trade parameters"; break; case 4: ls_ret_4 = "trade server is busy"; break; case 5: ls_ret_4 = "old version of the client terminal"; break; case 6: ls_ret_4 = "no connection with trade server"; break; case 7: ls_ret_4 = "not enough rights"; break; case 8: ls_ret_4 = "too frequent requests"; break; case 9: ls_ret_4 = "malfunctional trade operation (never returned error)"; break; case 64: ls_ret_4 = "account disabled"; break; case 65: ls_ret_4 = "invalid account"; break; case 128: ls_ret_4 = "trade timeout"; break; case 129: ls_ret_4 = "invalid price"; break; case 130: ls_ret_4 = "invalid stops"; break; case 131: ls_ret_4 = "invalid trade volume"; break; case 132: ls_ret_4 = "market is closed"; break; case 133: ls_ret_4 = "trade is disabled"; break; case 134: ls_ret_4 = "not enough money"; break; case 135: ls_ret_4 = "price changed"; break; case 136: ls_ret_4 = "off quotes"; break; case 137: ls_ret_4 = "broker is busy (never returned error)"; break; case 138: ls_ret_4 = "requote"; break; case 139: ls_ret_4 = "order is locked"; break; case 140: ls_ret_4 = "long positions only allowed"; break; case 141: ls_ret_4 = "too many requests"; break; case 145: ls_ret_4 = "modification denied because order too close to market"; break; case 146: ls_ret_4 = "trade context is busy"; break; case 147: ls_ret_4 = "expirations are denied by broker"; break; case 148: ls_ret_4 = "amount of open and pending orders has reached the limit"; break; case 4000: ls_ret_4 = "no error (never generated code)"; break; case 4001: ls_ret_4 = "wrong function pointer"; break; case 4002: ls_ret_4 = "array index is out of range"; break; case 4003: ls_ret_4 = "no memory for function call stack"; break; case 4004: ls_ret_4 = "recursive stack overflow"; break; case 4005: ls_ret_4 = "not enough stack for parameter"; break; case 4006: ls_ret_4 = "no memory for parameter string"; break; case 4007: ls_ret_4 = "no memory for temp string"; break; case 4008: ls_ret_4 = "not initialized string"; break; case 4009: ls_ret_4 = "not initialized string in array"; break; case 4010: ls_ret_4 = "no memory for array\' string"; break; case 4011: ls_ret_4 = "too long string"; break; case 4012: ls_ret_4 = "remainder from zero divide"; break; case 4013: ls_ret_4 = "zero divide"; break; case 4014: ls_ret_4 = "unknown command"; break; case 4015: ls_ret_4 = "wrong jump (never generated error)"; break; case 4016: ls_ret_4 = "not initialized array"; break; case 4017: ls_ret_4 = "dll calls are not allowed"; break; case 4018: ls_ret_4 = "cannot load library"; break; case 4019: ls_ret_4 = "cannot call function"; break; case 4020: ls_ret_4 = "expert function calls are not allowed"; break; case 4021: ls_ret_4 = "not enough memory for temp string returned from function"; break; case 4022: ls_ret_4 = "system is busy (never generated error)"; break; case 4050: ls_ret_4 = "invalid function parameters count"; break; case 4051: ls_ret_4 = "invalid function parameter value"; break; case 4052: ls_ret_4 = "string function internal error"; break; case 4053: ls_ret_4 = "some array error"; break; case 4054: ls_ret_4 = "incorrect series array using"; break; case 4055: ls_ret_4 = "custom indicator error"; break; case 4056: ls_ret_4 = "arrays are incompatible"; break; case 4057: ls_ret_4 = "global variables processing error"; break; case 4058: ls_ret_4 = "global variable not found"; break; case 4059: ls_ret_4 = "function is not allowed in testing mode"; break; case 4060: ls_ret_4 = "function is not confirmed"; break; case 4061: ls_ret_4 = "send mail error"; break; case 4062: ls_ret_4 = "string parameter expected"; break; case 4063: ls_ret_4 = "integer parameter expected"; break; case 4064: ls_ret_4 = "double parameter expected"; break; case 4065: ls_ret_4 = "array as parameter expected"; break; case 4066: ls_ret_4 = "requested history data in update state"; break; case 4099: ls_ret_4 = "end of file"; break; case 4100: ls_ret_4 = "some file error"; break; case 4101: ls_ret_4 = "wrong file name"; break; case 4102: ls_ret_4 = "too many opened files"; break; case 4103: ls_ret_4 = "cannot open file"; break; case 4104: ls_ret_4 = "incompatible access to a file"; break; case 4105: ls_ret_4 = "no order selected"; break; case 4106: ls_ret_4 = "unknown symbol"; break; case 4107: ls_ret_4 = "invalid price parameter for trade function"; break; case 4108: ls_ret_4 = "invalid ticket"; break; case 4109: ls_ret_4 = "trade is not allowed in the expert properties"; break; case 4110: ls_ret_4 = "longs are not allowed in the expert properties"; break; case 4111: ls_ret_4 = "shorts are not allowed in the expert properties"; break; case 4200: ls_ret_4 = "object is already exist"; break; case 4201: ls_ret_4 = "unknown object property"; break; case 4202: ls_ret_4 = "object is not exist"; break; case 4203: ls_ret_4 = "unknown object type"; break; case 4204: ls_ret_4 = "no object name"; break; case 4205: ls_ret_4 = "object coordinates error"; break; case 4206: ls_ret_4 = "no specified subwindow"; break; default: ls_ret_4 = "unknown error"; } return (ls_ret_4); while (true) { if (!(Rule31(li_16))) break; li_16++; if (li_16 < FapTurbo_PrudentPeriod + 1) continue; break; } gi_1220 = FapTurbo_PrudentPeriod + 1 - li_16; if (gi_1220 == 0) return (-1); return (-1); } double ArrayMinValue(double ada_0[]) { return (ada_0[ArrayMinimum(ada_0)]); } double ArrayMaxValue(double ada_0[]) { return (ada_0[ArrayMaximum(ada_0)]); } bool Rule1(int ai_0) { if (FapTurbo_CriticalDays <= 0) return (TRUE); double l_ima_4 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMALarge + ai_0); double l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMALarge + ai_0); double l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMASmall + ai_0); double l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMASmall + ai_0); double ld_36 = (l_ima_4 - l_ima_12) / FapTurbo_LookForDays; double ld_44 = l_ima_4 + ld_36; double ld_52 = (l_ima_20 - l_ima_28) / FapTurbo_LookForDays; double ld_60 = l_ima_20 + ld_52; gi_1216 = (ld_60 - ld_44) / (ld_36 - ld_52); if (gi_1216 > 0 && gi_1216 < FapTurbo_CriticalDays) return (FALSE); return (TRUE); if (FapTurbo_RelaxDays <= 0 || FapTurbo_Prudent == 0) { } for (ai_0 = 1; ai_0 < FapTurbo_RelaxDays + 1; ai_0++) if (!(Rule2(ai_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - ai_0; if (gi_1220 == 0) return (TRUE); return (FALSE); } bool Rule2(int ai_0) { double l_ima_4 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMASmall + ai_0); double l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0); double l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMALarge + ai_0); double l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0); if ((l_ima_20 > l_ima_28 && l_ima_4 < l_ima_12) || (l_ima_20 < l_ima_28 && l_ima_4 > l_ima_12)) return (FALSE); return (TRUE); if (FapTurbo_RelaxDays <= 0) { } for (ai_0 = 1; ai_0 < FapTurbo_RelaxDays + 1; ai_0++) if (!(Rule1(ai_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - ai_0; if (gi_1220 == 0) return (TRUE); return (FALSE); } bool Rule3(int ai_0) { if (FapTurbo_TooGoodToBeTrue <= 0) return (TRUE); gi_1220 = 0; double l_ima_4 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0 + 1), gi_840); double l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0), gi_840); double l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0 + 1), gi_840); double l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0), gi_840); bool li_ret_36 = TRUE; if (l_ima_4 > l_ima_12 && l_ima_20 > l_ima_28) { for (int li_40 = ai_0; li_40 < Bars; li_40++) { l_ima_4 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1), gi_840); l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40), gi_840); l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1), gi_840); l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40), gi_840); if (l_ima_4 < l_ima_12 || l_ima_20 < l_ima_28) break; } gi_1220 = ai_0 + li_40; } else { if (l_ima_4 < l_ima_12 && l_ima_20 < l_ima_28) { for (li_40 = ai_0; li_40 < Bars; li_40++) { l_ima_4 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1), gi_840); l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40), gi_840); l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1), gi_840); l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40), gi_840); if (l_ima_4 > l_ima_12 || l_ima_20 > l_ima_28) break; } gi_1220 = ai_0 + li_40; } else return (li_ret_36); } if (FapTurbo_TooGoodToBeTrue <= gi_1220) li_ret_36 = FALSE; return (li_ret_36); if (FapTurbo_TooGoodToBeTrue <= 0) { } li_ret_36 = TRUE; for (li_40 = ai_0; li_40 < FapTurbo_TooGoodToBeTrue + ai_0; li_40++) { l_ima_4 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1); l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40); l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40 + 1); l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_40); if ((l_ima_4 > l_ima_12 && l_ima_20 < l_ima_28) || (l_ima_4 < l_ima_12 && l_ima_20 > l_ima_28)) li_ret_36 = FALSE; } if (li_ret_36) return (FALSE); return (TRUE); } int Rule31(int ai_0) { double l_ima_12; double l_ima_20; double l_ima_28; double l_ima_36; if (FapTurbo_TooGoodToBeTrue <= 0) return (1); bool li_ret_4 = TRUE; for (int li_8 = ai_0; li_8 < FapTurbo_TooGoodToBeTrue + ai_0; li_8++) { l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1); l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8); l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1); l_ima_36 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8); if ((l_ima_12 > l_ima_20 && l_ima_28 < l_ima_36) || (l_ima_12 < l_ima_20 && l_ima_28 > l_ima_36)) li_ret_4 = FALSE; } if (li_ret_4) return (0); return (1); if (FapTurbo_TooGoodToBeTrue <= 0) { } gi_1220 = 0; l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0 + 1), gi_840); l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0), gi_840); l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0 + 1), gi_840); l_ima_36 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, ai_0), gi_840); li_ret_4 = TRUE; if (l_ima_12 > l_ima_20 && l_ima_28 > l_ima_36) { for (li_8 = ai_0; li_8 < Bars; li_8++) { l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1), gi_840); l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8), gi_840); l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1), gi_840); l_ima_36 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8), gi_840); if (l_ima_12 < l_ima_20 || l_ima_28 < l_ima_36) break; } gi_1220 = ai_0 + li_8; } else { if (l_ima_12 < l_ima_20 && l_ima_28 < l_ima_36) { for (li_8 = ai_0; li_8 < Bars; li_8++) { l_ima_12 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1), gi_840); l_ima_20 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8), gi_840); l_ima_28 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1), gi_840); l_ima_36 = NormalizeDouble(iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8), gi_840); if (l_ima_12 > l_ima_20 || l_ima_28 > l_ima_36) break; } gi_1220 = ai_0 + li_8; } else return (li_ret_4); } if (FapTurbo_TooGoodToBeTrue <= gi_1220) li_ret_4 = FALSE; return (li_ret_4); if (FapTurbo_TooGoodToBeTrue <= 0) { } li_ret_4 = TRUE; for (li_8 = ai_0; li_8 < FapTurbo_TooGoodToBeTrue + ai_0; li_8++) { l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1); l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8); l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8 + 1); l_ima_36 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_8); if ((l_ima_12 > l_ima_20 && l_ima_28 < l_ima_36) || (l_ima_12 < l_ima_20 && l_ima_28 > l_ima_36)) li_ret_4 = FALSE; } if (li_ret_4) return (0); return (1); } bool Relax1() { if (FapTurbo_RelaxDays <= 0) return (TRUE); for (int li_0 = 1; li_0 < FapTurbo_RelaxDays + 1; li_0++) if (!(Rule1(li_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - li_0; if (gi_1220 == 0) return (TRUE); return (FALSE); double l_ima_4 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMASmall + li_0); double l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_0); double l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMALarge + li_0); double l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, li_0); if ((l_ima_20 > l_ima_28 && l_ima_4 < l_ima_12) || (l_ima_20 < l_ima_28 && l_ima_4 > l_ima_12)) { } return (TRUE); if (FapTurbo_RelaxDays <= 0) { } for (li_0 = 1; li_0 < FapTurbo_RelaxDays + 1; li_0++) if (!(Rule1(li_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - li_0; if (gi_1220 == 0) return (TRUE); return (FALSE); } bool Relax2() { if (FapTurbo_RelaxDays <= 0 || FapTurbo_Prudent == 0) return (TRUE); for (int li_0 = 1; li_0 < FapTurbo_RelaxDays + 1; li_0++) if (!(Rule2(li_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - li_0; if (gi_1220 == 0) return (TRUE); return (FALSE); if (FapTurbo_CriticalDays <= 0) { } double l_ima_4 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMALarge + li_0); double l_ima_12 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMALarge, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMALarge + li_0); double l_ima_20 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_ShiftMASmall + li_0); double l_ima_28 = iMA(NULL, PERIOD_D1, FapTurbo_PeriodMASmall, 0, FapTurbo_TypeMA_0_3, FapTurbo_PriceMA_0_6, FapTurbo_LookForDays + FapTurbo_ShiftMASmall + li_0); double ld_36 = (l_ima_4 - l_ima_12) / FapTurbo_LookForDays; double ld_44 = l_ima_4 + ld_36; double ld_52 = (l_ima_20 - l_ima_28) / FapTurbo_LookForDays; double ld_60 = l_ima_20 + ld_52; gi_1216 = (ld_60 - ld_44) / (ld_36 - ld_52); if (gi_1216 > 0 && gi_1216 < FapTurbo_CriticalDays) return (FALSE); return (TRUE); if (FapTurbo_RelaxDays <= 0 || FapTurbo_Prudent == 0) { } for (li_0 = 1; li_0 < FapTurbo_RelaxDays + 1; li_0++) if (!(Rule2(li_0))) break; gi_1220 = FapTurbo_RelaxDays + 1 - li_0; if (gi_1220 == 0) return (TRUE); return (FALSE); } bool Relax3() { int li_4; double l_price_24; int li_ret_52; if (FapTurbo_TooGoodToBeTrue <= 0) return (TRUE); if (FapTurbo_PrudentPeriod <= 0) return (TRUE); for (int l_pos_0 = 1; l_pos_0 < FapTurbo_PrudentPeriod + 1; l_pos_0++) if (!(Rule31(l_pos_0))) break; gi_1220 = FapTurbo_PrudentPeriod + 1 - l_pos_0; if (gi_1220 == 0) return (TRUE); return (FALSE); while (true) { Sleep(1000); if (!(IsTradeAllowed())) continue; break; } OrderModify(OrderTicket(), OrderOpenPrice(), l_price_24, OrderTakeProfit(), 0, ColorOpen(li_4)); return (FALSE); while (true) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderType() == OP_BUYLIMIT) if (OrderSymbol() == g_symbol_932) li_ret_52++; } } l_pos_0--; if (l_pos_0 >= 0) continue; break; } return (li_ret_52); } void PrintDebugLog() { Print("lastMALarge = ", g_ima_1288, ", prevMALarge = ", g_ima_1280, ", farMALarge = ", g_ima_1312); Print("lastMASmall = ", g_ima_1304, ", prevMASmall = ", g_ima_1296, ", farMASmall = ", g_ima_1320); } int HavePositions(int a_cmd_0) { int l_count_4 = 0; int li_8 = OrdersTotal() - 1; for (int l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderType() == a_cmd_0) if (OrderSymbol() == g_symbol_932) l_count_4++; } } } return (l_count_4); } double OpenPosVol(int a_cmd_0) { int l_datetime_24; int li_40; int l_datetime_52; int l_datetime_56; double l_ord_lots_4 = 0; int l_datetime_12 = -2147483648; int li_16 = OrdersTotal(); for (int l_pos_20 = 0; l_pos_20 < li_16; l_pos_20++) { if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderMagicNumber() == g_magic_836) { if (OrderType() == a_cmd_0) { if (OrderSymbol() == g_symbol_932) { l_datetime_24 = OrderOpenTime(); if (l_datetime_24 > l_datetime_12) { l_datetime_12 = l_datetime_24; l_ord_lots_4 = OrderLots(); } } } } } return (l_ord_lots_4); while (true) { if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_56 = OrderOpenTime(); if (l_datetime_52 < l_datetime_56) l_datetime_52 = l_datetime_56; } } } l_pos_20--; if (l_pos_20 >= 0) continue; break; } if (l_datetime_52 >= li_40) return (1); li_16 = OrdersHistoryTotal() - 1; l_datetime_52 = -2147483648; for (l_pos_20 = li_16; l_pos_20 >= 0; l_pos_20--) { if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_56 = OrderOpenTime(); if (l_datetime_52 < l_datetime_56) l_datetime_52 = l_datetime_56; } } } } if (l_datetime_52 >= li_40) return (1); return (0); } bool IsTradeTime(int ai_0) { int li_12; int li_16; int li_20; double ld_24; double ld_32; double ld_40; int l_hour_4 = TimeHour(ai_0); int l_minute_8 = TimeMinute(ai_0); if (FapTurbo_StartWorkTimeHour == FapTurbo_EndWorkTimeHour && FapTurbo_StartWorkTimeMin == FapTurbo_EndWorkTimeMin) return (TRUE); if (FapTurbo_EndWorkTimeMin == 0) { if (FapTurbo_EndWorkTimeHour == 0) li_12 = 23; else li_12 = FapTurbo_EndWorkTimeHour - 1; li_16 = 59; } else { li_12 = FapTurbo_EndWorkTimeHour; li_16 = FapTurbo_EndWorkTimeMin - 1; } if (FapTurbo_StartWorkTimeHour == li_12) { if (FapTurbo_StartWorkTimeMin == li_16) return (TRUE); if (FapTurbo_StartWorkTimeMin < li_16) { if (l_hour_4 != FapTurbo_StartWorkTimeHour) return (FALSE); if (l_minute_8 < FapTurbo_StartWorkTimeMin || l_minute_8 > li_16) return (FALSE); return (TRUE); } if (FapTurbo_StartWorkTimeMin > li_16) { if (l_hour_4 == FapTurbo_StartWorkTimeHour) if (l_minute_8 < FapTurbo_StartWorkTimeMin && l_minute_8 > li_16) return (FALSE); return (TRUE); } } if (FapTurbo_StartWorkTimeHour < li_12) { if (l_hour_4 < FapTurbo_StartWorkTimeHour || l_hour_4 > li_12) return (FALSE); if (l_hour_4 == FapTurbo_StartWorkTimeHour && l_minute_8 < FapTurbo_StartWorkTimeMin) return (FALSE); if (l_hour_4 == li_12 && l_minute_8 > li_16) return (FALSE); return (TRUE); } if (FapTurbo_StartWorkTimeHour > li_12) { if (l_hour_4 < FapTurbo_StartWorkTimeHour && l_hour_4 > li_12) return (FALSE); if (l_hour_4 == FapTurbo_StartWorkTimeHour && l_minute_8 < FapTurbo_StartWorkTimeMin) return (FALSE); if (l_hour_4 == li_12 && l_minute_8 > li_16) return (FALSE); return (TRUE); } return (TRUE); while (true) { ld_24 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_20), gi_840); ld_32 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_20 + gi_780), gi_840); ld_40 = 100.0 * MathAbs(ld_24 - ld_32) / ld_32; if (ld_40 > gd_1092) break; li_20++; if (li_20 <= gi_784) continue; break; } if (li_20 > gi_784) return (FALSE); if (WriteDebugLog) { if (gi_808 == 0) Print("Today market is in risky conditions. Trading is forbidden by the filter TrendFilter."); else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром TrendFilter."); if (li_20 != 0) { if (gi_808 == 0) Print("Relax Bars Left = " + DoubleToStr(gi_784 - li_20, 0) + " (after MaxPercentMove)."); else Print("Осталось Relax баров = " + DoubleToStr(gi_784 - li_20, 0) + " (после MaxPercentMove)."); } } return (TRUE); } bool HaveTrade() { int l_datetime_28; if (FapTurbo_StartWorkTimeHour == FapTurbo_EndWorkTimeHour && FapTurbo_StartWorkTimeMin == FapTurbo_EndWorkTimeMin) return (FALSE); int l_datetime_0 = TimeCurrent(); int li_4 = iTime(NULL, PERIOD_D1, 0); int l_hour_8 = TimeHour(l_datetime_0); bool li_12 = FALSE; if (FapTurbo_StartWorkTimeHour > FapTurbo_EndWorkTimeHour) { if (l_hour_8 < FapTurbo_StartWorkTimeHour) li_12 = TRUE; } else { if (FapTurbo_StartWorkTimeHour == FapTurbo_EndWorkTimeHour) { if (FapTurbo_StartWorkTimeMin > FapTurbo_EndWorkTimeMin) { if (l_hour_8 < FapTurbo_StartWorkTimeHour) { if (l_hour_8 < FapTurbo_StartWorkTimeHour) li_12 = TRUE; } else { if (l_hour_8 == FapTurbo_StartWorkTimeHour) if (TimeMinute(l_datetime_0) < FapTurbo_EndWorkTimeMin) li_12 = TRUE; } } } } if (li_12) li_4 -= 86400; li_4 += 3600 * FapTurbo_StartWorkTimeHour + 60 * FapTurbo_StartWorkTimeMin; int li_16 = OrdersTotal() - 1; int l_datetime_20 = -2147483648; for (int l_pos_24 = li_16; l_pos_24 >= 0; l_pos_24--) { if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_28 = OrderOpenTime(); if (l_datetime_20 < l_datetime_28) l_datetime_20 = l_datetime_28; } } } } if (l_datetime_20 >= li_4) return (TRUE); li_16 = OrdersHistoryTotal() - 1; l_datetime_20 = -2147483648; for (l_pos_24 = li_16; l_pos_24 >= 0; l_pos_24--) { if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_28 = OrderOpenTime(); if (l_datetime_20 < l_datetime_28) l_datetime_20 = l_datetime_28; } } } } if (l_datetime_20 >= li_4) return (TRUE); return (FALSE); } void Scalper() { double ld_8; int l_day_of_week_16; double l_irsi_20; double l_irsi_28; double l_ima_36; int li_44; int l_count_48; double l_ima_52; double ld_60; double ld_68; double ld_76; double ld_84; double ld_92; double ld_100; int l_pos_108; int l_ticket_112; int l_ord_total_116; g_datetime_984 = TimeCurrent(); string l_str_concat_0 = ""; if (Scalper_ProfitLimit > 0.0 || Scalper_LossLimit > 0.0) { if (gi_124 != gi_128) { ld_8 = CalculateProfitSession(); if (gi_808 == 0) { l_str_concat_0 = StringConcatenate("Current Profit: ", DoubleToStr(ld_8, 2), " ", AccountCurrency(), "\n"); } else { l_str_concat_0 = StringConcatenate("Текущая прибыль: ", DoubleToStr(ld_8, 2), " ", AccountCurrency(), "\n"); } if (Scalper_ProfitLimit > 0.0) { if (gi_808 == 0) { l_str_concat_0 = StringConcatenate(l_str_concat_0, "Profit Limit: ", DoubleToStr(Scalper_ProfitLimit, 2), " ", AccountCurrency(), "\n"); } else { l_str_concat_0 = StringConcatenate(l_str_concat_0, "Ограничение прибыли: ", DoubleToStr(Scalper_ProfitLimit, 2), " ", AccountCurrency(), "\n"); } } if (Scalper_LossLimit > 0.0) { if (gi_808 == 0) { l_str_concat_0 = StringConcatenate(l_str_concat_0, "Loss Limit: ", DoubleToStr(-1.0 * Scalper_LossLimit, 2), " ", AccountCurrency(), "\n"); } else { l_str_concat_0 = StringConcatenate(l_str_concat_0, "Ограничение убытка: ", DoubleToStr(-1.0 * Scalper_LossLimit, 2), " ", AccountCurrency(), "\n"); } } } } if (PrintLogOnChart) { if (gi_808 == 0) { Comment("" + "\n" + "Scalper" + "\n" + "Current Spread: " + DoubleToStr(MarketInfo(g_symbol_932, MODE_SPREAD) / MathPow(10, Digits - gi_840), Digits - gi_840) + "\n" + "MaxSpread: " + DoubleToStr(Scalper_MaxSpread, Digits - gi_840) + "\n" + l_str_concat_0 + "------------------------------------------------" + "\n" + "BROKER INFORMATION:" + "\n" + "Broker Company: " + AccountCompany() + "\n" + "------------------------------------------------" + "\n" + "ACCOUNT INFORMATION:" + "\n" + "Account Name: " + AccountName() + "\n" + "Account Number: " + AccountNumber() + "\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" + "Actual Server Time: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + "\n" + "Licensed Till: " + TimeToStr(gia_848[0], TIME_DATE) + "\n" + "------------------------------------------------"); } else { Comment("" + "\n" + "Scalper" + "\n" + "Текущий спред: " + DoubleToStr(MarketInfo(g_symbol_932, MODE_SPREAD) / MathPow(10, Digits - gi_840), Digits - gi_840) + "\n" + "MaxSpread: " + DoubleToStr(Scalper_MaxSpread, Digits - gi_840) + "\n" + l_str_concat_0 + "------------------------------------------------" + "\n" + "Информация о брокере:" + "\n" + "Брокерская компания: " + AccountCompany() + "\n" + "------------------------------------------------" + "\n" + "Информация о счёте:" + "\n" + "Название счёта: " + AccountName() + "\n" + "Номер счёта: " + AccountNumber() + "\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" + "------------------------------------------------" + "\n" + "Текущее время сервера: " + TimeToStr(TimeCurrent(), TIME_SECONDS) + "\n" + "Лицензия до: " + TimeToStr(gia_848[0], TIME_DATE) + "\n" + "------------------------------------------------"); } } if (Scalper_StealthMode) WatchLevels(); if (Scalper_UseCustomLevels) NoiseFilter(); SetOrderLevels(); if (gi_124 != gi_128) { if (Scalper_ProfitLimit > 0.0) { if (ld_8 >= Scalper_ProfitLimit) { CloseAllSymbols(); return; } } if (Scalper_LossLimit > 0.0) { if (ld_8 <= -1.0 * Scalper_LossLimit) { CloseAllSymbols(); return; } } } if (gi_824 == 0) { if (NormalizeDouble(Ask - Bid, Digits) > gd_1156) { if (WriteLog && !gi_972) { if (gi_808 == 0) { Print("Trade signal is missed due to invalid high spread."); Print("Current spread = ", DoubleToStr(NormalizeDouble(Ask - Bid, Digits), Digits), ", MaxSpread = ", DoubleToStr(gd_1156, Digits)); Print("Fapturbo will try again later when spreads come to normal."); } else { Print("Торговый сигнал пропущен из-за большого спреда."); Print("Текущий спред = ", DoubleToStr(NormalizeDouble(Ask - Bid, Digits), Digits), ", MaxSpread = ", DoubleToStr(gd_1156, Digits)); Print("Fapturbo будет пробовать позже, когда спред станет допустимым."); } } gi_972 = TRUE; } else { gi_972 = FALSE; l_day_of_week_16 = TimeDayOfWeek(g_datetime_984 - 3600 * Scalper_GMTOffset); if (l_day_of_week_16 == 0 || l_day_of_week_16 > 5) return; if (!Scalper_TradeFriday) if (l_day_of_week_16 >= 5) return; if (l_day_of_week_16 == 1 && TimeHour(g_datetime_984 - 3600 * Scalper_GMTOffset) < gi_124) return; if (Scalper_IsTradeTime()) { if (Scalper_RelaxHours > 0) if (Scalper_IsRelaxHours()) return; if (Scalper_SimpleHeightFilter) if (Scalper_CheckSimpleHeightFilter()) return; if (Scalper_TrendFilter) if (Scalper_CheckTrendFilter()) return; if (Scalper_OneTrade != 0) { if (Scalper_HaveTrade()) { if (!(WriteDebugLog)) return; if (gi_808 == 0) { Print("Already have one trade inside this interval of time."); return; } Print("Уже есть одна сделка внутри этого интервала времени."); return; } } if (Scalper_OneOpenTrade) { if (HaveAllOrders() > 0) { if (!(WriteDebugLog)) return; if (gi_808 == 0) { Print("Already have open order with MagicNumber = ", g_magic_836); return; } Print("Уже есть один ордер с MagicNumber = ", g_magic_836); return; } } HideTestIndicators(TRUE); l_irsi_20 = iRSI(NULL, 0, g_period_748, PRICE_CLOSE, 0); l_irsi_28 = iRSI(NULL, PERIOD_M1, g_period_756, PRICE_CLOSE, 0); l_ima_36 = iMA(NULL, 0, g_period_744, 0, MODE_SMA, PRICE_MEDIAN, 1); HideTestIndicators(FALSE); li_44 = fun2(Ask + 0.0002, ExistPosition(), l_irsi_20, l_irsi_28, gi_760, gi_752, l_ima_36, g_acc_number_852, g_acc_number_852, gia_856, gia_860, gia_864, g_datetime_984, gia_868, gia_844, g_bool_828, gia_848); if (li_44 == 16) gi_816 = FALSE; else { if (li_44 == 32) gi_824 = TRUE; else { if (li_44 == 1) { if (gi_976) { if (!Scalper_UseFilterMA) l_count_48 = 0; else { l_ima_52 = iMA(NULL, 0, Scalper_PeriodFilterMA, 0, Scalper_MethodFilterMA, Scalper_PriceFilterMA, 0); if (Close[0] <= l_ima_52) l_count_48++; } if (l_count_48 == 0) { OpenPosition(OP_BUY, gi_1012, gi_1016); gi_976 = FALSE; gi_980 = TRUE; } } } li_44 = fun3(Bid - 0.0002, ExistPosition(), l_irsi_20, l_irsi_28, gi_1000, gi_996, l_ima_36, g_acc_number_852, g_acc_number_852, gia_856, gia_860, gia_864, g_datetime_984, gia_868, gia_844, g_bool_828, gia_848); if (li_44 == 16) gi_816 = FALSE; else { if (li_44 == 32) gi_824 = TRUE; else { if (li_44 == 1) { if (gi_980) { if (!Scalper_UseFilterMA) l_count_48 = 0; else { l_ima_52 = iMA(NULL, 0, Scalper_PeriodFilterMA, 0, Scalper_MethodFilterMA, Scalper_PriceFilterMA, 0); if (Close[0] >= l_ima_52) l_count_48++; } if (l_count_48 == 0) { OpenPosition(OP_SELL, gi_1012, gi_1016); gi_980 = FALSE; gi_976 = TRUE; } } } if (fun4(l_irsi_20, gi_1004, gi_1008)) { gi_980 = TRUE; gi_976 = TRUE; return; while (true) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } } } } else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_pos_108++; if (l_pos_108 < l_ord_total_116) continue; break; } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_752 * Point && ld_92 < ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_108 = 0; l_pos_108 < l_ord_total_116; l_pos_108++) { OrderSelect(l_pos_108, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_60 > 0.0 && ld_60 < ld_76 && ld_68 > ld_84 && ld_60 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_60 < 0.0 && ld_60 > ld_76 && ld_68 < ld_84 && MathAbs(ld_60) > gi_752 * Point && ld_92 > ld_100) { l_ticket_112 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_112 > 0) { if (OrderSelect(l_ticket_112, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } } } } } } } } } } } } } } } } } } } } } bool Scalper_IsRelaxHours() { int l_datetime_16; bool li_20; double ld_24; double ld_32; double ld_40; int l_datetime_52; double ld_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; int l_pos_104; int l_ticket_0 = -1; int li_4 = OrdersHistoryTotal() - 1; int l_datetime_8 = -2147483648; for (int l_pos_12 = li_4; l_pos_12 >= 0; l_pos_12--) { if (OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_16 = OrderCloseTime(); if (l_datetime_8 < l_datetime_16) { l_datetime_8 = l_datetime_16; l_ticket_0 = OrderTicket(); } } } } } if (l_ticket_0 < 0) return (FALSE); if (OrderSelect(l_ticket_0, SELECT_BY_TICKET)) { li_20 = FALSE; ld_24 = NormalizeDouble(OrderOpenPrice(), gi_840); ld_32 = NormalizeDouble(OrderClosePrice(), gi_840); ld_40 = NormalizeDouble(OrderStopLoss(), gi_840); if (OrderType() == OP_BUY) { if (ld_32 <= ld_40 && ld_40 != 0.0) li_20 = TRUE; else if (ld_24 - ld_32 >= gd_1164) li_20 = TRUE; } else { if (ld_32 >= ld_40 && ld_40 != 0.0) li_20 = TRUE; else if (ld_32 - ld_24 >= gd_1164) li_20 = TRUE; } } else return (FALSE); if (!li_20) return (FALSE); int l_shift_48 = iBarShift(NULL, PERIOD_H1, l_datetime_8, FALSE); if (l_shift_48 < Scalper_RelaxHours) { l_datetime_52 = iTime(NULL, PERIOD_H1, 0); if (g_datetime_992 != l_datetime_52) { if (WriteLog) { if (gi_808 == 0) Print("Relax Hours Left = " + DoubleToStr(l_shift_48 - Scalper_RelaxHours, 0) + " (after StopLoss)."); else Print("Осталось Relax часов = " + DoubleToStr(l_shift_48 - Scalper_RelaxHours, 0) + " (после StopLoss)."); } g_datetime_992 = l_datetime_52; } return (TRUE); } return (FALSE); while (true) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } } } } else { if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_pos_104++; if (l_pos_104 < li_4) continue; break; } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_752 * Point && ld_88 < ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_104 = 0; l_pos_104 < li_4; l_pos_104++) { OrderSelect(l_pos_104, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_56 > 0.0 && ld_56 < ld_72 && ld_64 > ld_80 && ld_56 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_56 < 0.0 && ld_56 > ld_72 && ld_64 < ld_80 && MathAbs(ld_56) > gi_752 * Point && ld_88 > ld_96) { l_ticket_0 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_0 > 0) { if (OrderSelect(l_ticket_0, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } return (FALSE); } return (FALSE); } bool Scalper_CheckTrendFilter() { double ld_4; double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; double ld_60; double ld_68; int l_pos_76; int l_ticket_80; int l_ord_total_84; if (gi_780 <= 0) return (FALSE); for (int li_0 = 0; li_0 <= gi_784; li_0++) { ld_4 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_0), gi_840); ld_12 = NormalizeDouble(iMA(NULL, 0, g_period_768, 0, g_ma_method_776, g_applied_price_772, li_0 + gi_780), gi_840); ld_20 = 100.0 * MathAbs(ld_4 - ld_12) / ld_12; if (ld_20 > gd_1092) break; } if (li_0 > gi_784) return (FALSE); if (WriteDebugLog) { if (gi_808 == 0) Print("Today market is in risky conditions. Trading is forbidden by the filter TrendFilter."); else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром TrendFilter."); if (li_0 != 0) { if (gi_808 == 0) Print("Relax Bars Left = " + DoubleToStr(gi_784 - li_0, 0) + " (after MaxPercentMove)."); else Print("Осталось Relax баров = " + DoubleToStr(gi_784 - li_0, 0) + " (после MaxPercentMove)."); } } return (TRUE); while (true) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } } } } else { if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_pos_76++; if (l_pos_76 < l_ord_total_84) continue; break; } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_752 * Point && ld_60 < ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_76 = 0; l_pos_76 < l_ord_total_84; l_pos_76++) { OrderSelect(l_pos_76, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_28 > 0.0 && ld_28 < ld_44 && ld_36 > ld_52 && ld_28 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_84 = OrdersTotal(); if (l_ord_total_84 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_28 < 0.0 && ld_28 > ld_44 && ld_36 < ld_52 && MathAbs(ld_28) > gi_752 * Point && ld_60 > ld_68) { l_ticket_80 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_80 > 0) { if (OrderSelect(l_ticket_80, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } return (FALSE); } return (FALSE); } bool Scalper_CheckSimpleHeightFilter() { int l_datetime_4; double ld_8; double ld_16; double ld_24; double ld_32; double ld_40; double ld_48; int l_pos_56; int l_ticket_60; int l_ord_total_64; bool li_0 = FALSE; if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 1) - iLow(NULL, PERIOD_M15, 1), gi_840) > gd_1172) li_0 = TRUE; if (NormalizeDouble(iHigh(NULL, PERIOD_M15, 2) - iLow(NULL, PERIOD_M15, 2), gi_840) > gd_1172) li_0 = TRUE; if (li_0) { l_datetime_4 = iTime(NULL, PERIOD_M15, 0); if (g_datetime_988 != l_datetime_4) { if (WriteLog) { if (gi_808 == 0) Print("Today market is in risky conditions. Trade is forbidden by the filter SimpleHeightFilter."); else Print("Сегодня рынок в опасном состоянии. Торговля запрещена фильтром SimpleHeightFilter."); } g_datetime_988 = l_datetime_4; } return (TRUE); } return (FALSE); while (true) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } } } } else { if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_pos_56++; if (l_pos_56 < l_ord_total_64) continue; break; } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_56 = 0; l_pos_56 < l_ord_total_64; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_ord_total_64 = OrdersTotal(); if (l_ord_total_64 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } return (FALSE); } return (FALSE); } int Scalper_IsTradeTime() { double ld_4; double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; int l_pos_52; int l_ticket_56; int l_ord_total_60; int l_hour_0 = TimeHour(g_datetime_984); if (gi_1084 < gi_1088 && l_hour_0 < gi_1084 || l_hour_0 >= gi_1088) return (0); if (gi_1084 > gi_1088 && (l_hour_0 < gi_1084 && l_hour_0 >= gi_1088)) return (0); if (gi_1088 == 0) gi_1088 = 24; if (Hour() == gi_1088 - 1 && Minute() >= gi_740) return (0); return (1); while (true) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_52++; if (l_pos_52 < l_ord_total_60) continue; break; } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_752 * Point && ld_36 < ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_52 = 0; l_pos_52 < l_ord_total_60; l_pos_52++) { OrderSelect(l_pos_52, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_4 > 0.0 && ld_4 < ld_20 && ld_12 > ld_28 && ld_4 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_60 = OrdersTotal(); if (l_ord_total_60 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_4 < 0.0 && ld_4 > ld_20 && ld_12 < ld_28 && MathAbs(ld_4) > gi_752 * Point && ld_36 > ld_44) { l_ticket_56 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_56 > 0) { if (OrderSelect(l_ticket_56, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); } int ExistPosition() { double ld_8; double ld_16; double ld_24; double ld_32; double ld_40; double ld_48; int l_pos_56; int l_ticket_60; int li_0 = OrdersTotal() - 1; for (int l_pos_4 = li_0; l_pos_4 >= 0; l_pos_4--) { if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) if (OrderType() <= OP_SELL) return (1); } } } return (0); while (true) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_56++; if (l_pos_56 < li_0) continue; break; } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_752 * Point && ld_40 < ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_56 = 0; l_pos_56 < li_0; l_pos_56++) { OrderSelect(l_pos_56, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_8 > 0.0 && ld_8 < ld_24 && ld_16 > ld_32 && ld_8 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_0 = OrdersTotal(); if (li_0 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_8 < 0.0 && ld_8 > ld_24 && ld_16 < ld_32 && MathAbs(ld_8) > gi_752 * Point && ld_40 > ld_48) { l_ticket_60 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_60 > 0) { if (OrderSelect(l_ticket_60, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); } int OpenPosition(int a_cmd_0, int ai_unused_4, int ai_unused_8) { int li_12; double l_price_24; color l_color_32; int l_ticket_40; int l_error_44; string ls_48; double l_price_56; double ld_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; int l_pos_112; int l_ord_total_116; if (gi_240 > 0) { MathSrand(TimeLocal()); li_12 = MathRand() % gi_240; if (WriteDebugLog) { if (gi_808 == 0) Print("DelayRandomiser: delay ", li_12, " seconds."); else Print("DelayRandomiser: задержка ", li_12, " секунд."); } Sleep(1000 * li_12); } double ld_16 = LotsOptimized(); if (AccountFreeMarginCheck(g_symbol_932, a_cmd_0, ld_16) <= 0.0 || GetLastError() == 134/* NOT_ENOUGH_MONEY */) { if (gi_808 == 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) { l_price_24 = Ask; l_color_32 = ColorBuy; } else { l_price_24 = Bid; l_color_32 = ColorSell; } int li_36 = gi_872; while (li_36 > 0) { l_ticket_40 = OrderSend(g_symbol_932, a_cmd_0, ld_16, l_price_24, g_slippage_880, 0, 0, Scalper_ExpertComment, g_magic_836, 0, l_color_32); Sleep(MathRand() / 1000); if (l_ticket_40 < 0) { l_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 = ", ErrorDescription(l_error_44)); } if (l_error_44 != 136/* OFF_QUOTES */) break; if (!(gi_804)) break; Sleep(6000); RefreshRates(); if (a_cmd_0 == OP_BUY) l_price_56 = Ask; else l_price_56 = Bid; if (NormalizeDouble(MathAbs((l_price_56 - l_price_24) / gd_884), 0) > gi_876) break; l_price_24 = l_price_56; li_36--; if (li_36 > 0) { if (gi_808 == 0) Print("... Possible to open order."); else Print("... Возможно открыть ордер."); } ld_16 = NormalizeDouble(ld_16 / 2.0, gi_832); if (ld_16 < g_minlot_900) ld_16 = g_minlot_900; } else { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET)) l_price_24 = OrderOpenPrice(); if (SendEmail) { if (gi_808 == 0) { SendMail(gs_940, StringConcatenate("Fapturbo Trade Information\nCurrency Pair: ", StringSubstr(g_symbol_932, 0, 6), "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nOrder Type: ", OrderTypeToStr(a_cmd_0), "\nPrice: ", DoubleToStr(l_price_24, Digits), "\nLot size: ", DoubleToStr(ld_16, gi_832), "\nEvent: Trade Opened", "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } else { SendMail(gs_956, StringConcatenate("Fapturbo торговая информация\nВалютная пара: ", StringSubstr(g_symbol_932, 0, 6), "\nВремя: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nТип ордера: ", OrderTypeToStr(a_cmd_0), "\nЦена: ", DoubleToStr(l_price_24, Digits), "\nРазмер лота: ", DoubleToStr(ld_16, gi_832), "\nСобытие: открытие ордера", "\n\nТекущий баланс: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nТекущие средства: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } } if (!(SoundAlert)) break; PlaySound(SoundFileAtOpen); break; } } return (l_ticket_40); while (true) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_112++; if (l_pos_112 < l_ord_total_116) continue; break; } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_752 * Point && ld_96 < ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_112 = 0; l_pos_112 < l_ord_total_116; l_pos_112++) { OrderSelect(l_pos_112, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_64 > 0.0 && ld_64 < ld_80 && ld_72 > ld_88 && ld_64 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_116 = OrdersTotal(); if (l_ord_total_116 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_64 < 0.0 && ld_64 > ld_80 && ld_72 < ld_88 && MathAbs(ld_64) > gi_752 * Point && ld_96 > ld_104) { l_ticket_40 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_40 > 0) { if (OrderSelect(l_ticket_40, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); } void NoiseFilter() { int li_12; double ld_16; double ld_24; int li_32; double ld_36; double ld_44; double ld_52; double ld_60; double ld_68; double ld_76; double ld_84; int l_pos_92; int l_ticket_96; int li_unused_0 = MarketInfo(g_symbol_932, MODE_SPREAD); int li_4 = OrdersTotal() - 1; for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("NoiseFilter: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { li_12 = g_datetime_984 - OrderOpenTime(); if (li_12 > gi_1064) { 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_1068 && ld_36 >= gd_1116) li_32 = 1; else { if (li_12 > gi_1068 && li_12 < gi_1072 && ld_36 >= gd_1124) li_32 = 2; else { if (li_12 > gi_1072 && li_12 < gi_1076 && ld_36 >= gd_1132) li_32 = 3; else { if (li_12 > gi_1076 && li_12 < gi_1080 && ld_36 >= gd_1140) li_32 = 4; else if (li_12 > gi_1080 && ld_36 >= gd_1148) li_32 = 5; } } } if (li_32 != 0) CloseOrder(OrderTicket(), OrderLots(), OrderType(), g_slippage_880); } } } } } } return; while (true) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } } } } else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_pos_92++; if (l_pos_92 < li_4) continue; break; } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_752 * Point && ld_76 < ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_92 = 0; l_pos_92 < li_4; l_pos_92++) { OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_44 > 0.0 && ld_44 < ld_60 && ld_52 > ld_68 && ld_44 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_44 < 0.0 && ld_44 > ld_60 && ld_52 < ld_68 && MathAbs(ld_44) > gi_752 * Point && ld_76 > ld_84) { l_ticket_96 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_96 > 0) { if (OrderSelect(l_ticket_96, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } } } } } } } } } } } } } void WatchLevels() { double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; double ld_60; double ld_68; double ld_76; int l_pos_84; int l_ticket_88; if (gi_1012 <= 0 && gi_1016 <= 0) return; int li_unused_0 = MarketInfo(g_symbol_932, MODE_SPREAD); int li_4 = OrdersTotal() - 1; for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("WatchLevels: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { ld_12 = NormalizeDouble(OrderClosePrice(), Digits); ld_20 = NormalizeDouble(OrderOpenPrice(), Digits); if (OrderType() == OP_BUY) { ld_28 = ld_12 - ld_20; if ((gd_1100 > 0.0 && ld_28 >= gd_1100) || (gd_1108 < 0.0 && ld_28 <= gd_1108)) { if (WriteDebugLog) { if (gi_808 == 0) Print("WatchLevels: level for close BUY"); else Print("WatchLevels: уровень для закрытия BUY"); } CloseOrder(OrderTicket(), OrderLots(), 0, g_slippage_880); } } else { ld_28 = ld_20 - ld_12; if ((gd_1100 > 0.0 && ld_28 >= gd_1100) || (gd_1108 < 0.0 && ld_28 <= gd_1108)) { if (WriteDebugLog) { if (gi_808 == 0) Print("WatchLevels: level for close SELL"); else Print("WatchLevels: уровень для закрытия SELL"); } CloseOrder(OrderTicket(), OrderLots(), 1, g_slippage_880); } } } } } } } return; while (true) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } } } } else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_pos_84++; if (l_pos_84 < li_4) continue; break; } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_752 * Point && ld_68 < ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_84 = 0; l_pos_84 < li_4; l_pos_84++) { OrderSelect(l_pos_84, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_36 > 0.0 && ld_36 < ld_52 && ld_44 > ld_60 && ld_36 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_36 < 0.0 && ld_36 > ld_52 && ld_44 < ld_60 && MathAbs(ld_36) > gi_752 * Point && ld_68 > ld_76) { l_ticket_88 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_88 > 0) { if (OrderSelect(l_ticket_88, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } } } } } } } } } } } } } double LotsOptimized() { double ld_16; double ld_24; double ld_32; double ld_40; double ld_48; double ld_56; int l_pos_64; int l_ticket_68; int l_ord_total_72; if (!Scalper_UseMM) return (Scalper_Lots); double ld_0 = AccountFreeMargin() * gd_924 / 100.0; double ld_ret_8 = NormalizeDouble(MathFloor(ld_0 / gd_916) * g_lotstep_908, gi_832); if (ld_ret_8 < g_minlot_900) ld_ret_8 = g_minlot_900; if (ld_ret_8 > g_maxlot_892) ld_ret_8 = g_maxlot_892; if (ld_ret_8 > Scalper_MaxLots) ld_ret_8 = Scalper_MaxLots; return (ld_ret_8); while (true) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_64++; if (l_pos_64 < l_ord_total_72) continue; break; } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_752 * Point && ld_48 < ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_64 = 0; l_pos_64 < l_ord_total_72; l_pos_64++) { OrderSelect(l_pos_64, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_16 > 0.0 && ld_16 < ld_32 && ld_24 > ld_40 && ld_16 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_72 = OrdersTotal(); if (l_ord_total_72 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_16 < 0.0 && ld_16 > ld_32 && ld_24 < ld_40 && MathAbs(ld_16) > gi_752 * Point && ld_48 > ld_56) { l_ticket_68 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_68 > 0) { if (OrderSelect(l_ticket_68, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0.0); } void SetOrderLevels() { double ld_16; double l_price_24; double ld_32; double ld_40; bool li_48; int li_52; int li_56; double l_price_60; double l_price_68; bool l_bool_76; double ld_80; double ld_88; double ld_96; double ld_104; double ld_112; double ld_120; int l_pos_128; int l_ticket_132; double ld_0 = NormalizeDouble(MarketInfo(g_symbol_932, MODE_STOPLEVEL) * Point, Digits); int li_8 = OrdersTotal() - 1; for (int l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (!OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("SetOrderLevels: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { if (OrderType() <= OP_SELL) { if (OrderSymbol() == g_symbol_932) { ld_16 = NormalizeDouble(OrderClosePrice(), gi_840); l_price_24 = NormalizeDouble(OrderOpenPrice(), gi_840); ld_32 = NormalizeDouble(OrderStopLoss(), gi_840); ld_40 = NormalizeDouble(OrderTakeProfit(), gi_840); li_48 = TRUE; li_52 = 0; li_56 = 0; if (ld_32 == 0.0) { if (Scalper_StealthMode) li_52 = gi_788 + MathRand() % gi_792; else li_52 = gi_1016; if (li_52 != 0) { if (OrderType() == OP_BUY) { l_price_60 = NormalizeDouble(l_price_24 - li_52 * gd_884, gi_840); if (ld_16 - l_price_60 <= ld_0) li_48 = FALSE; } else { l_price_60 = NormalizeDouble(l_price_24 + li_52 * gd_884, gi_840); if (l_price_60 - ld_16 <= ld_0) li_48 = FALSE; } } } else l_price_60 = ld_32; if (ld_40 == 0.0) { if (Scalper_StealthMode) li_56 = gi_796 + MathRand() % gi_800; else li_56 = gi_1012; if (li_56 != 0) { if (OrderType() == OP_BUY) { l_price_68 = NormalizeDouble(l_price_24 + li_56 * gd_884, gi_840); if (l_price_68 - ld_16 <= ld_0) li_48 = FALSE; } else { l_price_68 = NormalizeDouble(l_price_24 - li_56 * gd_884, gi_840); if (ld_16 - l_price_68 <= ld_0) li_48 = FALSE; } } } else l_price_68 = ld_40; if (li_52 != 0 && li_56 != 0 && li_48) { while (!IsTradeAllowed()) Sleep(1000); l_bool_76 = OrderModify(OrderTicket(), l_price_24, l_price_60, l_price_68, 0, CLR_NONE); if (!l_bool_76) if (WriteDebugLog) Print("SetOrderLevels: OrderModify(OP_SELL) error = ", GetLastError()); } } } } } } return; while (true) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } } } } else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_pos_128++; if (l_pos_128 < li_8) continue; break; } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_752 * Point && ld_112 < ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_128 = 0; l_pos_128 < li_8; l_pos_128++) { OrderSelect(l_pos_128, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_80 > 0.0 && ld_80 < ld_96 && ld_88 > ld_104 && ld_80 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_80 < 0.0 && ld_80 > ld_96 && ld_88 < ld_104 && MathAbs(ld_80) > gi_752 * Point && ld_112 > ld_120) { l_ticket_132 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_132 > 0) { if (OrderSelect(l_ticket_132, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } } } } } } } } } } } } } bool Scalper_HaveTrade() { int l_datetime_28; double ld_32; double ld_40; double ld_48; double ld_56; double ld_64; double ld_72; int l_pos_80; int l_ticket_84; if (gi_124 == gi_128) return (FALSE); int l_datetime_0 = TimeCurrent(); int li_4 = iTime(NULL, PERIOD_D1, 0); int l_hour_8 = TimeHour(l_datetime_0); int li_unused_12 = 0; if (gi_124 > gi_128) if (l_hour_8 < gi_124) li_4 -= 86400; li_4 += 3600 * gi_124; int li_16 = OrdersTotal() - 1; int l_datetime_20 = -2147483648; for (int l_pos_24 = li_16; l_pos_24 >= 0; l_pos_24--) { if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_28 = OrderOpenTime(); if (l_datetime_20 < l_datetime_28) l_datetime_20 = l_datetime_28; } } } } if (l_datetime_20 >= li_4) return (TRUE); li_16 = OrdersHistoryTotal() - 1; l_datetime_20 = -2147483648; for (l_pos_24 = li_16; l_pos_24 >= 0; l_pos_24--) { if (OrderSelect(l_pos_24, SELECT_BY_POS, MODE_HISTORY)) { if (OrderMagicNumber() == g_magic_836) { if (OrderSymbol() == g_symbol_932) { l_datetime_28 = OrderOpenTime(); if (l_datetime_20 < l_datetime_28) l_datetime_20 = l_datetime_28; } } } } if (l_datetime_20 >= li_4) return (TRUE); return (FALSE); while (true) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } } } } else { if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } l_pos_80++; if (l_pos_80 < li_16) continue; break; } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (FALSE); } return (FALSE); } for (l_pos_80 = 0; l_pos_80 < li_16; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (FALSE); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (FALSE); } } } } } li_16 = OrdersTotal(); if (li_16 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (FALSE); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (FALSE); } return (FALSE); } return (FALSE); } int CloseOrder(int a_ticket_0, double a_lots_4, int ai_12, int a_slippage_16) { color l_color_20; double l_price_40; bool l_ord_close_48; int l_error_52; string ls_56; bool li_64; double ld_72; double ld_80; double ld_88; double ld_96; double ld_104; double ld_112; int l_pos_120; int l_ticket_124; int l_ord_total_128; if (ai_12 == 0) l_color_20 = ColorBuy; else l_color_20 = ColorSell; int l_count_24 = 0; int l_count_28 = 0; int l_count_32 = 0; int l_count_36 = 0; while (true) { while (!IsTradeAllowed()) Sleep(1000); RefreshRates(); if (ai_12 == 0) l_price_40 = Bid; else l_price_40 = Ask; l_ord_close_48 = OrderClose(a_ticket_0, a_lots_4, l_price_40, a_slippage_16, l_color_20); if (!l_ord_close_48) { l_error_52 = GetLastError(); if (WriteDebugLog) { if (ai_12 == 0) ls_56 = "BUY"; else ls_56 = "SELL"; Print("OrderClose(", ls_56, ",", a_ticket_0, ") error = ", ErrorDescription(l_error_52)); } li_64 = FALSE; switch (l_error_52) { case 0/* NO_ERROR */: Sleep(10000); if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) if (OrderCloseTime() == 0) li_64 = TRUE; break; case 1/* NO_RESULT */: break; case 2/* COMMON_ERROR */: break; case 3/* INVALID_TRADE_PARAMETERS */: break; case 4/* SERVER_BUSY */: break; case 5/* OLD_VERSION */: break; case 6/* NO_CONNECTION */: Sleep(10000); if (IsConnected()) li_64 = TRUE; break; case 7/* NOT_ENOUGH_RIGHTS */: break; case 8/* TOO_FREQUENT_REQUESTS */: break; case 9/* MALFUNCTIONAL_TRADE */: break; case 64/* ACCOUNT_DISABLED */: break; case 65/* INVALID_ACCOUNT */: break; case 128/* TRADE_TIMEOUT */: Sleep(70000); if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) if (OrderCloseTime() == 0) li_64 = TRUE; break; case 129/* INVALID_PRICE */: Sleep(6000); l_count_24++; if (l_count_24 <= 3) li_64 = TRUE; break; case 130/* INVALID_STOPS */: Sleep(6000); l_count_28++; if (l_count_28 <= 3) li_64 = TRUE; break; case 131/* INVALID_TRADE_VOLUME */: break; case 132/* MARKET_CLOSED */: break; case 133/* TRADE_DISABLED */: break; case 134/* NOT_ENOUGH_MONEY */: break; case 135/* PRICE_CHANGED */: li_64 = TRUE; break; case 136/* OFF_QUOTES */: Sleep(6000); li_64 = TRUE; break; case 137/* BROKER_BUSY */: Sleep(20000); l_count_32++; if (l_count_32 <= 3) li_64 = TRUE; break; case 138/* REQUOTE */: l_count_36++; if (l_count_36 <= 3) li_64 = TRUE; break; case 139/* ORDER_LOCKED */: break; case 140/* LONG_POSITIONS_ONLY_ALLOWED */: break; case 141/* TOO_MANY_REQUESTS */: break; case 142: Sleep(70000); if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) if (OrderCloseTime() == 0) li_64 = TRUE; break; case 143: Sleep(70000); if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) if (OrderCloseTime() == 0) li_64 = TRUE; break; case 144: break; case 145/* TRADE_MODIFY_DENIED */: Sleep(20000); li_64 = TRUE; break; case 146/* TRADE_CONTEXT_BUSY */: while (IsTradeContextBusy()) Sleep(1000); li_64 = TRUE; break; case 147: break; case 148: break; case 4000/* NO_MQLERROR */: Sleep(10000); if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) if (OrderCloseTime() == 0) li_64 = TRUE; case 4051/* INVALID_FUNCTION_PARAMETER_VALUE */: break; case 4062/* STRING_PARAMETER_EXPECTED */: break; case 4063/* INTEGER_PARAMETER_EXPECTED */: break; case 4064/* DOUBLE_PARAMETER_EXPECTED */: break; case 4105/* NO_ORDER_SELECTED */: break; case 4106/* UNKNOWN_SYMBOL */: break; case 4107/* INVALID_PRICE_PARAM */: break; case 4108/* INVALID_TICKET */: break; case 4109/* TRADE_NOT_ALLOWED */: break; case 4110/* LONGS__NOT_ALLOWED */: break; case 4111/* SHORTS_NOT_ALLOWED */: break; } if (!(li_64)) break; } } if (OrderSelect(a_ticket_0, SELECT_BY_TICKET)) l_price_40 = OrderClosePrice(); if (SendEmail) { if (gi_808 == 0) { SendMail(gs_948, StringConcatenate("Fapturbo Trade Information\nCurrency Pair: ", StringSubstr(g_symbol_932, 0, 6), "\nTime: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nOrder Type: ", OrderTypeToStr(ai_12), "\nPrice: ", DoubleToStr(l_price_40, Digits), "\nLot size: ", DoubleToStr(a_lots_4, gi_832), "\nEvent: Trade Closed", "\n\nCurrent Balance: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nCurrent Equity: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } else { SendMail(gs_964, StringConcatenate("Fapturbo торговая информация\nВалютная пара: ", StringSubstr(g_symbol_932, 0, 6), "\nВремя: ", TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS), "\nТип ордера: ", OrderTypeToStr(ai_12), "\nЦена: ", DoubleToStr(l_price_40, Digits), "\nРазмер лота: ", DoubleToStr(a_lots_4, gi_832), "\nСобытие: закрытие ордера", "\n\nТекущий баланс: ", DoubleToStr(AccountBalance(), 2), " ", AccountCurrency(), "\nТекущие средства: ", DoubleToStr(AccountEquity(), 2), " ", AccountCurrency())); } } if (SoundAlert) PlaySound(SoundFileAtClose); return (l_ord_close_48); while (true) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_120++; if (l_pos_120 < l_ord_total_128) continue; break; } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_752 * Point && ld_104 < ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_120 = 0; l_pos_120 < l_ord_total_128; l_pos_120++) { OrderSelect(l_pos_120, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_72 > 0.0 && ld_72 < ld_88 && ld_80 > ld_96 && ld_72 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_ord_total_128 = OrdersTotal(); if (l_ord_total_128 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_72 < 0.0 && ld_72 > ld_88 && ld_80 < ld_96 && MathAbs(ld_72) > gi_752 * Point && ld_104 > ld_112) { l_ticket_124 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_124 > 0) { if (OrderSelect(l_ticket_124, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); } void Compress(int &aia_0[100], string as_4) { int li_24; int li_28; int li_32; int li_36; double ld_40; double ld_48; double ld_56; double ld_64; double ld_72; double ld_80; int l_pos_88; int l_ticket_92; int l_ord_total_96; int li_12 = StringLen(as_4); int li_16 = 0; for (int l_index_20 = 0; li_12 > 0; l_index_20++) { if (li_12 < 4) li_24 = 0; else { li_24 = StringGetChar(as_4, li_16 + 3); li_24 <<= 24; } if (li_12 < 3) li_28 = 0; else { li_28 = StringGetChar(as_4, li_16 + 2); li_28 <<= 16; } if (li_12 < 2) li_32 = 0; else { li_32 = StringGetChar(as_4, li_16 + 1); li_32 <<= 8; } if (li_12 < 1) li_36 = 0; else li_36 = StringGetChar(as_4, li_16); aia_0[l_index_20] = li_24 | li_28 | li_32 | li_36; li_12 -= 4; li_16 += 4; } aia_0[l_index_20] = 0; return; while (true) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } } } } else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_pos_88++; if (l_pos_88 < l_ord_total_96) continue; break; } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } else { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_752 * Point && ld_72 < ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); } } } } else { for (l_pos_88 = 0; l_pos_88 < l_ord_total_96; l_pos_88++) { OrderSelect(l_pos_88, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_40 > 0.0 && ld_40 < ld_56 && ld_48 > ld_64 && ld_40 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return; } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return; } if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return; } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return; } } } } } l_ord_total_96 = OrdersTotal(); if (l_ord_total_96 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) Print("We have no money. Free Margin = ", AccountFreeMargin()); else { if (ld_40 < 0.0 && ld_40 > ld_56 && ld_48 < ld_64 && MathAbs(ld_40) > gi_752 * Point && ld_72 > ld_80) { l_ticket_92 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_92 > 0) { if (OrderSelect(l_ticket_92, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); } } } } } } } } } } } } } int HaveAllOrders() { double ld_12; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; int l_pos_60; int l_ticket_64; int l_count_0 = 0; int li_4 = OrdersTotal() - 1; for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { if (OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) if (OrderMagicNumber() == g_magic_836) l_count_0++; } return (l_count_0); while (true) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_60++; if (l_pos_60 < li_4) continue; break; } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_752 * Point && ld_44 < ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_60 = 0; l_pos_60 < li_4; l_pos_60++) { OrderSelect(l_pos_60, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_12 > 0.0 && ld_12 < ld_28 && ld_20 > ld_36 && ld_12 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_12 < 0.0 && ld_12 > ld_28 && ld_20 < ld_36 && MathAbs(ld_12) > gi_752 * Point && ld_44 > ld_52) { l_ticket_64 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_64 > 0) { if (OrderSelect(l_ticket_64, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); } string OrderTypeToStr(int ai_0) { string ls_ret_8; switch (ai_0) { case 0: ls_ret_8 = "Buy"; break; case 1: ls_ret_8 = "Sell"; break; case 2: ls_ret_8 = "BuyLimit"; break; case 3: ls_ret_8 = "SellLimit"; break; case 4: ls_ret_8 = "BuyStop"; break; case 5: ls_ret_8 = "SellStop"; break; default: ls_ret_8 = "Unknown"; } return (ls_ret_8); } double CalculateProfitSession() { int li_16; int l_datetime_20; int l_hour_24; int li_unused_28; double ld_32; double ld_40; double ld_48; double ld_56; double ld_64; double ld_72; int l_pos_80; int l_ticket_84; double ld_ret_0 = 0; int li_8 = OrdersTotal() - 1; for (int l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (!OrderSelect(l_pos_12, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("CalculateProfitSession: OrderSelect() error = ", GetLastError()); } else if (OrderMagicNumber() == g_magic_836) ld_ret_0 += OrderProfit() + OrderSwap() + OrderCommission(); } if (gi_124 == gi_128) li_16 = 0; else { l_datetime_20 = TimeCurrent(); li_16 = iTime(NULL, PERIOD_D1, 0); l_hour_24 = TimeHour(l_datetime_20); li_unused_28 = 0; if (gi_124 > gi_128) if (l_hour_24 < gi_124) li_16 -= 86400; li_16 += 3600 * gi_124; } li_8 = OrdersHistoryTotal() - 1; for (l_pos_12 = li_8; l_pos_12 >= 0; l_pos_12--) { if (!OrderSelect(l_pos_12, SELECT_BY_POS, MODE_HISTORY)) { if (WriteDebugLog) Print("CalculateProfitSession: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) if (OrderCloseTime() >= li_16) ld_ret_0 += OrderProfit() + OrderSwap() + OrderCommission(); } } return (ld_ret_0); while (true) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_80++; if (l_pos_80 < li_8) continue; break; } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_752 * Point && ld_64 < ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_80 = 0; l_pos_80 < li_8; l_pos_80++) { OrderSelect(l_pos_80, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_32 > 0.0 && ld_32 < ld_48 && ld_40 > ld_56 && ld_32 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_8 = OrdersTotal(); if (li_8 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_32 < 0.0 && ld_32 > ld_48 && ld_40 < ld_56 && MathAbs(ld_32) > gi_752 * Point && ld_64 > ld_72) { l_ticket_84 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_84 > 0) { if (OrderSelect(l_ticket_84, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0.0); } int CloseAllSymbols() { int l_cmd_12; bool l_ord_delete_16; double ld_20; double ld_28; double ld_36; double ld_44; double ld_52; double ld_60; int l_pos_68; int l_ticket_72; int li_ret_0 = 0; int li_4 = OrdersTotal() - 1; for (int l_pos_8 = li_4; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { if (WriteDebugLog) Print("CloseAllSymbols: OrderSelect() error = ", GetLastError()); } else { if (OrderMagicNumber() == g_magic_836) { l_cmd_12 = OrderType(); RefreshRates(); while (!IsTradeAllowed()) Sleep(1000); if (l_cmd_12 <= OP_SELL) l_ord_delete_16 = CloseOrder(OrderTicket(), OrderLots(), l_cmd_12, g_slippage_880); else { l_ord_delete_16 = OrderDelete(OrderTicket()); if (!l_ord_delete_16) if (WriteDebugLog) Print("CloseAllSymbols: OrderDelete() error = ", GetLastError()); } if (!l_ord_delete_16) li_ret_0 = -1; } } } return (li_ret_0); while (true) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (Bid - OrderOpenPrice() > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() < Bid - Point * FapTurbo_TrailingStop) { OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } } } } else { if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } l_pos_68++; if (l_pos_68 < li_4) continue; break; } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, FapTurbo_Lots, Bid, 3, 0, Bid - FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * Scalper_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, Scalper_Lots, Ask, 3, 0, Ask + gi_1012 * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_752 * Point && ld_52 < ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_SELL, Scalper_Lots, Bid, 3, 0, Bid - gi_1012 * Point, "macd sample", 16384, 0, Red); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("SELL order opened : ", OrderOpenPrice()); } else Print("Error opening SELL order : ", GetLastError()); return (0); } return (0); } for (l_pos_68 = 0; l_pos_68 < li_4; l_pos_68++) { OrderSelect(l_pos_68, SELECT_BY_POS, MODE_TRADES); if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { if (ld_20 > 0.0 && ld_20 < ld_36 && ld_28 > ld_44 && ld_20 > gi_996 * Point) { OrderClose(OrderTicket(), OrderLots(), Bid, 3, Violet); return (0); } if (FapTurbo_TrailingStop <= 0.0) continue; if (Bid - OrderOpenPrice() <= Point * FapTurbo_TrailingStop) continue; if (OrderStopLoss() >= Bid - Point * FapTurbo_TrailingStop) continue; OrderModify(OrderTicket(), OrderOpenPrice(), Bid - Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Green); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point) { OrderClose(OrderTicket(), OrderLots(), Ask, 3, Violet); return (0); } if (FapTurbo_TrailingStop > 0.0) { if (OrderOpenPrice() - Ask > Point * FapTurbo_TrailingStop) { if (OrderStopLoss() > Ask + Point * FapTurbo_TrailingStop || OrderStopLoss() == 0.0) { OrderModify(OrderTicket(), OrderOpenPrice(), Ask + Point * FapTurbo_TrailingStop, OrderTakeProfit(), 0, Red); return (0); } } } } } li_4 = OrdersTotal(); if (li_4 < 1) { if (AccountFreeMargin() < 1000.0 * FapTurbo_Lots) { Print("We have no money. Free Margin = ", AccountFreeMargin()); return (0); } if (ld_20 < 0.0 && ld_20 > ld_36 && ld_28 < ld_44 && MathAbs(ld_20) > gi_752 * Point && ld_52 > ld_60) { l_ticket_72 = OrderSend(Symbol(), OP_BUY, FapTurbo_Lots, Ask, 3, 0, Ask + FapTurbo_TakeProfit * Point, "macd sample", 16384, 0, Green); if (l_ticket_72 > 0) { if (OrderSelect(l_ticket_72, SELECT_BY_TICKET, MODE_TRADES)) Print("BUY order opened : ", OrderOpenPrice()); } else Print("Error opening BUY order : ", GetLastError()); return (0); } return (0); } return (0); }