#property copyright "Forex-Trust" #property link "http://www.meta-trader.de" string gs_76 = "Forex-Trust"; string gs_84 = "http://www.meta-trader.de"; extern int DisplayLevel = 0; string gs_96 = "Put Unlock Code Here "; extern bool AllowForSpread = TRUE; extern bool DoTrades = TRUE; bool gi_112 = FALSE; string gs_unused_116 = "If set to false, then ranges will be 40 pips."; bool gi_124 = FALSE; extern string _BalanceFactor = "should be minimum of 2000 and on up"; extern string _BalanceFactor2 = "Leave at 0.0 for auto calculation"; extern double BalanceFactor = 0.0; extern string Leave = "Lots as 0.0 for auto-calculation from BalanceFactor."; extern double Lots = 0.0; string gs_unused_168 = "AUDNZD at 50 pips: 1=40, 2=30, 3=24"; string gs_unused_176 = "AUDNZD at 40 pips: 1=50, 2=36"; string gs_unused_184 = "EURCHF at 50 pips: 1=51, 2=42"; string gs_unused_192 = "EURCHF at 40 pips: 1=64, 2=50"; int gi_200 = 1; extern int MagicNumber1 = 510001; bool gi_208 = FALSE; bool gi_212 = TRUE; int gi_216 = 15; int gi_220 = 15; int gi_224 = 0; int gi_228 = 29; int gi_232 = 50; int gi_236 = 0; double gd_240 = 1.07; int gi_248 = 0; int gi_252 = 5; int gi_256 = 0; string gs_unused_260 = "-----------------------------------------------"; bool gi_unused_268 = FALSE; string gs_unused_272 = "Leave as 0 to use actual account balance."; double gd_unused_280 = 0.0; double gd_unused_288 = 0.25; int gi_296 = 2; int gi_300 = 25; double gd_304 = 0.0; string gs_unused_312 = "Leave Lots 0.00 for Auto-Calculation"; bool gi_unused_320 = FALSE; bool gi_unused_324 = FALSE; bool gi_328 = TRUE; string gs_unused_332 = "-----------------------------------------------"; double gd_unused_340 = 0.0; double gd_unused_348 = 0.0; bool gi_unused_356 = FALSE; bool gi_unused_360 = FALSE; bool gi_unused_364 = FALSE; bool gi_unused_368 = FALSE; bool gi_unused_372 = FALSE; bool gi_unused_376 = FALSE; int gi_unused_380 = 1; string gs_unused_384 = "-----------------------------------------------"; bool gi_392 = FALSE; bool gi_396 = FALSE; double gd_unused_400 = 0.0; double gd_unused_408 = 0.0; double gd_unused_416 = 0.0; double gd_unused_424 = 0.0; string gs_unused_432 = "-----------------------------------------------"; double gd_unused_440 = 0.0; bool gi_unused_448 = FALSE; string gs_unused_452 = "------------------------------------------------"; int gi_460 = 90; double gd_464 = 15.0; bool gi_unused_472 = FALSE; bool gi_unused_476 = FALSE; double gda_480[101]; double gda_484[101]; double gda_488[101]; double gda_492[101]; int gia_496[101]; double gd_unused_500 = 0.0; int gi_unused_508 = 1440; int gi_512 = 60; string g_symbol_516 = " "; string gs_unused_524 = " "; string gs_unused_532 = " "; string gs_unused_540 = " "; double gd_548 = -1000000.0; double gd_556 = 1000000.0; double gd_564 = -1000000.0; double gd_572 = 1000000.0; double gd_580 = 0.0; double gd_588 = 0.0; double g_free_magrin_596 = 0.0; double g_free_magrin_604 = 0.0; double gd_612 = 0.0; double gd_620 = 0.0; double gd_unused_628 = 0.0; double gd_unused_636 = 0.0; double gd_unused_644 = 0.0; double gd_unused_652 = 0.0; double gd_unused_660 = 0.0; double gd_unused_668 = 0.0; double gd_unused_676 = 0.0; double gd_unused_684 = 0.0; double gd_unused_692 = 0.0; double gd_unused_700 = 0.0; double gd_unused_708 = 0.0; double gd_unused_716 = 0.0; double gd_unused_724 = 0.0; double gd_unused_732 = 0.0; double gd_unused_740 = 0.0; double gd_unused_748 = 0.0; double gd_unused_756 = 0.0; double gd_unused_764 = 0.0; double gd_unused_772 = 0.0; double gd_unused_780 = 0.0; double g_price_788 = 0.0; double gd_unused_796 = 0.0; double gd_804 = 0.0; double gd_812 = 0.0; double gd_unused_820 = 0.0; double gd_unused_828 = 0.0; double gd_unused_836 = 0.0; double gd_unused_844 = 0.0; double gd_852 = 0.0; double gd_unused_860 = 0.0; double gd_unused_868 = 0.0; double gd_unused_876 = 0.0; double gd_unused_884 = 0.0; double gd_unused_892 = 0.0; double gd_unused_900 = 0.0; double gd_unused_908 = 0.0; double gd_unused_916 = 0.0; double gd_unused_924 = 0.0; double gd_unused_932 = 0.0; double gd_unused_940 = 0.0; int g_ord_total_948 = 0; int g_error_952 = 0/* NO_ERROR */; int gi_956 = 10; int g_count_960 = 4; int gi_unused_964 = 0; double gd_unused_968 = 0.0; double gd_unused_976 = 0.0; double g_lotsize_984 = 0.0; double gd_unused_992 = 0.0; double gd_unused_1000 = 0.0; double gd_unused_1008 = 0.0; double gd_unused_1016 = 0.0; double gd_unused_1024 = 0.0; double gd_unused_1032 = 0.0; double gd_unused_1040 = 0.0; double gd_unused_1048 = 0.0; double gd_unused_1056 = 0.0; double gd_unused_1064 = 0.0; string gs_1072 = " "; string gs_unused_1080 = " "; string gs_unused_1088 = " "; string gs_unused_1096 = " "; int gi_unused_1104 = 0; int gi_unused_1108 = 0; bool gi_1112 = FALSE; int gi_unused_1116 = 0; int gi_1120 = 0; double gd_unused_1124 = 0.0; double gd_unused_1132 = 0.0; double gd_unused_1140 = 0.0; int gi_unused_1148 = 0; int gi_unused_1152 = 0; bool gi_1156 = FALSE; bool gi_1160 = FALSE; int gi_1164 = 0; int gi_1168 = 0; bool gi_1172 = FALSE; bool gi_1176 = FALSE; double gda_1180[101]; double gd_1184 = 0.0; string g_comment_1192 = " "; string gs_unused_1200 = " "; string gs_unused_1208 = " "; string gs_unused_1216 = " "; string gs_unused_1224 = " "; int g_digits_1232 = 2; bool gi_1236 = TRUE; double gd_1240 = 0.0; double g_ihigh_1248 = 0.0; double g_ilow_1256 = 0.0; int gi_1264 = 0; int gi_1268 = 0; int gi_1272 = 0; int gi_1276 = 0; int gi_1280 = 0; double gd_unused_1284 = 0.0; int gi_1292 = 0; int gi_1296 = 0; int gi_1300 = 0; int g_count_1304 = 0; bool gi_1308 = TRUE; int gi_1312 = 0; int init() { int li_0; if (!License(D'20.06.2009 04:29')) { Alert("http://www.meta-trader.de/ keine Lizenz mehr"); return (-1); } if (Decoder() == 0) { Comment("Please Enter a Valid Unlock Code"); return (0); } if (gi_112 == TRUE) gi_1236 = FALSE; if (gi_112 == FALSE) gi_1236 = TRUE; gi_1312 = FALSE; if (gi_200 != 1 && gi_200 != 2 && gi_200 != 3 && gi_200 != 9 && gi_200 < 10) gi_200 = 2; if (gi_124 == TRUE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_200 == 2) { gd_240 = 1.07; gd_240 = StartPoint() * Point + 1.065; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.065; gi_232 = 50; gi_1296 = 7; gi_228 = 40; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 27; gi_220 = 27; } if (gi_200 == 1) { gd_240 = 1.045; gd_240 = StartPoint() * Point + 1.04; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.04; gi_232 = 50; gi_1296 = 2; gi_228 = 54; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 27; gi_220 = 27; } if (gi_200 == 3) { gd_240 = 1.085; gd_240 = StartPoint() * Point + 1.08; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.08; gi_232 = 50; gi_1296 = 10; gi_228 = 30; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 27; gi_220 = 27; } if (gi_200 == 9) { gd_240 = 1.04; gd_240 = StartPoint() * Point + 1.035; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.035; gi_232 = 50; gi_1296 = 1; gi_228 = 54; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 27; gi_220 = 27; } if (gi_200 > 9) { gd_240 = 1.04; gd_240 = StartPoint() * Point + 1.035; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.035; gi_232 = 50; gi_1296 = 1; gi_228 = gi_200; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = gi_228 / 2; gi_220 = gi_228 / 2; } } else { if (gi_200 == 2) { gd_240 = 1.459; gd_240 = StartPoint() * Point + 1.454; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 50; gi_1296 = 5; gi_228 = 42; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 26; gi_220 = 26; } if (gi_200 == 1) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 50; gi_1296 = 1; gi_228 = 52; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 26; gi_220 = 26; } if (gi_200 == 3) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 50; gi_1296 = 1; gi_228 = 52; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 26; gi_220 = 26; } if (gi_200 == 9) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 50; gi_1296 = 1; gi_228 = 52; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 26; gi_220 = 26; } if (gi_200 > 9) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 50; gi_1296 = 1; gi_228 = gi_200; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = gi_228 / 2; gi_220 = gi_228 / 2; } } } if (gi_124 == FALSE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_200 == 2) { gd_240 = 1.07; gd_240 = StartPoint() * Point + 1.065; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.065; gi_232 = 40; gi_1296 = 8; gi_228 = 50; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 33; gi_220 = 33; } if (gi_200 == 1) { gd_240 = 1.042; gd_240 = StartPoint() * Point + 1.037; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.037; gi_232 = 40; gi_1296 = 1; gi_228 = 66; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 33; gi_220 = 33; } if (gi_200 == 3) { gd_240 = 1.07; gd_240 = StartPoint() * Point + 1.065; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.065; gi_232 = 40; gi_1296 = 8; gi_228 = 50; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 33; gi_220 = 33; } if (gi_200 == 9) { gd_240 = 1.042; gd_240 = StartPoint() * Point + 1.037; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.037; gi_232 = 40; gi_1296 = 1; gi_228 = 66; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 33; gi_220 = 33; } if (gi_200 > 9) { gd_240 = 1.042; gd_240 = StartPoint() * Point + 1.037; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.037; gi_232 = 40; gi_1296 = 1; gi_228 = gi_200; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = gi_228 / 2; gi_220 = gi_228 / 2; } } else { if (gi_200 == 2) { gd_240 = 1.463; gd_240 = StartPoint() * Point + 1.458; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.458; gi_232 = 40; gi_1296 = 7; gi_228 = 50; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 31; gi_220 = 31; } if (gi_200 == 1) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 40; gi_1296 = 1; gi_228 = 64; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 31; gi_220 = 31; } if (gi_200 == 3) { gd_240 = 1.463; gd_240 = StartPoint() * Point + 1.458; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.458; gi_232 = 40; gi_1296 = 7; gi_228 = 50; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 31; gi_220 = 31; } if (gi_200 == 9) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 40; gi_1296 = 1; gi_228 = 64; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = 31; gi_220 = 31; } if (gi_200 > 9) { gd_240 = 1.439; gd_240 = StartPoint() * Point + 1.434; if (Digits == 5) gd_240 = 10.0 * StartPoint() * Point + 1.434; gi_232 = 40; gi_1296 = 1; gi_228 = gi_200; gi_1300 = gi_1296 + gi_228 - 1; gi_216 = gi_228 / 2; gi_220 = gi_228 / 2; } } } if (Digits == 5) { gi_232 = 10 * gi_232; gi_252 = 50; gi_300 = 160; } CalculateHighsAndLows(); gi_1160 = TRUE; g_symbol_516 = Symbol(); if (gi_1160 == TRUE) g_comment_1192 = "fx-trust Bid "; if (gi_1160 == FALSE) g_comment_1192 = "fx-trust SP "; if (gi_1160 == TRUE) g_digits_1232 = Digits; if (gi_1160 == FALSE) g_digits_1232 = 2; gi_unused_1152 = 0; ArrayInitialize(gda_480, 0.0); ArrayInitialize(gda_484, 0.0); ArrayInitialize(gda_488, 0.0); ArrayInitialize(gda_492, 0.0); ArrayInitialize(gia_496, 0); ArrayInitialize(gda_1180, 0.0); g_count_1304 = 0; gi_1164 = gi_1296 - 1; while (gi_1164 < gi_1300) { gi_1164++; g_count_1304++; gda_480[gi_1164] = gd_240 + (gi_232 * Point + gi_236 * Point) * (g_count_1304 - 1); gda_484[gi_1164] = gda_480[gi_1164] + gi_232 * Point; gda_488[gi_1164] = gda_484[gi_1164]; gda_492[gi_1164] = gda_480[gi_1164]; gda_480[gi_1164] += gi_248 * Point; gda_484[gi_1164] += gi_248 * Point; gda_488[gi_1164] += gi_248 * Point; gda_492[gi_1164] += gi_248 * Point; gd_1184 = gi_252 * (1.0 * Point); gda_1180[gi_1164] = EAProfit(); gia_496[gi_1164] = MagicNumber1 + (gi_1164 - 1); gda_1180[gi_1164] = EAProfit(); } gd_852 = CalculateLots(); SetCurrenciesAndLotSize(); SetForwardActions(); gi_1164 = gi_1296; gd_804 = CalculateTurboProfit("current"); g_ilow_1256 = 10000.0; g_ilow_1256 = iLow(g_symbol_516, PERIOD_D1, 0); for (int li_4 = 0; li_4 <= gi_460; li_4++) if (iLow(g_symbol_516, PERIOD_D1, li_4) < g_ilow_1256) g_ilow_1256 = iLow(g_symbol_516, PERIOD_D1, li_4); g_ihigh_1248 = 0.0; g_ihigh_1248 = iHigh(g_symbol_516, PERIOD_D1, 0); for (li_4 = 0; li_4 <= gi_460; li_4++) if (iHigh(g_symbol_516, PERIOD_D1, li_4) > g_ihigh_1248) g_ihigh_1248 = iHigh(g_symbol_516, PERIOD_D1, li_4); g_ihigh_1248 = NormalizeDouble(g_ihigh_1248, Digits); g_ilow_1256 = NormalizeDouble(g_ilow_1256, Digits); gd_1240 = (g_ihigh_1248 + g_ilow_1256) / 2.0; gd_1240 = NormalizeDouble(gd_1240, Digits); gi_1164 = gi_1296 - 1; while (gi_1164 < gi_1300) { gi_1164++; if (gi_1264 >= gi_1164) gi_392 = TRUE; if (gi_1264 < gi_1164) gi_392 = FALSE; if (gi_1268 > gi_1164) gi_396 = FALSE; if (gi_1268 <= gi_1164) gi_396 = TRUE; if (gd_804 >= gda_480[gi_1164] && gd_804 <= gda_484[gi_1164]) { gi_1168 = gi_1164; gi_1172 = gi_392; gi_1176 = gi_396; } if (gd_1240 >= gda_480[gi_1164] && gd_1240 <= gda_484[gi_1164]) gi_1272 = gi_1164; if (g_ihigh_1248 >= gda_480[gi_1164] && g_ihigh_1248 <= gda_484[gi_1164]) gi_1276 = gi_1164; if (g_ilow_1256 >= gda_480[gi_1164] && g_ilow_1256 <= gda_484[gi_1164]) gi_1280 = gi_1164; gda_1180[gi_1164] = EAProfit(); } gi_1264 = gi_216; gi_1268 = gi_220; if (gi_224 == 1 && gd_804 > gd_1240) { if (gi_216 == 0 && gi_1276 != 0) gi_1264 = gi_1276 - 1; if (gi_220 == 0 && gi_1272 != 0) gi_1268 = gi_1272; } if (gi_224 == 1 && gd_804 < gd_1240) { if (gi_220 == 0 && gi_1280 != 0) gi_1268 = gi_1280 + 1; if (gi_216 == 0 && gi_1272 != 0) gi_1264 = gi_1272; } if (gi_224 == 0) { if (gi_1264 == 0) gi_1264 = gi_1272; if (gi_1268 == 0) gi_1268 = gi_1272; } if (gi_1264 == 0) gi_1264 = gi_228; if (gi_1268 == 0) gi_1268 = 1; gi_1164 = gi_1296 - 1; while (gi_1164 < gi_1300) { gi_1164++; li_0 = search_for_conflict(gia_496[gi_1164]); if (li_0 == 1) break; } if (li_0 == 1) { Comment("\nMagic Number Conflict With Another Pair..."); return (-1); } ShowComments(); return (0); } int deinit() { return (0); } int start() { int li_0; if (!License(D'20.06.2009 04:29')) return (-1); if (Decoder() == 0) { Comment("Please Enter a Valid Unlock Code"); return (0); } if (Symbol() != "AUDNZD" && Symbol() == "AUDNZDm" && StringSubstr(Symbol(), 0, 6) != "AUDNZD") { if (Symbol() != "EURCHF" && Symbol() != "EURCHFm" && StringSubstr(Symbol(), 0, 6) != "EURCHF") { Comment("Expert Only Trades on the AUD/NZD or EUR/CHF"); return (0); } } gi_1164 = gi_1296 - 1; while (gi_1164 < gi_1300) { gi_1164++; li_0 = search_for_conflict(gia_496[gi_1164]); if (li_0 == 1) break; } if (li_0 == 1) { Comment("\nMagic Number Conflict With Another Pair..."); return (-1); } if (gi_112 == TRUE) gi_1236 = FALSE; if (gi_112 == FALSE) gi_1236 = TRUE; g_ilow_1256 = 10000.0; g_ilow_1256 = iLow(g_symbol_516, PERIOD_D1, 0); for (int li_4 = 0; li_4 <= gi_460; li_4++) if (iLow(g_symbol_516, PERIOD_D1, li_4) < g_ilow_1256) g_ilow_1256 = iLow(g_symbol_516, PERIOD_D1, li_4); g_ihigh_1248 = 0.0; g_ihigh_1248 = iHigh(g_symbol_516, PERIOD_D1, 0); for (li_4 = 0; li_4 <= gi_460; li_4++) if (iHigh(g_symbol_516, PERIOD_D1, li_4) > g_ihigh_1248) g_ihigh_1248 = iHigh(g_symbol_516, PERIOD_D1, li_4); g_ihigh_1248 = NormalizeDouble(g_ihigh_1248, Digits); g_ilow_1256 = NormalizeDouble(g_ilow_1256, Digits); gd_1240 = (g_ihigh_1248 + g_ilow_1256) / 2.0; gd_1240 = NormalizeDouble(gd_1240, Digits); gi_1264 = gi_216; gi_1268 = gi_220; if (gi_224 == 1 && gd_804 > gd_1240) { if (gi_216 == 0 && gi_1276 != 0) gi_1264 = gi_1276 - 1; if (gi_220 == 0 && gi_1272 != 0) gi_1268 = gi_1272; } if (gi_224 == 1 && gd_804 < gd_1240) { if (gi_220 == 0 && gi_1280 != 0) gi_1268 = gi_1280 + 1; if (gi_216 == 0 && gi_1272 != 0) gi_1264 = gi_1272; } if (gi_224 == 0) { if (gi_1264 == 0) gi_1264 = gi_1272; if (gi_1268 == 0) gi_1268 = gi_1272; } if (gi_1264 == 0) gi_1264 = gi_228; if (gi_1268 == 0) gi_1268 = 1; SetCurrenciesAndLotSize(); SetForwardActions(); gi_1164 = gi_1296; gd_852 = CalculateLots(); gd_804 = CalculateTurboProfit("current"); gd_812 = CalculateTurboProfit("average"); if (gd_804 != 0.0) { gi_1164 = gi_1296 - 1; while (gi_1164 < gi_1300) { gi_1164++; if (gi_1264 >= gi_1164) gi_392 = TRUE; if (gi_1264 < gi_1164) gi_392 = FALSE; if (gi_1268 > gi_1164) gi_396 = FALSE; if (gi_1268 <= gi_1164) gi_396 = TRUE; if (gd_804 >= gda_480[gi_1164] && gd_804 <= gda_484[gi_1164]) { gi_1168 = gi_1164; gi_1172 = gi_392; gi_1176 = gi_396; } if (gd_1240 >= gda_480[gi_1164] && gd_1240 <= gda_484[gi_1164]) gi_1272 = gi_1164; if (g_ihigh_1248 >= gda_480[gi_1164] && g_ihigh_1248 <= gda_484[gi_1164]) gi_1276 = gi_1164; if (g_ilow_1256 >= gda_480[gi_1164] && g_ilow_1256 <= gda_484[gi_1164]) gi_1280 = gi_1164; gda_1180[gi_1164] = EAProfit(); if (DoTrades == TRUE) { scanfororders2(); if (gi_1236 == FALSE) CloseAll(); if (AllowForSpread == TRUE) gd_804 = CalculateTurboProfit("ask"); if (AllowForSpread == FALSE) gd_804 = CalculateTurboProfit("current"); if (gi_1156 == FALSE && scanfororders() == 0 && (gi_328 == FALSE && gd_804 <= gda_480[gi_1164]) || (gi_328 == TRUE && (gi_256 != 0 && gd_804 > gd_812) || gi_256 == 0 && gd_804 <= gda_480[gi_1164] && gd_804 >= gda_480[gi_1164] - gd_1184) && gi_1236 == TRUE && gi_392 == TRUE) { gd_304 = gd_804; SetForwardActions(); OpenAll(); gi_unused_964 = 1; gd_804 = CalculateTurboProfit("current"); gi_1112 = FALSE; } gd_804 = CalculateTurboProfit("current"); if (gi_1112 == FALSE && gd_804 >= gda_484[gi_1164] && scanfororders() > 0) { gd_304 = gd_804; CloseAll(); gi_1156 = FALSE; } gd_804 = CalculateTurboProfit("current"); if (gi_1156 == FALSE && gi_396 == TRUE && scanfororders() == 0 && (gi_328 == FALSE && gd_804 >= gda_488[gi_1164]) || (gi_328 == TRUE && (gi_256 != 0 && gd_804 < gd_812) || gi_256 == 0 && gd_804 <= gda_488[gi_1164] + gd_1184 && gd_804 >= gda_488[gi_1164]) && gi_1236 == TRUE) { gd_304 = gd_804; SetReverseActions(); gi_1112 = TRUE; OpenAll(); gi_unused_964 = 1; SetForwardActions(); gd_804 = CalculateTurboProfit("current"); } if (AllowForSpread == TRUE) gd_804 = CalculateTurboProfit("ask"); if (AllowForSpread == FALSE) gd_804 = CalculateTurboProfit("current"); if (gi_1112 == TRUE && gd_804 <= gda_492[gi_1164] && scanfororders() > 0) { gd_304 = gd_804; CloseAll(); gi_1156 = FALSE; } gd_804 = CalculateTurboProfit("current"); } } } scanfororders2(); CalculateHighsAndLows(); ShowComments(); return (0); } int ShowComments() { SetCurrenciesAndLotSize(); SetForwardActions(); string ls_unused_0 = ""; if (gi_512 == 60) ls_unused_0 = "Hourly"; if (gi_512 == 240) ls_unused_0 = "4 Hour"; if (gi_512 == 1440) ls_unused_0 = "Daily"; if (gi_512 == 30) ls_unused_0 = "30 Minute"; if (gi_512 == 15) ls_unused_0 = "15 Minute"; if (gi_512 == 1) ls_unused_0 = "1 Minute"; if (gi_512 == 5) ls_unused_0 = "5 Minute"; double ld_8 = gd_464 / 100.0; double ld_16 = gd_548 - gd_556; double ld_24 = ld_16 * ld_8; double ld_32 = gd_564 - gd_572; double ld_40 = ld_32 * ld_8; int li_48 = gi_1168; if (DisplayLevel != 0) gi_1168 = DisplayLevel; if (gi_1264 >= gi_1168) gi_392 = TRUE; if (gi_1264 < gi_1168) gi_392 = FALSE; if (gi_1268 > gi_1168) gi_396 = FALSE; if (gi_1268 <= gi_1168) gi_396 = TRUE; gi_1172 = gi_392; gi_1176 = gi_396; string ls_52 = "True"; if (DoTrades == FALSE) ls_52 = "False"; string ls_60 = "True"; if (gi_1172 == FALSE) ls_60 = "False"; string ls_68 = "True"; if (gi_1176 == FALSE) ls_68 = "False"; string ls_unused_76 = "False"; if (gi_112 == TRUE) ls_unused_76 = "True"; double ld_84 = gd_240 + gi_228 * gi_232 * Point; if (gi_1168 > gi_1264) { if (gi_1292 == FALSE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nShort Open for Range " + gi_1168 + " = " + DoubleToStr(gda_488[gi_1168], Digits) + "\nShort Close for Range " + gi_1168 + " = " + DoubleToStr(gda_492[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") "); } if (gi_1292 == TRUE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nShort Open for Range " + gi_1168 + " = " + DoubleToStr(gda_488[gi_1168], Digits) + "\nShort Close for Range " + gi_1168 + " = " + DoubleToStr(gda_492[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1168 < gi_1264) { if (gi_1292 == FALSE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nLong Open for Range " + gi_1168 + " = " + DoubleToStr(gda_480[gi_1168], Digits) + "\nLong Close for Range " + gi_1168 + " = " + DoubleToStr(gda_484[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") "); } if (gi_1292 == TRUE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nLong Open for Range " + gi_1168 + " = " + DoubleToStr(gda_480[gi_1168], Digits) + "\nLong Close for Range " + gi_1168 + " = " + DoubleToStr(gda_484[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1168 == gi_1264) { if (gi_1292 == FALSE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nLong Open for Range " + gi_1168 + " = " + DoubleToStr(gda_480[gi_1168], Digits) + "\nLong Close for Range " + gi_1168 + " = " + DoubleToStr(gda_484[gi_1168], Digits) + "\nShort Open for Range " + gi_1168 + " = " + DoubleToStr(gda_488[gi_1168], Digits) + "\nShort Close for Range " + gi_1168 + " = " + DoubleToStr(gda_492[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") "); } if (gi_1292 == TRUE && gi_1160 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_84 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_804, Digits) + "\nCurrent Range = " + gi_1168 + "\n\nLong Open for Range " + gi_1168 + " = " + DoubleToStr(gda_480[gi_1168], Digits) + "\nLong Close for Range " + gi_1168 + " = " + DoubleToStr(gda_484[gi_1168], Digits) + "\nShort Open for Range " + gi_1168 + " = " + DoubleToStr(gda_488[gi_1168], Digits) + "\nShort Close for Range " + gi_1168 + " = " + DoubleToStr(gda_492[gi_1168], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_240, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1296 + "\nLast Range = " + gi_1300 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_200 + "\nTradeRange = " + gi_232 + "\nTradeWindow = " + DoubleToStr(gd_1184, Digits) + "\n\nPrice " + gi_460 + " Day High = " + DoubleToStr(g_ihigh_1248, Digits) + " (" + gi_1276 + ") " + "\nPrice " + gi_460 + " Day Low = " + DoubleToStr(g_ilow_1256, Digits) + " (" + gi_1280 + ") " + "\nPrice " + gi_460 + " Day Mid-Range = " + DoubleToStr(gd_1240, Digits) + " (" + gi_1272 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1180[gi_1168], 2) + "\n\nLots1 = " + DoubleToStr(gd_852, gi_296) + " " + g_symbol_516 + " " + gia_496[gi_1168] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_516), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_296 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1264 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1268 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } gi_1168 = li_48; return (0); } double EAProfit() { double ld_ret_0 = 0.0; if (search_for(gia_496[gi_1164]) != 0) ld_ret_0 += OrderProfit(); return (ld_ret_0); } int search_for(int a_magic_0) { g_ord_total_948 = OrdersTotal(); for (int l_pos_4 = g_ord_total_948 - 1; l_pos_4 >= 0; l_pos_4--) { if (!OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { g_error_952 = GetLastError(); Print("OrderSelect( ", l_pos_4, ", SELECT_BY_POS ) - Error #", g_error_952); } else { if (OrderMagicNumber() == a_magic_0) if (OrderCloseTime() == 0) return (a_magic_0); } } return (0); } int search_for_conflict(int a_magic_0) { bool li_4 = FALSE; g_ord_total_948 = OrdersTotal(); for (int l_pos_8 = g_ord_total_948 - 1; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { g_error_952 = GetLastError(); Print("OrderSelect( ", l_pos_8, ", SELECT_BY_POS ) - Error #", g_error_952); } else { if (OrderMagicNumber() == a_magic_0) { if (OrderCloseTime() == 0) { if (OrderSymbol() != Symbol()) { if (OrderSymbol() != Symbol()) li_4 = TRUE; if (li_4 == TRUE) return (1); } } } } } return (0); } double AddLots(string a_symbol_0) { double ld_ret_8 = 0.0; g_ord_total_948 = OrdersTotal(); for (int l_pos_16 = g_ord_total_948 - 1; l_pos_16 >= 0; l_pos_16--) { if (!OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES)) { g_error_952 = GetLastError(); Print("OrderSelect( ", l_pos_16, ", SELECT_BY_POS ) - Error #", g_error_952); } else { if (OrderSymbol() == a_symbol_0) { if (OrderCloseTime() == 0) { if (OrderType() == OP_BUY) ld_ret_8 += OrderLots(); if (OrderType() == OP_SELL) ld_ret_8 -= OrderLots(); } } } } return (ld_ret_8); } int open_buy_market(int a_magic_0, double a_lots_4, string a_symbol_12) { int l_slippage_20 = gi_300; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1308 == TRUE && gi_1160 == TRUE) { l_price_32 = gda_480[gi_1164] + gi_232 * MarketInfo(a_symbol_12, MODE_POINT); l_price_32 = NormalizeDouble(l_price_32, MarketInfo(a_symbol_12, MODE_DIGITS)); } string l_comment_40 = g_comment_1192; g_comment_1192 = g_comment_1192 + DoubleToStr(gd_804, g_digits_1232) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_956) { if (gi_300 != 0 && gi_1160 == TRUE && Ask - gd_304 < gi_300 * Point) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, l_price_32, g_comment_1192, a_magic_0, 0, CLR_NONE); if (gi_300 == 0 || gi_1160 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, 0.0, g_comment_1192, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_956) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_952 = GetLastError(); if (gi_208 == TRUE) Alert("Error OrderSend # ", g_error_952); } g_comment_1192 = l_comment_40; return (0); } int open_sell_market(int a_magic_0, double a_lots_4, string a_symbol_12) { int l_slippage_20 = gi_300; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1308 == TRUE && gi_1160 == TRUE) { l_price_32 = gda_488[gi_1164] - gi_232 * MarketInfo(a_symbol_12, MODE_POINT); l_price_32 = NormalizeDouble(l_price_32, MarketInfo(a_symbol_12, MODE_DIGITS)); } string l_comment_40 = g_comment_1192; g_comment_1192 = g_comment_1192 + DoubleToStr(gd_804, g_digits_1232) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_956) { if (gi_300 != 0 && gi_1160 == TRUE && gd_304 - Bid < gi_300 * Point) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, l_price_32, g_comment_1192, a_magic_0, 0, CLR_NONE); if (gi_300 == 0 || gi_1160 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, 0.0, g_comment_1192, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_956) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_952 = GetLastError(); if (gi_208 == TRUE) Alert("Error OrderSend # ", g_error_952); } g_comment_1192 = l_comment_40; return (0); } int Close_it() { if (gi_212 == TRUE && OrderTakeProfit() != 0.0 && OrderProfit() + OrderSwap() < 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 0.0, OrderExpiration(), CLR_NONE); if ((gi_212 == TRUE && OrderProfit() + OrderSwap() > 0.0) || gi_212 == FALSE) { if (OrderType() == OP_BUY) { if (gi_300 != 0 && gi_1160 == TRUE && gd_304 - Bid < gi_300 * Point) close_buy(); if (gi_300 == 0 || gi_1160 == FALSE) close_buy(); } if (OrderType() == OP_SELL) { if (gi_300 != 0 && gi_1160 == TRUE && Ask - gd_304 < gi_300 * Point) close_sell(); if (gi_300 == 0 || gi_1160 == FALSE) close_sell(); } } return (0); } int OpenAll() { if (gs_1072 == "Sell") open_sell_market(gia_496[gi_1164], gd_852, g_symbol_516); if (gs_1072 == "Buy") open_buy_market(gia_496[gi_1164], gd_852, g_symbol_516); return (0); } int CloseAll() { int l_count_0 = 0; while (l_count_0 < 4) { l_count_0++; if (search_for(gia_496[gi_1164]) != 0) Close_it(); } return (0); } int scanfororders() { int l_count_0 = 0; int li_4 = search_for(gia_496[gi_1164]); if (li_4 == gia_496[gi_1164]) l_count_0++; return (l_count_0); } int scanfororders2() { bool li_ret_0 = FALSE; int li_4 = search_for(gia_496[gi_1164]); if (li_4 == gia_496[gi_1164]) { if (gs_1072 == "Sell" && OrderType() == OP_SELL) gi_1112 = FALSE; if (gs_1072 == "Buy" && OrderType() == OP_BUY) gi_1112 = FALSE; if (gs_1072 == "Buy" && OrderType() == OP_SELL) gi_1112 = TRUE; if (gs_1072 == "Sell" && OrderType() == OP_BUY) gi_1112 = TRUE; } return (li_ret_0); } int close_buy() { int l_slippage_0 = gi_300; g_count_960 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_960 <= 0) { if (gi_300 != 0 && gi_1160 == TRUE && gd_304 - Bid < gi_300 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); if (gi_300 == 0 || gi_1160 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); g_count_960++; if (l_ord_close_4) break; if (g_count_960 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_952 = GetLastError(); if (gi_208 == TRUE) Alert("Error OrderClose # ", g_error_952); return (-1); } return (0); } int close_sell() { int l_slippage_0 = gi_300; g_count_960 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_960 <= 0) { if (gi_300 != 0 && gi_1160 == TRUE && Ask - gd_304 < gi_300 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); if (gi_300 == 0 || gi_1160 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); g_count_960++; if (l_ord_close_4) break; if (g_count_960 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_952 = GetLastError(); if (gi_208 == TRUE) Alert("?????? OrderClose No ", g_error_952); return (-1); } return (0); } double CalculateLots() { double l_minlot_0 = MarketInfo(Symbol(), MODE_MINLOT); double l_maxlot_8 = MarketInfo(Symbol(), MODE_MAXLOT); double ld_ret_16 = 0.0; bool li_24 = FALSE; double l_lotsize_28 = MarketInfo(Symbol(), MODE_LOTSIZE); if (MarketInfo(Symbol(), MODE_MINLOT) < 1.0) gi_296 = 1; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.1) gi_296 = 2; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.01) gi_296 = 3; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.001) gi_296 = 4; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.0001) gi_296 = 5; if (Lots > 0.0) ld_ret_16 = Lots; if (ld_ret_16 > 0.0) { if (ld_ret_16 < l_minlot_0) ld_ret_16 = l_minlot_0; if (ld_ret_16 > l_maxlot_8) ld_ret_16 = l_maxlot_8; ld_ret_16 = NormalizeDouble(ld_ret_16, gi_296); return (ld_ret_16); } double ld_36 = AccountBalance(); double ld_44 = BalanceFactor; if (ld_44 < 2000.0) { if (AccountBalance() < 12000.0) ld_44 = 3500.0; if (AccountBalance() >= 12000.0 && AccountBalance() < 22500.0) ld_44 = 4000.0; if (AccountBalance() >= 22500.0 && AccountBalance() < 35000.0) ld_44 = 4500.0; if (AccountBalance() >= 35000.0 && AccountBalance() < 60000.0) ld_44 = 5000.0; if (AccountBalance() >= 60000.0 && AccountBalance() < 100000.0) ld_44 = 6000.0; if (AccountBalance() >= 100000.0) ld_44 = 7500.0; } ld_44 /= 100000 / l_lotsize_28; gi_1292 = FALSE; if (ld_36 < ld_44) gi_1292 = TRUE; li_24 = ld_36 / ld_44; ld_ret_16 = li_24 / 100.0; ld_ret_16 = NormalizeDouble(ld_ret_16, gi_296); if (ld_ret_16 < l_minlot_0) ld_ret_16 = l_minlot_0; if (ld_ret_16 > l_maxlot_8) ld_ret_16 = l_maxlot_8; ld_ret_16 = NormalizeDouble(ld_ret_16, gi_296); if (gi_1312 == FALSE && ld_ret_16 > 0.09 && ld_36 < 10000.0 && l_lotsize_28 == 100000.0) { Alert("Is your account set to trade only 1 decimal place for lots? Your account balance should be higher for this lot size!"); gi_1312 = TRUE; } if (gi_1312 == FALSE && ld_ret_16 > 0.09 && ld_36 < 1000.0 && l_lotsize_28 == 10000.0) { Alert("Is your account set to trade only 1 decimal place for lots? Your account balance should be higher for this lot size!"); gi_1312 = TRUE; } if (gi_1312 == FALSE && gi_296 == 1) { Alert("Is your account set to trade only 1 decimal place for lots? We recommend 2 decimal places for lot sizes if possible!"); gi_1312 = TRUE; } return (ld_ret_16); } int SetForwardActions() { gs_1072 = "Buy"; return (0); } int SetReverseActions() { gs_1072 = "Sell"; return (0); } int CalculateHighsAndLows() { gd_804 = CalculateTurboProfit("current"); if (Minute() > 10) gi_1120 = FALSE; if (Minute() < 10 && gi_1120 == FALSE) { gd_564 = -10000000.0; gd_572 = 10000000.0; gi_1120 = TRUE; } if (gd_548 < gd_804) gd_548 = gd_804; if (gd_564 < gd_804) gd_564 = gd_804; if (gd_556 > gd_804) gd_556 = gd_804; if (gd_572 > gd_804) gd_572 = gd_804; if (gd_572 == 0.0) gd_572 = gd_804; if (gd_580 < AccountEquity()) gd_580 = AccountEquity(); if (gd_588 > AccountEquity()) gd_588 = AccountEquity(); if (g_free_magrin_604 < AccountFreeMargin()) g_free_magrin_604 = AccountFreeMargin(); if (g_free_magrin_596 > AccountFreeMargin()) g_free_magrin_596 = AccountFreeMargin(); if (gd_612 < AccountBalance()) gd_612 = AccountBalance(); if (gd_620 > AccountBalance()) gd_620 = AccountBalance(); return (0); } int SetCurrenciesAndLotSize() { g_symbol_516 = Symbol(); g_lotsize_984 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_984 == 0.0) g_lotsize_984 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_984 == 100000.0) gd_unused_992 = 0.1; if (g_lotsize_984 == 10000.0) gd_unused_992 = 0.01; SetForwardActions(); if (StringLen(StringTrimLeft(gs_1072)) < 2) g_symbol_516 = " "; if (StringLen(StringTrimLeft(g_symbol_516)) < 2) gs_1072 = " "; return (0); } double CalculateTurboProfit(string as_0) { if ((gi_1160 == TRUE && as_0 == "current") || (gi_1160 == TRUE && as_0 == "ask" && AllowForSpread == FALSE)) g_price_788 = Bid; if (gi_1160 == TRUE && as_0 == "ask" && AllowForSpread == TRUE) g_price_788 = Ask; if (gi_1160 == TRUE && as_0 == "average") g_price_788 = gma(g_symbol_516); return (g_price_788); } double gma(string a_symbol_0) { double l_ima_8 = 0.0; int l_period_16 = gi_256; if (l_period_16 == 0) l_period_16 = 36; int li_20 = 0; int l_timeframe_24 = 60; l_ima_8 = iMA(a_symbol_0, l_timeframe_24, l_period_16, li_20, MODE_SMA, PRICE_TYPICAL, 0); return (l_ima_8); } int Decoder() { int li_unused_0 = 0; bool li_4 = FALSE; int l_acc_number_8 = AccountNumber(); int li_12 = StrToInteger(StringSubstr(gs_96, 1, 2)) - 2; int li_16 = StrToInteger(StringSubstr(gs_96, 3, 2)) - 3; string l_dbl2str_20 = DoubleToStr(StrToInteger(StringSubstr(gs_96, 5, 2)) - 2, 0); string ls_28 = StringSubstr(gs_96, 7, 1); string ls_36 = StringSubstr(gs_96, 8, 1); string ls_44 = ls_36 + ls_28; ls_36 = DoubleToStr(StrToInteger(ls_44) - 2, 0); string ls_52 = l_dbl2str_20 + ls_36; int l_str2int_60 = StrToInteger(ls_52); string ls_64 = StringSubstr(gs_96, 0, 1) + StringSubstr(gs_96, 9, StringLen(gs_96) - 9); int li_72 = StrToInteger(ls_64); li_72 += 177; li_72 /= 3; li_72 += 13; li_72 /= 2; if (!IsDemo() && li_72 == l_acc_number_8 && li_4 == FALSE) li_unused_0 = 1; if (IsDemo() && li_4 == FALSE) li_unused_0 = 1; return (1); } double StartPoint() { double l_acc_number_0 = AccountNumber(); string l_dbl2str_8 = DoubleToStr(l_acc_number_0, 0); int l_str2int_16 = StrToInteger(StringSubstr(l_dbl2str_8, StringLen(l_dbl2str_8) - 2, 2)); return (l_str2int_16); } bool License(int ai_0 = 0, int ai_4 = 0, string as_8 = "") { bool li_ret_16 = FALSE; bool li_20 = FALSE; bool li_24 = FALSE; bool li_28 = FALSE; if (TimeCurrent() < ai_0) li_20 = TRUE; if (AccountNumber() == ai_4) li_24 = TRUE; if (AccountCompany() == as_8) li_28 = TRUE; if (ai_0 > 0 && ai_4 > 0 && StringLen(as_8) > 0) { if (li_20 && li_24 && li_28) li_ret_16 = TRUE; } else { if (ai_0 > 0 && ai_4 > 0 && StringLen(as_8) <= 0) { if (li_20 && li_24) li_ret_16 = TRUE; } else { if (ai_0 > 0 && ai_4 <= 0 && StringLen(as_8) > 0) { if (li_20 && li_28) li_ret_16 = TRUE; } else { if (ai_0 <= 0 && ai_4 > 0 && StringLen(as_8) > 0) { if (li_24 && li_28) li_ret_16 = TRUE; } else { if (ai_0 > 0 && ai_4 <= 0 && StringLen(as_8) <= 0) { if (li_20) li_ret_16 = TRUE; } else { if (ai_0 <= 0 && ai_4 > 0 && StringLen(as_8) <= 0) { if (li_24) li_ret_16 = TRUE; } else { if (ai_0 <= 0 && ai_4 <= 0 && StringLen(as_8) > 0) if (li_28) li_ret_16 = TRUE; } } } } } } if (IsDemo()) li_ret_16 = TRUE; if (IsTesting()) li_ret_16 = TRUE; return (li_ret_16); }