#property copyright "RoboMiner" #property link "http://www.forex-goldmine.com" string gs_76 = "RoboMiner 2.12"; extern string Version = "RoboMiner 2.12"; extern string webpage = "http://www.forex-goldmine.com"; string gs_100 = "http://www.forex-goldmine.com"; extern int DisplayLevel = 0; extern string UnlockCode = "Put Unlock Code Here "; extern bool AllowForSpread = TRUE; extern bool DoTrades = TRUE; bool gi_128 = FALSE; string gs_unused_132 = "If set to false, then ranges will be 40 pips."; bool gi_140 = 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_184 = "AUDNZD at 50 pips: 1=40, 2=30, 3=24"; string gs_unused_192 = "AUDNZD at 40 pips: 1=50, 2=36"; string gs_unused_200 = "EURCHF at 50 pips: 1=51, 2=42"; string gs_unused_208 = "EURCHF at 40 pips: 1=64, 2=50"; int gi_216 = 1; extern int MagicNumber1 = 510001; bool gi_224 = FALSE; bool gi_228 = TRUE; int gi_232 = 15; int gi_236 = 15; int gi_240 = 0; int gi_244 = 29; int gi_248 = 50; int gi_252 = 0; double gd_256 = 1.07; int gi_264 = 0; int gi_268 = 5; int gi_272 = 0; string gs_unused_276 = "-----------------------------------------------"; bool gi_unused_284 = FALSE; string gs_unused_288 = "Leave as 0 to use actual account balance."; double gd_unused_296 = 0.0; double gd_unused_304 = 0.25; int gi_312 = 2; int gi_316 = 25; double gd_320 = 0.0; string gs_unused_328 = "Leave Lots 0.00 for Auto-Calculation"; bool gi_unused_336 = FALSE; bool gi_unused_340 = FALSE; bool gi_344 = TRUE; string gs_unused_348 = "-----------------------------------------------"; double gd_unused_356 = 0.0; double gd_unused_364 = 0.0; bool gi_unused_372 = FALSE; bool gi_unused_376 = FALSE; bool gi_unused_380 = FALSE; bool gi_unused_384 = FALSE; bool gi_unused_388 = FALSE; bool gi_unused_392 = FALSE; int gi_unused_396 = 1; string gs_unused_400 = "-----------------------------------------------"; bool gi_408 = FALSE; bool gi_412 = FALSE; double gd_unused_416 = 0.0; double gd_unused_424 = 0.0; double gd_unused_432 = 0.0; double gd_unused_440 = 0.0; string gs_unused_448 = "-----------------------------------------------"; double gd_unused_456 = 0.0; bool gi_unused_464 = FALSE; string gs_unused_468 = "------------------------------------------------"; int gi_476 = 90; double gd_480 = 15.0; bool gi_unused_488 = FALSE; bool gi_unused_492 = FALSE; double gda_496[101]; double gda_500[101]; double gda_504[101]; double gda_508[101]; int gia_512[101]; double gd_unused_516 = 0.0; int gi_unused_524 = 1440; int gi_528 = 60; string g_symbol_532 = " "; string gs_unused_540 = " "; string gs_unused_548 = " "; string gs_unused_556 = " "; double gd_564 = -1000000.0; double gd_572 = 1000000.0; double gd_580 = -1000000.0; double gd_588 = 1000000.0; double gd_596 = 0.0; double gd_604 = 0.0; double g_free_magrin_612 = 0.0; double g_free_magrin_620 = 0.0; double gd_628 = 0.0; double gd_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 gd_unused_788 = 0.0; double gd_unused_796 = 0.0; double g_price_804 = 0.0; double gd_unused_812 = 0.0; double gd_820 = 0.0; double gd_828 = 0.0; double gd_unused_836 = 0.0; double gd_unused_844 = 0.0; double gd_unused_852 = 0.0; double gd_unused_860 = 0.0; double gd_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; double gd_unused_948 = 0.0; double gd_unused_956 = 0.0; int g_ord_total_964 = 0; int g_error_968 = 0/* NO_ERROR */; int gi_972 = 10; int g_count_976 = 4; int gi_unused_980 = 0; double gd_unused_984 = 0.0; double gd_unused_992 = 0.0; double g_lotsize_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; double gd_unused_1072 = 0.0; double gd_unused_1080 = 0.0; string gs_1088 = " "; string gs_unused_1096 = " "; string gs_unused_1104 = " "; string gs_unused_1112 = " "; int gi_unused_1120 = 0; int gi_1124 = 0; bool gi_1128 = FALSE; int gi_unused_1132 = 0; int gi_1136 = 0; double gd_unused_1140 = 0.0; double gd_unused_1148 = 0.0; double gd_unused_1156 = 0.0; int gi_unused_1164 = 0; int gi_unused_1168 = 0; bool gi_1172 = FALSE; bool gi_1176 = FALSE; int gi_1180 = 0; int gi_1184 = 0; bool gi_1188 = FALSE; bool gi_1192 = FALSE; double gda_1196[101]; double gd_1200 = 0.0; string g_comment_1208 = " "; string gs_unused_1216 = " "; string gs_unused_1224 = " "; string gs_unused_1232 = " "; string gs_unused_1240 = " "; int g_digits_1248 = 2; bool gi_1252 = TRUE; double gd_1256 = 0.0; double g_ihigh_1264 = 0.0; double g_ilow_1272 = 0.0; int gi_1280 = 0; int gi_1284 = 0; int gi_1288 = 0; int gi_1292 = 0; int gi_1296 = 0; double gd_unused_1300 = 0.0; int gi_1308 = 0; int gi_1312 = 0; int gi_1316 = 0; int g_count_1320 = 0; bool gi_1324 = TRUE; int gi_1328 = 0; int init() { int li_4; // 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); } } if (gi_128 == TRUE) gi_1252 = FALSE; if (gi_128 == FALSE) gi_1252 = TRUE; gi_1328 = FALSE; if (gi_216 != 1 && gi_216 != 2 && gi_216 != 3 && gi_216 != 9 && gi_216 < 10) gi_216 = 2; if (gi_140 == TRUE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_216 == 2) { gd_256 = 1.07; gd_256 = StartPoint() * Point + 1.065; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.065; gi_248 = 50; gi_1312 = 7; gi_244 = 40; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 27; gi_236 = 27; } if (gi_216 == 1) { gd_256 = 1.045; gd_256 = StartPoint() * Point + 1.04; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.04; gi_248 = 50; gi_1312 = 2; gi_244 = 54; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 27; gi_236 = 27; } if (gi_216 == 3) { gd_256 = 1.085; gd_256 = StartPoint() * Point + 1.08; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.08; gi_248 = 50; gi_1312 = 10; gi_244 = 30; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 27; gi_236 = 27; } if (gi_216 == 9) { gd_256 = 1.04; gd_256 = StartPoint() * Point + 1.035; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.035; gi_248 = 50; gi_1312 = 1; gi_244 = 54; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 27; gi_236 = 27; } if (gi_216 > 9) { gd_256 = 1.04; gd_256 = StartPoint() * Point + 1.035; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.035; gi_248 = 50; gi_1312 = 1; gi_244 = gi_216; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = gi_244 / 2; gi_236 = gi_244 / 2; } } if (Symbol() == "EURCHF" || Symbol() == "EURCHFm" || StringSubstr(Symbol(), 0, 6) == "EURCHF") { if (gi_216 == 2) { gd_256 = 1.459; gd_256 = StartPoint() * Point + 1.454; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 50; gi_1312 = 5; gi_244 = 42; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 26; gi_236 = 26; } if (gi_216 == 1) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 50; gi_1312 = 1; gi_244 = 52; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 26; gi_236 = 26; } if (gi_216 == 3) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 50; gi_1312 = 1; gi_244 = 52; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 26; gi_236 = 26; } if (gi_216 == 9) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 50; gi_1312 = 1; gi_244 = 52; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 26; gi_236 = 26; } if (gi_216 > 9) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 50; gi_1312 = 1; gi_244 = gi_216; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = gi_244 / 2; gi_236 = gi_244 / 2; } } } if (gi_140 == FALSE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_216 == 2) { gd_256 = 1.07; gd_256 = StartPoint() * Point + 1.065; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.065; gi_248 = 40; gi_1312 = 8; gi_244 = 50; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 33; gi_236 = 33; } if (gi_216 == 1) { gd_256 = 1.042; gd_256 = StartPoint() * Point + 1.037; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.037; gi_248 = 40; gi_1312 = 1; gi_244 = 66; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 33; gi_236 = 33; } if (gi_216 == 3) { gd_256 = 1.07; gd_256 = StartPoint() * Point + 1.065; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.065; gi_248 = 40; gi_1312 = 8; gi_244 = 50; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 33; gi_236 = 33; } if (gi_216 == 9) { gd_256 = 1.042; gd_256 = StartPoint() * Point + 1.037; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.037; gi_248 = 40; gi_1312 = 1; gi_244 = 66; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 33; gi_236 = 33; } if (gi_216 > 9) { gd_256 = 1.042; gd_256 = StartPoint() * Point + 1.037; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.037; gi_248 = 40; gi_1312 = 1; gi_244 = gi_216; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = gi_244 / 2; gi_236 = gi_244 / 2; } } if (Symbol() == "EURCHF" || Symbol() == "EURCHFm" || StringSubstr(Symbol(), 0, 6) == "EURCHF") { if (gi_216 == 2) { gd_256 = 1.463; gd_256 = StartPoint() * Point + 1.458; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.458; gi_248 = 40; gi_1312 = 7; gi_244 = 50; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 31; gi_236 = 31; } if (gi_216 == 1) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 40; gi_1312 = 1; gi_244 = 64; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 31; gi_236 = 31; } if (gi_216 == 3) { gd_256 = 1.463; gd_256 = StartPoint() * Point + 1.458; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.458; gi_248 = 40; gi_1312 = 7; gi_244 = 50; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 31; gi_236 = 31; } if (gi_216 == 9) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 40; gi_1312 = 1; gi_244 = 64; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = 31; gi_236 = 31; } if (gi_216 > 9) { gd_256 = 1.439; gd_256 = StartPoint() * Point + 1.434; if (Digits == 5) gd_256 = 10.0 * StartPoint() * Point + 1.434; gi_248 = 40; gi_1312 = 1; gi_244 = gi_216; gi_1316 = gi_1312 + gi_244 - 1; gi_232 = gi_244 / 2; gi_236 = gi_244 / 2; } } } if (Digits == 5) { gi_248 = 10 * gi_248; gi_268 = 50; gi_316 = 160; } CalculateHighsAndLows(); gi_1176 = TRUE; g_symbol_532 = Symbol(); if (gi_1176 == TRUE) g_comment_1208 = "RoboMiner Bid "; if (gi_1176 == FALSE) g_comment_1208 = "RoboMiner SP "; if (gi_1176 == TRUE) g_digits_1248 = Digits; if (gi_1176 == FALSE) g_digits_1248 = 2; gi_unused_1168 = 0; ArrayInitialize(gda_496, 0.0); ArrayInitialize(gda_500, 0.0); ArrayInitialize(gda_504, 0.0); ArrayInitialize(gda_508, 0.0); ArrayInitialize(gia_512, 0); ArrayInitialize(gda_1196, 0.0); g_count_1320 = 0; gi_1180 = gi_1312 - 1; while (gi_1180 < gi_1316) { gi_1180++; g_count_1320++; gda_496[gi_1180] = gd_256 + (gi_248 * Point + gi_252 * Point) * (g_count_1320 - 1); gda_500[gi_1180] = gda_496[gi_1180] + gi_248 * Point; gda_504[gi_1180] = gda_500[gi_1180]; gda_508[gi_1180] = gda_496[gi_1180]; gda_496[gi_1180] += gi_264 * Point; gda_500[gi_1180] += gi_264 * Point; gda_504[gi_1180] += gi_264 * Point; gda_508[gi_1180] += gi_264 * Point; gd_1200 = gi_268 * (1.0 * Point); gda_1196[gi_1180] = EAProfit(); gia_512[gi_1180] = MagicNumber1 + (gi_1180 - 1); gda_1196[gi_1180] = EAProfit(); } gd_868 = CalculateLots(); SetCurrenciesAndLotSize(); SetForwardActions(); gi_1180 = gi_1312; gd_820 = CalculateShadowProfit("current"); g_ilow_1272 = 10000.0; g_ilow_1272 = iLow(g_symbol_532, PERIOD_D1, 0); for (int li_0 = 0; li_0 <= gi_476; li_0++) if (iLow(g_symbol_532, PERIOD_D1, li_0) < g_ilow_1272) g_ilow_1272 = iLow(g_symbol_532, PERIOD_D1, li_0); g_ihigh_1264 = 0.0; g_ihigh_1264 = iHigh(g_symbol_532, PERIOD_D1, 0); for (li_0 = 0; li_0 <= gi_476; li_0++) if (iHigh(g_symbol_532, PERIOD_D1, li_0) > g_ihigh_1264) g_ihigh_1264 = iHigh(g_symbol_532, PERIOD_D1, li_0); g_ihigh_1264 = NormalizeDouble(g_ihigh_1264, Digits); g_ilow_1272 = NormalizeDouble(g_ilow_1272, Digits); gd_1256 = (g_ihigh_1264 + g_ilow_1272) / 2.0; gd_1256 = NormalizeDouble(gd_1256, Digits); gi_1180 = gi_1312 - 1; while (gi_1180 < gi_1316) { gi_1180++; if (gi_1280 >= gi_1180) gi_408 = TRUE; if (gi_1280 < gi_1180) gi_408 = FALSE; if (gi_1284 > gi_1180) gi_412 = FALSE; if (gi_1284 <= gi_1180) gi_412 = TRUE; if (gd_820 >= gda_496[gi_1180] && gd_820 <= gda_500[gi_1180]) { gi_1184 = gi_1180; gi_1188 = gi_408; gi_1192 = gi_412; } if (gd_1256 >= gda_496[gi_1180] && gd_1256 <= gda_500[gi_1180]) gi_1288 = gi_1180; if (g_ihigh_1264 >= gda_496[gi_1180] && g_ihigh_1264 <= gda_500[gi_1180]) gi_1292 = gi_1180; if (g_ilow_1272 >= gda_496[gi_1180] && g_ilow_1272 <= gda_500[gi_1180]) gi_1296 = gi_1180; gda_1196[gi_1180] = EAProfit(); } gi_1280 = gi_232; gi_1284 = gi_236; if (gi_240 == 1 && gd_820 > gd_1256) { if (gi_232 == 0 && gi_1292 != 0) gi_1280 = gi_1292 - 1; if (gi_236 == 0 && gi_1288 != 0) gi_1284 = gi_1288; } if (gi_240 == 1 && gd_820 < gd_1256) { if (gi_236 == 0 && gi_1296 != 0) gi_1284 = gi_1296 + 1; if (gi_232 == 0 && gi_1288 != 0) gi_1280 = gi_1288; } if (gi_240 == 0) { if (gi_1280 == 0) gi_1280 = gi_1288; if (gi_1284 == 0) gi_1284 = gi_1288; } if (gi_1280 == 0) gi_1280 = gi_244; if (gi_1284 == 0) gi_1284 = 1; gi_1180 = gi_1312 - 1; while (gi_1180 < gi_1316) { gi_1180++; li_4 = search_for_conflict(gia_512[gi_1180]); if (li_4 == 1) break; } if (li_4 == 1) { Comment("\nMagic Number Conflict With Another Pair..."); return (-1); } ShowComments(); return (0); } int deinit() { return (0); } int start() { int li_0; // 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_1180 = gi_1312 - 1; while (gi_1180 < gi_1316) { gi_1180++; li_0 = search_for_conflict(gia_512[gi_1180]); if (li_0 == 1) break; } if (li_0 == 1) { Comment("\nMagic Number Conflict With Another Pair..."); return (-1); } if (gi_128 == TRUE) gi_1252 = FALSE; if (gi_128 == FALSE) gi_1252 = TRUE; g_ilow_1272 = 10000.0; g_ilow_1272 = iLow(g_symbol_532, PERIOD_D1, 0); for (int li_4 = 0; li_4 <= gi_476; li_4++) if (iLow(g_symbol_532, PERIOD_D1, li_4) < g_ilow_1272) g_ilow_1272 = iLow(g_symbol_532, PERIOD_D1, li_4); g_ihigh_1264 = 0.0; g_ihigh_1264 = iHigh(g_symbol_532, PERIOD_D1, 0); for (li_4 = 0; li_4 <= gi_476; li_4++) if (iHigh(g_symbol_532, PERIOD_D1, li_4) > g_ihigh_1264) g_ihigh_1264 = iHigh(g_symbol_532, PERIOD_D1, li_4); g_ihigh_1264 = NormalizeDouble(g_ihigh_1264, Digits); g_ilow_1272 = NormalizeDouble(g_ilow_1272, Digits); gd_1256 = (g_ihigh_1264 + g_ilow_1272) / 2.0; gd_1256 = NormalizeDouble(gd_1256, Digits); gi_1280 = gi_232; gi_1284 = gi_236; if (gi_240 == 1 && gd_820 > gd_1256) { if (gi_232 == 0 && gi_1292 != 0) gi_1280 = gi_1292 - 1; if (gi_236 == 0 && gi_1288 != 0) gi_1284 = gi_1288; } if (gi_240 == 1 && gd_820 < gd_1256) { if (gi_236 == 0 && gi_1296 != 0) gi_1284 = gi_1296 + 1; if (gi_232 == 0 && gi_1288 != 0) gi_1280 = gi_1288; } if (gi_240 == 0) { if (gi_1280 == 0) gi_1280 = gi_1288; if (gi_1284 == 0) gi_1284 = gi_1288; } if (gi_1280 == 0) gi_1280 = gi_244; if (gi_1284 == 0) gi_1284 = 1; SetCurrenciesAndLotSize(); SetForwardActions(); gi_1180 = gi_1312; gd_868 = CalculateLots(); gd_820 = CalculateShadowProfit("current"); gd_828 = CalculateShadowProfit("average"); if (gd_820 != 0.0) { gi_1180 = gi_1312 - 1; while (gi_1180 < gi_1316) { gi_1180++; if (gi_1280 >= gi_1180) gi_408 = TRUE; if (gi_1280 < gi_1180) gi_408 = FALSE; if (gi_1284 > gi_1180) gi_412 = FALSE; if (gi_1284 <= gi_1180) gi_412 = TRUE; if (gd_820 >= gda_496[gi_1180] && gd_820 <= gda_500[gi_1180]) { gi_1184 = gi_1180; gi_1188 = gi_408; gi_1192 = gi_412; } if (gd_1256 >= gda_496[gi_1180] && gd_1256 <= gda_500[gi_1180]) gi_1288 = gi_1180; if (g_ihigh_1264 >= gda_496[gi_1180] && g_ihigh_1264 <= gda_500[gi_1180]) gi_1292 = gi_1180; if (g_ilow_1272 >= gda_496[gi_1180] && g_ilow_1272 <= gda_500[gi_1180]) gi_1296 = gi_1180; gda_1196[gi_1180] = EAProfit(); if (DoTrades == TRUE) { scanfororders2(); if (gi_1252 == FALSE) CloseAll(); if (AllowForSpread == TRUE) gd_820 = CalculateShadowProfit("ask"); if (AllowForSpread == FALSE) gd_820 = CalculateShadowProfit("current"); if (gi_1172 == FALSE && scanfororders() == 0 && (gi_344 == FALSE && gd_820 <= gda_496[gi_1180]) || (gi_344 == TRUE && (gi_272 != 0 && gd_820 > gd_828) || gi_272 == 0 && gd_820 <= gda_496[gi_1180] && gd_820 >= gda_496[gi_1180] - gd_1200) && gi_1252 == TRUE && gi_408 == TRUE) { gd_320 = gd_820; SetForwardActions(); OpenAll(); gi_unused_980 = 1; gd_820 = CalculateShadowProfit("current"); gi_1128 = FALSE; } gd_820 = CalculateShadowProfit("current"); if (gi_1128 == FALSE && gd_820 >= gda_500[gi_1180] && scanfororders() > 0) { gd_320 = gd_820; CloseAll(); gi_1172 = FALSE; } gd_820 = CalculateShadowProfit("current"); if (gi_1172 == FALSE && gi_412 == TRUE && scanfororders() == 0 && (gi_344 == FALSE && gd_820 >= gda_504[gi_1180]) || (gi_344 == TRUE && (gi_272 != 0 && gd_820 < gd_828) || gi_272 == 0 && gd_820 <= gda_504[gi_1180] + gd_1200 && gd_820 >= gda_504[gi_1180]) && gi_1252 == TRUE) { gd_320 = gd_820; SetReverseActions(); gi_1128 = TRUE; OpenAll(); gi_unused_980 = 1; SetForwardActions(); gd_820 = CalculateShadowProfit("current"); } if (AllowForSpread == TRUE) gd_820 = CalculateShadowProfit("ask"); if (AllowForSpread == FALSE) gd_820 = CalculateShadowProfit("current"); if (gi_1128 == TRUE && gd_820 <= gda_508[gi_1180] && scanfororders() > 0) { gd_320 = gd_820; CloseAll(); gi_1172 = FALSE; } gd_820 = CalculateShadowProfit("current"); } } } scanfororders2(); CalculateHighsAndLows(); ShowComments(); return (0); } int ShowComments() { SetCurrenciesAndLotSize(); SetForwardActions(); string ls_unused_0 = ""; if (gi_528 == 60) ls_unused_0 = "Hourly"; if (gi_528 == 240) ls_unused_0 = "4 Hour"; if (gi_528 == 1440) ls_unused_0 = "Daily"; if (gi_528 == 30) ls_unused_0 = "30 Minute"; if (gi_528 == 15) ls_unused_0 = "15 Minute"; if (gi_528 == 1) ls_unused_0 = "1 Minute"; if (gi_528 == 5) ls_unused_0 = "5 Minute"; double ld_8 = gd_480 / 100.0; double ld_16 = gd_564 - gd_572; double ld_24 = ld_16 * ld_8; double ld_32 = gd_580 - gd_588; double ld_40 = ld_32 * ld_8; int li_48 = gi_1184; if (DisplayLevel != 0) gi_1184 = DisplayLevel; if (gi_1280 >= gi_1184) gi_408 = TRUE; if (gi_1280 < gi_1184) gi_408 = FALSE; if (gi_1284 > gi_1184) gi_412 = FALSE; if (gi_1284 <= gi_1184) gi_412 = TRUE; gi_1188 = gi_408; gi_1192 = gi_412; string ls_52 = "True"; if (DoTrades == FALSE) ls_52 = "False"; string ls_60 = "True"; if (gi_1188 == FALSE) ls_60 = "False"; string ls_68 = "True"; if (gi_1192 == FALSE) ls_68 = "False"; string ls_unused_76 = "False"; if (gi_128 == TRUE) ls_unused_76 = "True"; double ld_84 = gd_256 + gi_244 * gi_248 * Point; if (gi_1184 > gi_1280) { if (gi_1308 == FALSE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nShort Open for Range " + gi_1184 + " = " + DoubleToStr(gda_504[gi_1184], Digits) + "\nShort Close for Range " + gi_1184 + " = " + DoubleToStr(gda_508[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") "); } if (gi_1308 == TRUE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nShort Open for Range " + gi_1184 + " = " + DoubleToStr(gda_504[gi_1184], Digits) + "\nShort Close for Range " + gi_1184 + " = " + DoubleToStr(gda_508[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1184 < gi_1280) { if (gi_1308 == FALSE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nLong Open for Range " + gi_1184 + " = " + DoubleToStr(gda_496[gi_1184], Digits) + "\nLong Close for Range " + gi_1184 + " = " + DoubleToStr(gda_500[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") "); } if (gi_1308 == TRUE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nLong Open for Range " + gi_1184 + " = " + DoubleToStr(gda_496[gi_1184], Digits) + "\nLong Close for Range " + gi_1184 + " = " + DoubleToStr(gda_500[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1184 == gi_1280) { if (gi_1308 == FALSE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nLong Open for Range " + gi_1184 + " = " + DoubleToStr(gda_496[gi_1184], Digits) + "\nLong Close for Range " + gi_1184 + " = " + DoubleToStr(gda_500[gi_1184], Digits) + "\nShort Open for Range " + gi_1184 + " = " + DoubleToStr(gda_504[gi_1184], Digits) + "\nShort Close for Range " + gi_1184 + " = " + DoubleToStr(gda_508[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") "); } if (gi_1308 == TRUE && gi_1176 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_820, Digits) + "\nCurrent Range = " + gi_1184 + "\n\nLong Open for Range " + gi_1184 + " = " + DoubleToStr(gda_496[gi_1184], Digits) + "\nLong Close for Range " + gi_1184 + " = " + DoubleToStr(gda_500[gi_1184], Digits) + "\nShort Open for Range " + gi_1184 + " = " + DoubleToStr(gda_504[gi_1184], Digits) + "\nShort Close for Range " + gi_1184 + " = " + DoubleToStr(gda_508[gi_1184], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_256, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1312 + "\nLast Range = " + gi_1316 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_216 + "\nTradeRange = " + gi_248 + "\nTradeWindow = " + DoubleToStr(gd_1200, Digits) + "\n\nPrice " + gi_476 + " Day High = " + DoubleToStr(g_ihigh_1264, Digits) + " (" + gi_1292 + ") " + "\nPrice " + gi_476 + " Day Low = " + DoubleToStr(g_ilow_1272, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_476 + " Day Mid-Range = " + DoubleToStr(gd_1256, Digits) + " (" + gi_1288 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1196[gi_1184], 2) + "\n\nLots1 = " + DoubleToStr(gd_868, gi_312) + " " + g_symbol_532 + " " + gia_512[gi_1184] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_532), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_312 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1280 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1284 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } gi_1184 = li_48; return (0); } double EAProfit() { double ld_ret_0 = 0.0; if (search_for(gia_512[gi_1180]) != 0) ld_ret_0 += OrderProfit(); return (ld_ret_0); } int search_for(int a_magic_0) { g_ord_total_964 = OrdersTotal(); for (int l_pos_4 = g_ord_total_964 - 1; l_pos_4 >= 0; l_pos_4--) { if (!OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { g_error_968 = GetLastError(); Print("OrderSelect( ", l_pos_4, ", SELECT_BY_POS ) - Error #", g_error_968); } 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_964 = OrdersTotal(); for (int l_pos_8 = g_ord_total_964 - 1; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { g_error_968 = GetLastError(); Print("OrderSelect( ", l_pos_8, ", SELECT_BY_POS ) - Error #", g_error_968); } 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); } //int FindAndCloseAll() { // g_ord_total_964 = OrdersTotal(); // for (int l_pos_0 = g_ord_total_964 - 1; l_pos_0 >= 0; l_pos_0--) { // if (!OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { // g_error_968 = GetLastError(); // Print("OrderSelect( ", l_pos_0, ", SELECT_BY_POS ) - Error #", g_error_968); // } else // if (OrderCloseTime() == 0) Close_it(); // } // return (0); //} double AddLots(string a_symbol_0) { double ld_ret_8 = 0.0; g_ord_total_964 = OrdersTotal(); for (int l_pos_16 = g_ord_total_964 - 1; l_pos_16 >= 0; l_pos_16--) { if (!OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES)) { g_error_968 = GetLastError(); Print("OrderSelect( ", l_pos_16, ", SELECT_BY_POS ) - Error #", g_error_968); } 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_316; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1324 == TRUE && gi_1176 == TRUE) { l_price_32 = gda_496[gi_1180] + gi_248 * 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_1208; g_comment_1208 = g_comment_1208 + DoubleToStr(gd_820, g_digits_1248) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_972) { if (gi_316 != 0 && gi_1176 == TRUE && Ask - gd_320 < gi_316 * Point) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, l_price_32, g_comment_1208, a_magic_0, 0, CLR_NONE); if (gi_316 == 0 || gi_1176 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, 0.0, g_comment_1208, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_972) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_968 = GetLastError(); if (gi_224 == TRUE) Alert("Error OrderSend # ", g_error_968); } g_comment_1208 = 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_316; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1324 == TRUE && gi_1176 == TRUE) { l_price_32 = gda_504[gi_1180] - gi_248 * 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_1208; g_comment_1208 = g_comment_1208 + DoubleToStr(gd_820, g_digits_1248) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_972) { if (gi_316 != 0 && gi_1176 == TRUE && gd_320 - Bid < gi_316 * Point) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, l_price_32, g_comment_1208, a_magic_0, 0, CLR_NONE); if (gi_316 == 0 || gi_1176 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, 0.0, g_comment_1208, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_972) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_968 = GetLastError(); if (gi_224 == TRUE) Alert("Error OrderSend # ", g_error_968); } g_comment_1208 = l_comment_40; return (0); } int Close_it() { if (gi_228 == TRUE && OrderTakeProfit() != 0.0 && OrderProfit() + OrderSwap() < 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 0.0, OrderExpiration(), CLR_NONE); if ((gi_228 == TRUE && OrderProfit() + OrderSwap() > 0.0) || gi_228 == FALSE) { if (OrderType() == OP_BUY) { if (gi_316 != 0 && gi_1176 == TRUE && gd_320 - Bid < gi_316 * Point) close_buy(); if (gi_316 == 0 || gi_1176 == FALSE) close_buy(); } if (OrderType() == OP_SELL) { if (gi_316 != 0 && gi_1176 == TRUE && Ask - gd_320 < gi_316 * Point) close_sell(); if (gi_316 == 0 || gi_1176 == FALSE) close_sell(); } } return (0); } int OpenAll() { if (gs_1088 == "Sell") open_sell_market(gia_512[gi_1180], gd_868, g_symbol_532); if (gs_1088 == "Buy") open_buy_market(gia_512[gi_1180], gd_868, g_symbol_532); return (0); } int CloseAll() { int l_count_0 = 0; while (l_count_0 < 4) { l_count_0++; if (search_for(gia_512[gi_1180]) != 0) Close_it(); } return (0); } int scanfororders() { int l_count_0 = 0; int li_4 = search_for(gia_512[gi_1180]); if (li_4 == gia_512[gi_1180]) l_count_0++; return (l_count_0); } int scanfororders2() { bool li_ret_0 = FALSE; int li_4 = search_for(gia_512[gi_1180]); if (li_4 == gia_512[gi_1180]) { if (gs_1088 == "Sell" && OrderType() == OP_SELL) gi_1128 = FALSE; if (gs_1088 == "Buy" && OrderType() == OP_BUY) gi_1128 = FALSE; if (gs_1088 == "Buy" && OrderType() == OP_SELL) gi_1128 = TRUE; if (gs_1088 == "Sell" && OrderType() == OP_BUY) gi_1128 = TRUE; } return (li_ret_0); } int close_buy() { int l_slippage_0 = gi_316; g_count_976 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_976 <= 0) { if (gi_316 != 0 && gi_1176 == TRUE && gd_320 - Bid < gi_316 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); if (gi_316 == 0 || gi_1176 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); g_count_976++; if (l_ord_close_4) break; if (g_count_976 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_968 = GetLastError(); if (gi_224 == TRUE) Alert("Error OrderClose # ", g_error_968); return (-1); } return (0); } int close_sell() { int l_slippage_0 = gi_316; g_count_976 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_976 <= 0) { if (gi_316 != 0 && gi_1176 == TRUE && Ask - gd_320 < gi_316 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); if (gi_316 == 0 || gi_1176 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); g_count_976++; if (l_ord_close_4) break; if (g_count_976 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_968 = GetLastError(); if (gi_224 == TRUE) Alert("?????? OrderClose No ", g_error_968); 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_312 = 1; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.1) gi_312 = 2; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.01) gi_312 = 3; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.001) gi_312 = 4; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.0001) gi_312 = 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_312); 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_1308 = FALSE; if (ld_36 < ld_44) gi_1308 = TRUE; li_24 = ld_36 / ld_44; ld_ret_16 = li_24 / 100.0; ld_ret_16 = NormalizeDouble(ld_ret_16, gi_312); 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_312); if (gi_1328 == 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_1328 = TRUE; } if (gi_1328 == 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_1328 = TRUE; } if (gi_1328 == FALSE && gi_312 == 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_1328 = TRUE; } return (ld_ret_16); } int SetForwardActions() { gs_1088 = "Buy"; return (0); } int SetReverseActions() { gs_1088 = "Sell"; return (0); } int CalculateHighsAndLows() { gd_820 = CalculateShadowProfit("current"); if (Minute() > 10) gi_1136 = FALSE; if (Minute() < 10 && gi_1136 == FALSE) { gd_580 = -10000000.0; gd_588 = 10000000.0; gi_1136 = TRUE; } if (gd_564 < gd_820) gd_564 = gd_820; if (gd_580 < gd_820) gd_580 = gd_820; if (gd_572 > gd_820) gd_572 = gd_820; if (gd_588 > gd_820) gd_588 = gd_820; if (gd_588 == 0.0) gd_588 = gd_820; if (gd_596 < AccountEquity()) gd_596 = AccountEquity(); if (gd_604 > AccountEquity()) gd_604 = AccountEquity(); if (g_free_magrin_620 < AccountFreeMargin()) g_free_magrin_620 = AccountFreeMargin(); if (g_free_magrin_612 > AccountFreeMargin()) g_free_magrin_612 = AccountFreeMargin(); if (gd_628 < AccountBalance()) gd_628 = AccountBalance(); if (gd_636 > AccountBalance()) gd_636 = AccountBalance(); return (0); } int SetCurrenciesAndLotSize() { g_symbol_532 = Symbol(); g_lotsize_1000 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_1000 == 0.0) g_lotsize_1000 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_1000 == 100000.0) gd_unused_1008 = 0.1; if (g_lotsize_1000 == 10000.0) gd_unused_1008 = 0.01; SetForwardActions(); if (StringLen(StringTrimLeft(gs_1088)) < 2) g_symbol_532 = " "; if (StringLen(StringTrimLeft(g_symbol_532)) < 2) gs_1088 = " "; return (0); } double CalculateShadowProfit(string as_0) { if ((gi_1176 == TRUE && as_0 == "current") || (gi_1176 == TRUE && as_0 == "ask" && AllowForSpread == FALSE)) g_price_804 = Bid; if (gi_1176 == TRUE && as_0 == "ask" && AllowForSpread == TRUE) g_price_804 = Ask; if (gi_1176 == TRUE && as_0 == "average") g_price_804 = gma(g_symbol_532); return (g_price_804); } double gma(string a_symbol_0) { double l_ima_8 = 0.0; int l_period_16 = gi_272; 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() { // bool li_ret_0 = FALSE; // bool li_4 = FALSE; // int l_acc_number_8 = AccountNumber(); // int li_12 = StrToInteger(StringSubstr(UnlockCode, 1, 2)) - 2; // int li_16 = StrToInteger(StringSubstr(UnlockCode, 3, 2)) - 3; // string l_dbl2str_20 = DoubleToStr(StrToInteger(StringSubstr(UnlockCode, 5, 2)) - 2, 0); // string ls_28 = StringSubstr(UnlockCode, 7, 1); // string ls_36 = StringSubstr(UnlockCode, 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); // if (Year() > l_str2int_60 || Month() > li_12 || (Day() > li_16 && Month() >= li_12)) { // Comment("\n\nExpert Has Expired"); // li_4 = TRUE; // } // string ls_64 = StringSubstr(UnlockCode, 0, 1) + StringSubstr(UnlockCode, 9, StringLen(UnlockCode) - 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_ret_0 = TRUE; // if (IsDemo() && li_4 == FALSE) li_ret_0 = TRUE; // return (li_ret_0); //} 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); } //int LookupLiveAccountNumbers() { //int li_unused_0 = 0; //if (AccountNumber() == 29289) gi_1124 = TRUE; // if (AccountNumber() == 28180) gi_1124 = TRUE; // if (AccountNumber() == 24613) gi_1124 = TRUE; // if (AccountNumber() == 66576) gi_1124 = TRUE; // if (AccountNumber() == 11613) gi_1124 = TRUE; // if (AccountNumber() == 20711) gi_1124 = TRUE; // return (TRUE); //}