#property copyright "RoboMiner" #property link "http://www.forex-goldmine.com" string gs_76 = "RoboMiner 2.12 - SE"; extern string Version = "RoboMiner 2.12 - SE"; extern string webpage = "http://www.forex-goldmine.com"; string gs_100 = "http://www.forex-goldmine.com"; int gi_unused_108 = 40; extern int DisplayLevel = 0; extern string UnlockCode = "Put Unlock Code Here "; extern bool AllowForSpread = TRUE; extern bool DoTrades = TRUE; bool gi_132 = FALSE; string gs_unused_136 = "If set to false, then ranges will be 40 pips."; bool gi_144 = 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_188 = "AUDNZD at 50 pips: 1=40, 2=30, 3=24"; string gs_unused_196 = "AUDNZD at 40 pips: 1=50, 2=36"; string gs_unused_204 = "EURCHF at 50 pips: 1=51, 2=42"; string gs_unused_212 = "EURCHF at 40 pips: 1=64, 2=50"; int gi_220 = 1; extern int MagicNumber1 = 510001; bool gi_228 = FALSE; bool gi_232 = TRUE; int gi_236 = 15; int gi_240 = 15; int gi_244 = 0; int gi_248 = 29; int gi_252 = 50; int gi_256 = 0; double gd_260 = 1.07; int gi_268 = 0; int gi_272 = 5; int gi_276 = 0; string gs_unused_280 = "-----------------------------------------------"; bool gi_unused_288 = FALSE; string gs_unused_292 = "Leave as 0 to use actual account balance."; double gd_unused_300 = 0.0; double gd_unused_308 = 0.25; int gi_316 = 2; int gi_320 = 25; double gd_324 = 0.0; string gs_unused_332 = "Leave Lots 0.00 for Auto-Calculation"; bool gi_unused_340 = FALSE; bool gi_unused_344 = FALSE; bool gi_348 = TRUE; string gs_unused_352 = "-----------------------------------------------"; double gd_unused_360 = 0.0; double gd_unused_368 = 0.0; 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; bool gi_unused_396 = FALSE; int gi_unused_400 = 1; string gs_unused_404 = "-----------------------------------------------"; bool gi_412 = FALSE; bool gi_416 = FALSE; double gd_unused_420 = 0.0; double gd_unused_428 = 0.0; double gd_unused_436 = 0.0; double gd_unused_444 = 0.0; string gs_unused_452 = "-----------------------------------------------"; double gd_unused_460 = 0.0; bool gi_unused_468 = FALSE; string gs_unused_472 = "------------------------------------------------"; int gi_480 = 90; double gd_484 = 15.0; bool gi_unused_492 = FALSE; bool gi_unused_496 = FALSE; double gda_500[101]; double gda_504[101]; double gda_508[101]; double gda_512[101]; int gia_516[101]; double gd_unused_520 = 0.0; int gi_unused_528 = 1440; int gi_532 = 60; string g_symbol_536 = " "; string gs_unused_544 = " "; string gs_unused_552 = " "; string gs_unused_560 = " "; double gd_568 = -1000000.0; double gd_576 = 1000000.0; double gd_584 = -1000000.0; double gd_592 = 1000000.0; double gd_600 = 0.0; double gd_608 = 0.0; double g_free_magrin_616 = 0.0; double g_free_magrin_624 = 0.0; double gd_632 = 0.0; double gd_640 = 0.0; double gd_unused_648 = 0.0; double gd_unused_656 = 0.0; double gd_unused_664 = 0.0; double gd_unused_672 = 0.0; double gd_unused_680 = 0.0; double gd_unused_688 = 0.0; double gd_unused_696 = 0.0; double gd_unused_704 = 0.0; double gd_unused_712 = 0.0; double gd_unused_720 = 0.0; double gd_unused_728 = 0.0; double gd_unused_736 = 0.0; double gd_unused_744 = 0.0; double gd_unused_752 = 0.0; double gd_unused_760 = 0.0; double gd_unused_768 = 0.0; double gd_unused_776 = 0.0; double gd_unused_784 = 0.0; double gd_unused_792 = 0.0; double gd_unused_800 = 0.0; double g_price_808 = 0.0; double gd_unused_816 = 0.0; double gd_824 = 0.0; double gd_832 = 0.0; double gd_unused_840 = 0.0; double gd_unused_848 = 0.0; double gd_unused_856 = 0.0; double gd_unused_864 = 0.0; double gd_872 = 0.0; double gd_unused_880 = 0.0; double gd_unused_888 = 0.0; double gd_unused_896 = 0.0; double gd_unused_904 = 0.0; double gd_unused_912 = 0.0; double gd_unused_920 = 0.0; double gd_unused_928 = 0.0; double gd_unused_936 = 0.0; double gd_unused_944 = 0.0; double gd_unused_952 = 0.0; double gd_unused_960 = 0.0; int g_ord_total_968 = 0; int g_error_972 = 0/* NO_ERROR */; int gi_976 = 10; int g_count_980 = 4; int gi_unused_984 = 0; double gd_unused_988 = 0.0; double gd_unused_996 = 0.0; double g_lotsize_1004 = 0.0; double gd_unused_1012 = 0.0; double gd_unused_1020 = 0.0; double gd_unused_1028 = 0.0; double gd_unused_1036 = 0.0; double gd_unused_1044 = 0.0; double gd_unused_1052 = 0.0; double gd_unused_1060 = 0.0; double gd_unused_1068 = 0.0; double gd_unused_1076 = 0.0; double gd_unused_1084 = 0.0; string gs_1092 = " "; string gs_unused_1100 = " "; string gs_unused_1108 = " "; string gs_unused_1116 = " "; int gi_unused_1124 = 0; int gi_1128 = 0; bool gi_1132 = FALSE; int gi_unused_1136 = 0; int gi_1140 = 0; double gd_unused_1144 = 0.0; double gd_unused_1152 = 0.0; double gd_unused_1160 = 0.0; int gi_unused_1168 = 0; int gi_unused_1172 = 0; bool gi_1176 = FALSE; bool gi_1180 = FALSE; int gi_1184 = 0; int gi_1188 = 0; bool gi_1192 = FALSE; bool gi_1196 = FALSE; double gda_1200[101]; double gd_1204 = 0.0; string g_comment_1212 = " "; string gs_unused_1220 = " "; string gs_unused_1228 = " "; string gs_unused_1236 = " "; string gs_unused_1244 = " "; int g_digits_1252 = 2; bool gi_1256 = TRUE; double gd_1260 = 0.0; double g_ihigh_1268 = 0.0; double g_ilow_1276 = 0.0; int gi_1284 = 0; int gi_1288 = 0; int gi_1292 = 0; int gi_1296 = 0; int gi_1300 = 0; double gd_unused_1304 = 0.0; int gi_1312 = 0; int gi_1316 = 0; int gi_1320 = 0; int g_count_1324 = 0; bool gi_1328 = TRUE; int gi_1332 = 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_132 == TRUE) gi_1256 = FALSE; if (gi_132 == FALSE) gi_1256 = TRUE; gi_1332 = FALSE; if (gi_220 != 1 && gi_220 != 2 && gi_220 != 3 && gi_220 != 9 && gi_220 < 10) gi_220 = 2; if (gi_144 == TRUE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_220 == 2) { gd_260 = 1.07; gd_260 = StartPoint() * Point + 1.065; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.065; gi_252 = 50; gi_1316 = 7; gi_248 = 40; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 27; gi_240 = 27; } if (gi_220 == 1) { gd_260 = 1.045; gd_260 = StartPoint() * Point + 1.04; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.04; gi_252 = 50; gi_1316 = 2; gi_248 = 54; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 27; gi_240 = 27; } if (gi_220 == 3) { gd_260 = 1.085; gd_260 = StartPoint() * Point + 1.08; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.08; gi_252 = 50; gi_1316 = 10; gi_248 = 30; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 27; gi_240 = 27; } if (gi_220 == 9) { gd_260 = 1.04; gd_260 = StartPoint() * Point + 1.035; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.035; gi_252 = 50; gi_1316 = 1; gi_248 = 54; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 27; gi_240 = 27; } if (gi_220 > 9) { gd_260 = 1.04; gd_260 = StartPoint() * Point + 1.035; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.035; gi_252 = 50; gi_1316 = 1; gi_248 = gi_220; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = gi_248 / 2; gi_240 = gi_248 / 2; } } if (Symbol() == "EURCHF" || Symbol() == "EURCHFm" || StringSubstr(Symbol(), 0, 6) == "EURCHF") { if (gi_220 == 2) { gd_260 = 1.459; gd_260 = StartPoint() * Point + 1.454; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 50; gi_1316 = 5; gi_248 = 42; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 26; gi_240 = 26; } if (gi_220 == 1) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 50; gi_1316 = 1; gi_248 = 52; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 26; gi_240 = 26; } if (gi_220 == 3) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 50; gi_1316 = 1; gi_248 = 52; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 26; gi_240 = 26; } if (gi_220 == 9) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 50; gi_1316 = 1; gi_248 = 52; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 26; gi_240 = 26; } if (gi_220 > 9) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 50; gi_1316 = 1; gi_248 = gi_220; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = gi_248 / 2; gi_240 = gi_248 / 2; } } } if (gi_144 == FALSE) { if (Symbol() == "AUDNZD" || Symbol() == "AUDNZDm" || StringSubstr(Symbol(), 0, 6) == "AUDNZD") { if (gi_220 == 2) { gd_260 = 1.07; gd_260 = StartPoint() * Point + 1.065; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.065; gi_252 = 40; gi_1316 = 8; gi_248 = 50; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 33; gi_240 = 33; } if (gi_220 == 1) { gd_260 = 1.042; gd_260 = StartPoint() * Point + 1.037; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.037; gi_252 = 40; gi_1316 = 1; gi_248 = 66; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 33; gi_240 = 33; } if (gi_220 == 3) { gd_260 = 1.07; gd_260 = StartPoint() * Point + 1.065; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.065; gi_252 = 40; gi_1316 = 8; gi_248 = 50; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 33; gi_240 = 33; } if (gi_220 == 9) { gd_260 = 1.042; gd_260 = StartPoint() * Point + 1.037; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.037; gi_252 = 40; gi_1316 = 1; gi_248 = 66; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 33; gi_240 = 33; } if (gi_220 > 9) { gd_260 = 1.042; gd_260 = StartPoint() * Point + 1.037; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.037; gi_252 = 40; gi_1316 = 1; gi_248 = gi_220; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = gi_248 / 2; gi_240 = gi_248 / 2; } } if (Symbol() == "EURCHF" || Symbol() == "EURCHFm" || StringSubstr(Symbol(), 0, 6) == "EURCHF") { if (gi_220 == 2) { gd_260 = 1.463; gd_260 = StartPoint() * Point + 1.458; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.458; gi_252 = 40; gi_1316 = 7; gi_248 = 50; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 31; gi_240 = 31; } if (gi_220 == 1) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 40; gi_1316 = 1; gi_248 = 64; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 31; gi_240 = 31; } if (gi_220 == 3) { gd_260 = 1.463; gd_260 = StartPoint() * Point + 1.458; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.458; gi_252 = 40; gi_1316 = 7; gi_248 = 50; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 31; gi_240 = 31; } if (gi_220 == 9) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 40; gi_1316 = 1; gi_248 = 64; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = 31; gi_240 = 31; } if (gi_220 > 9) { gd_260 = 1.439; gd_260 = StartPoint() * Point + 1.434; if (Digits == 5) gd_260 = 10.0 * StartPoint() * Point + 1.434; gi_252 = 40; gi_1316 = 1; gi_248 = gi_220; gi_1320 = gi_1316 + gi_248 - 1; gi_236 = gi_248 / 2; gi_240 = gi_248 / 2; } } } if (Digits == 5) { gi_252 = 10 * gi_252; gi_272 = 50; gi_320 = 160; } CalculateHighsAndLows(); gi_1180 = TRUE; g_symbol_536 = Symbol(); if (gi_1180 == TRUE) g_comment_1212 = "RoboMiner Bid "; if (gi_1180 == FALSE) g_comment_1212 = "RoboMiner SP "; if (gi_1180 == TRUE) g_digits_1252 = Digits; if (gi_1180 == FALSE) g_digits_1252 = 2; gi_unused_1172 = 0; ArrayInitialize(gda_500, 0.0); ArrayInitialize(gda_504, 0.0); ArrayInitialize(gda_508, 0.0); ArrayInitialize(gda_512, 0.0); ArrayInitialize(gia_516, 0); ArrayInitialize(gda_1200, 0.0); g_count_1324 = 0; gi_1184 = gi_1316 - 1; while (gi_1184 < gi_1320) { gi_1184++; g_count_1324++; gda_500[gi_1184] = gd_260 + (gi_252 * Point + gi_256 * Point) * (g_count_1324 - 1); gda_504[gi_1184] = gda_500[gi_1184] + gi_252 * Point; gda_508[gi_1184] = gda_504[gi_1184]; gda_512[gi_1184] = gda_500[gi_1184]; gda_500[gi_1184] += gi_268 * Point; gda_504[gi_1184] += gi_268 * Point; gda_508[gi_1184] += gi_268 * Point; gda_512[gi_1184] += gi_268 * Point; gd_1204 = gi_272 * (1.0 * Point); gda_1200[gi_1184] = EAProfit(); gia_516[gi_1184] = MagicNumber1 + (gi_1184 - 1); gda_1200[gi_1184] = EAProfit(); } gd_872 = CalculateLots(); SetCurrenciesAndLotSize(); SetForwardActions(); gi_1184 = gi_1316; gd_824 = CalculateShadowProfit("current"); g_ilow_1276 = 10000.0; g_ilow_1276 = iLow(g_symbol_536, PERIOD_D1, 0); for (int li_0 = 0; li_0 <= gi_480; li_0++) if (iLow(g_symbol_536, PERIOD_D1, li_0) < g_ilow_1276) g_ilow_1276 = iLow(g_symbol_536, PERIOD_D1, li_0); g_ihigh_1268 = 0.0; g_ihigh_1268 = iHigh(g_symbol_536, PERIOD_D1, 0); for (li_0 = 0; li_0 <= gi_480; li_0++) if (iHigh(g_symbol_536, PERIOD_D1, li_0) > g_ihigh_1268) g_ihigh_1268 = iHigh(g_symbol_536, PERIOD_D1, li_0); g_ihigh_1268 = NormalizeDouble(g_ihigh_1268, Digits); g_ilow_1276 = NormalizeDouble(g_ilow_1276, Digits); gd_1260 = (g_ihigh_1268 + g_ilow_1276) / 2.0; gd_1260 = NormalizeDouble(gd_1260, Digits); gi_1184 = gi_1316 - 1; while (gi_1184 < gi_1320) { gi_1184++; if (gi_1284 >= gi_1184) gi_412 = TRUE; if (gi_1284 < gi_1184) gi_412 = FALSE; if (gi_1288 > gi_1184) gi_416 = FALSE; if (gi_1288 <= gi_1184) gi_416 = TRUE; if (gd_824 >= gda_500[gi_1184] && gd_824 <= gda_504[gi_1184]) { gi_1188 = gi_1184; gi_1192 = gi_412; gi_1196 = gi_416; } if (gd_1260 >= gda_500[gi_1184] && gd_1260 <= gda_504[gi_1184]) gi_1292 = gi_1184; if (g_ihigh_1268 >= gda_500[gi_1184] && g_ihigh_1268 <= gda_504[gi_1184]) gi_1296 = gi_1184; if (g_ilow_1276 >= gda_500[gi_1184] && g_ilow_1276 <= gda_504[gi_1184]) gi_1300 = gi_1184; gda_1200[gi_1184] = EAProfit(); } gi_1284 = gi_236; gi_1288 = gi_240; if (gi_244 == 1 && gd_824 > gd_1260) { if (gi_236 == 0 && gi_1296 != 0) gi_1284 = gi_1296 - 1; if (gi_240 == 0 && gi_1292 != 0) gi_1288 = gi_1292; } if (gi_244 == 1 && gd_824 < gd_1260) { if (gi_240 == 0 && gi_1300 != 0) gi_1288 = gi_1300 + 1; if (gi_236 == 0 && gi_1292 != 0) gi_1284 = gi_1292; } if (gi_244 == 0) { if (gi_1284 == 0) gi_1284 = gi_1292; if (gi_1288 == 0) gi_1288 = gi_1292; } if (gi_1284 == 0) gi_1284 = gi_248; if (gi_1288 == 0) gi_1288 = 1; gi_1184 = gi_1316 - 1; while (gi_1184 < gi_1320) { gi_1184++; li_4 = search_for_conflict(gia_516[gi_1184]); 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_1184 = gi_1316 - 1; while (gi_1184 < gi_1320) { gi_1184++; li_0 = search_for_conflict(gia_516[gi_1184]); if (li_0 == 1) break; } if (li_0 == 1) { Comment("\nMagic Number Conflict With Another Pair..."); return (-1); } if (gi_132 == TRUE) gi_1256 = FALSE; if (gi_132 == FALSE) gi_1256 = TRUE; g_ilow_1276 = 10000.0; g_ilow_1276 = iLow(g_symbol_536, PERIOD_D1, 0); for (int li_4 = 0; li_4 <= gi_480; li_4++) if (iLow(g_symbol_536, PERIOD_D1, li_4) < g_ilow_1276) g_ilow_1276 = iLow(g_symbol_536, PERIOD_D1, li_4); g_ihigh_1268 = 0.0; g_ihigh_1268 = iHigh(g_symbol_536, PERIOD_D1, 0); for (li_4 = 0; li_4 <= gi_480; li_4++) if (iHigh(g_symbol_536, PERIOD_D1, li_4) > g_ihigh_1268) g_ihigh_1268 = iHigh(g_symbol_536, PERIOD_D1, li_4); g_ihigh_1268 = NormalizeDouble(g_ihigh_1268, Digits); g_ilow_1276 = NormalizeDouble(g_ilow_1276, Digits); gd_1260 = (g_ihigh_1268 + g_ilow_1276) / 2.0; gd_1260 = NormalizeDouble(gd_1260, Digits); gi_1284 = gi_236; gi_1288 = gi_240; if (gi_244 == 1 && gd_824 > gd_1260) { if (gi_236 == 0 && gi_1296 != 0) gi_1284 = gi_1296 - 1; if (gi_240 == 0 && gi_1292 != 0) gi_1288 = gi_1292; } if (gi_244 == 1 && gd_824 < gd_1260) { if (gi_240 == 0 && gi_1300 != 0) gi_1288 = gi_1300 + 1; if (gi_236 == 0 && gi_1292 != 0) gi_1284 = gi_1292; } if (gi_244 == 0) { if (gi_1284 == 0) gi_1284 = gi_1292; if (gi_1288 == 0) gi_1288 = gi_1292; } if (gi_1284 == 0) gi_1284 = gi_248; if (gi_1288 == 0) gi_1288 = 1; SetCurrenciesAndLotSize(); SetForwardActions(); gi_1184 = gi_1316; gd_872 = CalculateLots(); gd_824 = CalculateShadowProfit("current"); gd_832 = CalculateShadowProfit("average"); if (gd_824 != 0.0) { gi_1184 = gi_1316 - 1; while (gi_1184 < gi_1320) { gi_1184++; if (gi_1284 >= gi_1184) gi_412 = TRUE; if (gi_1284 < gi_1184) gi_412 = FALSE; if (gi_1288 > gi_1184) gi_416 = FALSE; if (gi_1288 <= gi_1184) gi_416 = TRUE; if (gd_824 >= gda_500[gi_1184] && gd_824 <= gda_504[gi_1184]) { gi_1188 = gi_1184; gi_1192 = gi_412; gi_1196 = gi_416; } if (gd_1260 >= gda_500[gi_1184] && gd_1260 <= gda_504[gi_1184]) gi_1292 = gi_1184; if (g_ihigh_1268 >= gda_500[gi_1184] && g_ihigh_1268 <= gda_504[gi_1184]) gi_1296 = gi_1184; if (g_ilow_1276 >= gda_500[gi_1184] && g_ilow_1276 <= gda_504[gi_1184]) gi_1300 = gi_1184; gda_1200[gi_1184] = EAProfit(); if (DoTrades == TRUE) { scanfororders2(); if (gi_1256 == FALSE) CloseAll(); if (AllowForSpread == TRUE) gd_824 = CalculateShadowProfit("ask"); if (AllowForSpread == FALSE) gd_824 = CalculateShadowProfit("current"); if (search_for(gia_516[gi_1184]) == gia_516[gi_1184]) { if (OrderTakeProfit() == 0.0 && gi_1328 && OrderMagicNumber() != 0) { if (OrderType() == OP_BUY) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(OrderOpenPrice() + gi_252 * Point, Digits), 0, CLR_NONE); if (OrderType() == OP_SELL) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), NormalizeDouble(OrderOpenPrice() - gi_252 * Point, Digits), 0, CLR_NONE); } } if (gi_1176 == FALSE && scanfororders() == 0 && (gi_348 == FALSE && gd_824 <= gda_500[gi_1184]) || (gi_348 == TRUE && (gi_276 != 0 && gd_824 > gd_832) || gi_276 == 0 && gd_824 <= gda_500[gi_1184] && gd_824 >= gda_500[gi_1184] - gd_1204) && gi_1256 == TRUE && gi_412 == TRUE) { gd_324 = gd_824; SetForwardActions(); OpenAll(); gi_unused_984 = 1; gd_824 = CalculateShadowProfit("current"); gi_1132 = FALSE; } gd_824 = CalculateShadowProfit("current"); if (gi_1132 == FALSE && gd_824 >= gda_504[gi_1184] && scanfororders() > 0) { gd_324 = gd_824; CloseAll(); gi_1176 = FALSE; } gd_824 = CalculateShadowProfit("current"); if (gi_1176 == FALSE && gi_416 == TRUE && scanfororders() == 0 && (gi_348 == FALSE && gd_824 >= gda_508[gi_1184]) || (gi_348 == TRUE && (gi_276 != 0 && gd_824 < gd_832) || gi_276 == 0 && gd_824 <= gda_508[gi_1184] + gd_1204 && gd_824 >= gda_508[gi_1184]) && gi_1256 == TRUE) { gd_324 = gd_824; SetReverseActions(); gi_1132 = TRUE; OpenAll(); gi_unused_984 = 1; SetForwardActions(); gd_824 = CalculateShadowProfit("current"); } if (AllowForSpread == TRUE) gd_824 = CalculateShadowProfit("ask"); if (AllowForSpread == FALSE) gd_824 = CalculateShadowProfit("current"); if (gi_1132 == TRUE && gd_824 <= gda_512[gi_1184] && scanfororders() > 0) { gd_324 = gd_824; CloseAll(); gi_1176 = FALSE; } gd_824 = CalculateShadowProfit("current"); } } } scanfororders2(); CalculateHighsAndLows(); ShowComments(); return (0); } int ShowComments() { SetCurrenciesAndLotSize(); SetForwardActions(); string ls_unused_0 = ""; if (gi_532 == 60) ls_unused_0 = "Hourly"; if (gi_532 == 240) ls_unused_0 = "4 Hour"; if (gi_532 == 1440) ls_unused_0 = "Daily"; if (gi_532 == 30) ls_unused_0 = "30 Minute"; if (gi_532 == 15) ls_unused_0 = "15 Minute"; if (gi_532 == 1) ls_unused_0 = "1 Minute"; if (gi_532 == 5) ls_unused_0 = "5 Minute"; double ld_8 = gd_484 / 100.0; double ld_16 = gd_568 - gd_576; double ld_24 = ld_16 * ld_8; double ld_32 = gd_584 - gd_592; double ld_40 = ld_32 * ld_8; int li_48 = gi_1188; if (DisplayLevel != 0) gi_1188 = DisplayLevel; if (gi_1284 >= gi_1188) gi_412 = TRUE; if (gi_1284 < gi_1188) gi_412 = FALSE; if (gi_1288 > gi_1188) gi_416 = FALSE; if (gi_1288 <= gi_1188) gi_416 = TRUE; gi_1192 = gi_412; gi_1196 = gi_416; string ls_52 = "True"; if (DoTrades == FALSE) ls_52 = "False"; string ls_60 = "True"; if (gi_1192 == FALSE) ls_60 = "False"; string ls_68 = "True"; if (gi_1196 == FALSE) ls_68 = "False"; string ls_unused_76 = "False"; if (gi_132 == TRUE) ls_unused_76 = "True"; double ld_84 = gd_260 + gi_248 * gi_252 * Point; if (gi_1188 > gi_1284) { if (gi_1312 == FALSE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nShort Open for Range " + gi_1188 + " = " + DoubleToStr(gda_508[gi_1188], Digits) + "\nShort Close for Range " + gi_1188 + " = " + DoubleToStr(gda_512[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") "); } if (gi_1312 == TRUE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nShort Open for Range " + gi_1188 + " = " + DoubleToStr(gda_508[gi_1188], Digits) + "\nShort Close for Range " + gi_1188 + " = " + DoubleToStr(gda_512[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1188 < gi_1284) { if (gi_1312 == FALSE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nLong Open for Range " + gi_1188 + " = " + DoubleToStr(gda_500[gi_1188], Digits) + "\nLong Close for Range " + gi_1188 + " = " + DoubleToStr(gda_504[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") "); } if (gi_1312 == TRUE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nLong Open for Range " + gi_1188 + " = " + DoubleToStr(gda_500[gi_1188], Digits) + "\nLong Close for Range " + gi_1188 + " = " + DoubleToStr(gda_504[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nDoTrades = " + ls_52 + "\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } if (gi_1188 == gi_1284) { if (gi_1312 == FALSE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nLong Open for Range " + gi_1188 + " = " + DoubleToStr(gda_500[gi_1188], Digits) + "\nLong Close for Range " + gi_1188 + " = " + DoubleToStr(gda_504[gi_1188], Digits) + "\nShort Open for Range " + gi_1188 + " = " + DoubleToStr(gda_508[gi_1188], Digits) + "\nShort Close for Range " + gi_1188 + " = " + DoubleToStr(gda_512[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") "); } if (gi_1312 == TRUE && gi_1180 == TRUE) { Comment("\n" + gs_76 + "\n" + gs_100 + "\n\nCurrent Bid Price= " + DoubleToStr(gd_824, Digits) + "\nCurrent Range = " + gi_1188 + "\n\nLong Open for Range " + gi_1188 + " = " + DoubleToStr(gda_500[gi_1188], Digits) + "\nLong Close for Range " + gi_1188 + " = " + DoubleToStr(gda_504[gi_1188], Digits) + "\nShort Open for Range " + gi_1188 + " = " + DoubleToStr(gda_508[gi_1188], Digits) + "\nShort Close for Range " + gi_1188 + " = " + DoubleToStr(gda_512[gi_1188], Digits) + "\n\nRangeStart = " + DoubleToStr(gd_260, Digits) + "\nRangeEnd = " + DoubleToStr(ld_84, Digits) + "\nFirst Range = " + gi_1316 + "\nLast Range = " + gi_1320 + "\nBalanceFactor = " + DoubleToStr(BalanceFactor, 2) + "\nRanges Setting = " + gi_220 + "\nTradeRange = " + gi_252 + "\nTradeWindow = " + DoubleToStr(gd_1204, Digits) + "\n\nPrice " + gi_480 + " Day High = " + DoubleToStr(g_ihigh_1268, Digits) + " (" + gi_1296 + ") " + "\nPrice " + gi_480 + " Day Low = " + DoubleToStr(g_ilow_1276, Digits) + " (" + gi_1300 + ") " + "\nPrice " + gi_480 + " Day Mid-Range = " + DoubleToStr(gd_1260, Digits) + " (" + gi_1292 + ") " + "\n\nProfit for this Instance of EA = " + DoubleToStr(gda_1200[gi_1188], 2) + "\n\nLots1 = " + DoubleToStr(gd_872, gi_316) + " " + g_symbol_536 + " " + gia_516[gi_1188] + " Net Total Lots = " + DoubleToStr(AddLots(g_symbol_536), 2) + "\nLotSize = " + DoubleToStr(MarketInfo(Symbol(), MODE_LOTSIZE), 0) + "\nAccount Leverage = " + AccountLeverage() + " : 1" + "\nDecimals = " + gi_316 + "\n\nOpen Forward Orders = " + ls_60 + " (" + gi_1284 + ") " + "\nOpen Reverse Orders = " + ls_68 + " (" + gi_1288 + ") " + "\n\n**WARNING -- Account Balance may be too low to safely trade at this setting level ***"); } } gi_1188 = li_48; return (0); } double EAProfit() { double ld_ret_0 = 0.0; if (search_for(gia_516[gi_1184]) != 0) ld_ret_0 += OrderProfit(); return (ld_ret_0); } int search_for(int a_magic_0) { g_ord_total_968 = OrdersTotal(); for (int l_pos_4 = g_ord_total_968 - 1; l_pos_4 >= 0; l_pos_4--) { if (!OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES)) { g_error_972 = GetLastError(); Print("OrderSelect( ", l_pos_4, ", SELECT_BY_POS ) - Error #", g_error_972); } 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_968 = OrdersTotal(); for (int l_pos_8 = g_ord_total_968 - 1; l_pos_8 >= 0; l_pos_8--) { if (!OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES)) { g_error_972 = GetLastError(); Print("OrderSelect( ", l_pos_8, ", SELECT_BY_POS ) - Error #", g_error_972); } 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_968 = OrdersTotal(); for (int l_pos_0 = g_ord_total_968 - 1; l_pos_0 >= 0; l_pos_0--) { if (!OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES)) { g_error_972 = GetLastError(); Print("OrderSelect( ", l_pos_0, ", SELECT_BY_POS ) - Error #", g_error_972); } else if (OrderCloseTime() == 0) Close_it(); } return (0); } double AddLots(string a_symbol_0) { double ld_ret_8 = 0.0; g_ord_total_968 = OrdersTotal(); for (int l_pos_16 = g_ord_total_968 - 1; l_pos_16 >= 0; l_pos_16--) { if (!OrderSelect(l_pos_16, SELECT_BY_POS, MODE_TRADES)) { g_error_972 = GetLastError(); Print("OrderSelect( ", l_pos_16, ", SELECT_BY_POS ) - Error #", g_error_972); } 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_320; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1328 == TRUE && gi_1180 == TRUE) { l_price_32 = gda_500[gi_1184] + gi_252 * MarketInfo(a_symbol_12, MODE_POINT); l_price_32 = NormalizeDouble(l_price_32, MarketInfo(a_symbol_12, MODE_DIGITS)); } l_price_32 = 0.0; string l_comment_40 = g_comment_1212; g_comment_1212 = g_comment_1212 + DoubleToStr(gd_824, g_digits_1252) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_976) { if (gi_320 != 0 && gi_1180 == TRUE && Ask - gd_324 < gi_320 * Point) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, l_price_32, g_comment_1212, a_magic_0, 0, CLR_NONE); if (gi_320 == 0 || gi_1180 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_BUY, a_lots_4, Ask, l_slippage_20, 0.0, 0.0, g_comment_1212, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_976) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_972 = GetLastError(); if (gi_228 == TRUE) Alert("Error OrderSend # ", g_error_972); } g_comment_1212 = 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_320; int l_count_24 = 0; int l_ticket_28 = -1; double l_price_32 = 0.0; if (gi_1328 == TRUE && gi_1180 == TRUE) { l_price_32 = gda_508[gi_1184] - gi_252 * MarketInfo(a_symbol_12, MODE_POINT); l_price_32 = NormalizeDouble(l_price_32, MarketInfo(a_symbol_12, MODE_DIGITS)); } l_price_32 = 0.0; string l_comment_40 = g_comment_1212; g_comment_1212 = g_comment_1212 + DoubleToStr(gd_824, g_digits_1252) + " " + DoubleToStr(a_magic_0, 0); while (l_ticket_28 == -1 && l_count_24 <= gi_976) { if (gi_320 != 0 && gi_1180 == TRUE && gd_324 - Bid < gi_320 * Point) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, l_price_32, g_comment_1212, a_magic_0, 0, CLR_NONE); if (gi_320 == 0 || gi_1180 == FALSE) l_ticket_28 = OrderSend(Symbol(), OP_SELL, a_lots_4, Bid, l_slippage_20, 0.0, 0.0, g_comment_1212, a_magic_0, 0, CLR_NONE); l_count_24++; if (l_ticket_28 >= 0) break; if (l_count_24 > gi_976) break; Sleep(10000); } if (l_ticket_28 != 0) { g_error_972 = GetLastError(); if (gi_228 == TRUE) Alert("Error OrderSend # ", g_error_972); } g_comment_1212 = l_comment_40; return (0); } int Close_it() { if (gi_232 == TRUE && OrderTakeProfit() != 0.0 && OrderProfit() + OrderSwap() < 0.0) OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), 0.0, OrderExpiration(), CLR_NONE); if ((gi_232 == TRUE && OrderProfit() + OrderSwap() > 0.0) || gi_232 == FALSE) { if (OrderType() == OP_BUY) { if (gi_320 != 0 && gi_1180 == TRUE && gd_324 - Bid < gi_320 * Point) close_buy(); if (gi_320 == 0 || gi_1180 == FALSE) close_buy(); } if (OrderType() == OP_SELL) { if (gi_320 != 0 && gi_1180 == TRUE && Ask - gd_324 < gi_320 * Point) close_sell(); if (gi_320 == 0 || gi_1180 == FALSE) close_sell(); } } return (0); } int OpenAll() { if (gs_1092 == "Sell") open_sell_market(gia_516[gi_1184], gd_872, g_symbol_536); if (gs_1092 == "Buy") open_buy_market(gia_516[gi_1184], gd_872, g_symbol_536); return (0); } int CloseAll() { int l_count_0 = 0; while (l_count_0 < 4) { l_count_0++; if (search_for(gia_516[gi_1184]) != 0) Close_it(); } return (0); } int scanfororders() { int l_count_0 = 0; int li_4 = search_for(gia_516[gi_1184]); if (li_4 == gia_516[gi_1184]) l_count_0++; return (l_count_0); } int scanfororders2() { bool li_ret_0 = FALSE; int li_4 = search_for(gia_516[gi_1184]); if (li_4 == gia_516[gi_1184]) { if (gs_1092 == "Sell" && OrderType() == OP_SELL) gi_1132 = FALSE; if (gs_1092 == "Buy" && OrderType() == OP_BUY) gi_1132 = FALSE; if (gs_1092 == "Buy" && OrderType() == OP_SELL) gi_1132 = TRUE; if (gs_1092 == "Sell" && OrderType() == OP_BUY) gi_1132 = TRUE; } return (li_ret_0); } int close_buy() { int l_slippage_0 = gi_320; g_count_980 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_980 <= 0) { if (gi_320 != 0 && gi_1180 == TRUE && gd_324 - Bid < gi_320 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); if (gi_320 == 0 || gi_1180 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Bid, l_slippage_0, CLR_NONE); g_count_980++; if (l_ord_close_4) break; if (g_count_980 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_972 = GetLastError(); if (gi_228 == TRUE) Alert("Error OrderClose # ", g_error_972); return (-1); } return (0); } int close_sell() { int l_slippage_0 = gi_320; g_count_980 = 0; bool l_ord_close_4 = FALSE; while (!l_ord_close_4 && g_count_980 <= 0) { if (gi_320 != 0 && gi_1180 == TRUE && Ask - gd_324 < gi_320 * Point) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); if (gi_320 == 0 || gi_1180 == FALSE) l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), Ask, l_slippage_0, CLR_NONE); g_count_980++; if (l_ord_close_4) break; if (g_count_980 > 0) break; Sleep(10000); } if (l_ord_close_4 == 0) { g_error_972 = GetLastError(); if (gi_228 == TRUE) Alert("?????? OrderClose No ", g_error_972); 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_316 = 1; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.1) gi_316 = 2; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.01) gi_316 = 3; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.001) gi_316 = 4; if (MarketInfo(Symbol(), MODE_MINLOT) < 0.0001) gi_316 = 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_316); 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_1312 = FALSE; if (ld_36 < ld_44) gi_1312 = TRUE; li_24 = ld_36 / ld_44; ld_ret_16 = li_24 / 100.0; ld_ret_16 = NormalizeDouble(ld_ret_16, gi_316); 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_316); if (gi_1332 == 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_1332 = TRUE; } if (gi_1332 == 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_1332 = TRUE; } if (gi_1332 == FALSE && gi_316 == 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_1332 = TRUE; } return (ld_ret_16); } int SetForwardActions() { gs_1092 = "Buy"; return (0); } int SetReverseActions() { gs_1092 = "Sell"; return (0); } int CalculateHighsAndLows() { gd_824 = CalculateShadowProfit("current"); if (Minute() > 10) gi_1140 = FALSE; if (Minute() < 10 && gi_1140 == FALSE) { gd_584 = -10000000.0; gd_592 = 10000000.0; gi_1140 = TRUE; } if (gd_568 < gd_824) gd_568 = gd_824; if (gd_584 < gd_824) gd_584 = gd_824; if (gd_576 > gd_824) gd_576 = gd_824; if (gd_592 > gd_824) gd_592 = gd_824; if (gd_592 == 0.0) gd_592 = gd_824; if (gd_600 < AccountEquity()) gd_600 = AccountEquity(); if (gd_608 > AccountEquity()) gd_608 = AccountEquity(); if (g_free_magrin_624 < AccountFreeMargin()) g_free_magrin_624 = AccountFreeMargin(); if (g_free_magrin_616 > AccountFreeMargin()) g_free_magrin_616 = AccountFreeMargin(); if (gd_632 < AccountBalance()) gd_632 = AccountBalance(); if (gd_640 > AccountBalance()) gd_640 = AccountBalance(); return (0); } int SetCurrenciesAndLotSize() { g_symbol_536 = Symbol(); g_lotsize_1004 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_1004 == 0.0) g_lotsize_1004 = MarketInfo(Symbol(), MODE_LOTSIZE); if (g_lotsize_1004 == 100000.0) gd_unused_1012 = 0.1; if (g_lotsize_1004 == 10000.0) gd_unused_1012 = 0.01; SetForwardActions(); if (StringLen(StringTrimLeft(gs_1092)) < 2) g_symbol_536 = " "; if (StringLen(StringTrimLeft(g_symbol_536)) < 2) gs_1092 = " "; return (0); } double CalculateShadowProfit(string as_0) { if ((gi_1180 == TRUE && as_0 == "current") || (gi_1180 == TRUE && as_0 == "ask" && AllowForSpread == FALSE)) g_price_808 = Bid; if (gi_1180 == TRUE && as_0 == "ask" && AllowForSpread == TRUE) g_price_808 = Ask; if (gi_1180 == TRUE && as_0 == "average") g_price_808 = gma(g_symbol_536); return (g_price_808); } double gma(string a_symbol_0) { double l_ima_8 = 0.0; int l_period_16 = gi_276; 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_1128 = TRUE; if (AccountNumber() == 28180) gi_1128 = TRUE; if (AccountNumber() == 24613) gi_1128 = TRUE; if (AccountNumber() == 66576) gi_1128 = TRUE; if (AccountNumber() == 11613) gi_1128 = TRUE; if (AccountNumber() == 20711) gi_1128 = TRUE; return (gi_1128); }