#property copyright "bibjQOOXDgt`t" #property link "" string gs_unused_76 = ""; string gs_unused_84 = ""; string gs_unused_92 = ""; double gd_100 = 3000000.0; string gs_unused_108 = ""; bool gi_116 = FALSE; string gs_unused_120 = ""; extern int StartTime = 22; extern int EndTime = 5; string gs_unused_136 = ""; extern bool MM = FALSE; extern int Risk = 0; string gs_unused_152 = ""; extern double Lots = 0.1; string gs_unused_168 = ""; double gd_176 = 100.0; double gd_unused_184 = 0.1; string gs_unused_192 = ""; int gi_200 = 2; int g_slippage_204 = 30; string gs_unused_208 = ""; int gi_216 = 70; string gs_unused_220 = ""; int gi_228 = 220; string gs_unused_232 = ""; int gi_240 = 310; int gi_unused_244 = 320; int gi_unused_248 = 150; int gi_252 = 70; string gs_unused_256 = ""; bool gi_264 = TRUE; string gs_unused_268 = ""; int gi_276 = 50; int gi_280 = 5; int gi_284 = 2; int gi_288 = 3; int g_period_292 = 11; extern double MaxSpread = 5.0; extern int Magic = 0; double gd_308 = 0.00001; string gs_unused_316 = ""; string gs_unused_324 = ""; string gs_unused_332 = ""; string gs_unused_340 = ""; int g_count_348 = 0; double g_ord_open_price_352 = 0.0; double g_ord_open_price_360 = 0.0; int g_bars_368 = -1; bool gi_372 = TRUE; int gi_376 = 60; int gi_380 = 30; int gi_384 = 140; int gi_388 = 20; int gi_392 = 170; int gi_396 = 0; int gi_400 = 200; int gi_404 = 10; int gi_408 = 240; int gi_412 = 40; double g_ifractals_416; double g_ifractals_424; double gd_unused_432; double gd_unused_440; double g_ifractals_448; double g_ifractals_456; double gd_unused_464; double gd_unused_472; int gi_unused_480 = 0; int gi_unused_484 = 0; double gd_488 = 0.0; int gi_unused_496 = 0; int init() { return (0); } int start() { if (Ask - Bid > MaxSpread / 10000.0) return (0); if (gi_116 == TRUE) { CloseAll(); return (0); } for (int li_0 = 1; li_0 < Bars; li_0++) { if (iFractals(NULL, PERIOD_M15, MODE_UPPER, li_0) != 0.0) { g_ifractals_416 = iFractals(NULL, PERIOD_M15, MODE_UPPER, li_0); gd_unused_440 = Time[li_0]; break; } } for (int li_4 = 1; li_4 < Bars; li_4++) { if (iFractals(NULL, PERIOD_M15, MODE_LOWER, li_4) != 0.0) { g_ifractals_424 = iFractals(NULL, PERIOD_M15, MODE_LOWER, li_4); gd_unused_432 = Time[li_4]; break; } } for (int li_8 = 1; li_8 < Bars; li_8++) { if (iFractals(NULL, PERIOD_H1, MODE_UPPER, li_8) != 0.0) { g_ifractals_448 = iFractals(NULL, PERIOD_H1, MODE_UPPER, li_8); gd_unused_472 = Time[li_8]; break; } } for (int li_12 = 1; li_12 < Bars; li_12++) { if (iFractals(NULL, PERIOD_H1, MODE_LOWER, li_12) != 0.0) { g_ifractals_456 = iFractals(NULL, PERIOD_H1, MODE_LOWER, li_12); gd_unused_464 = Time[li_4]; break; } } gi_unused_480 = MathRound((g_ifractals_416 - g_ifractals_424) / gd_308); gi_unused_484 = MathRound((g_ifractals_448 - g_ifractals_456) / gd_308); gd_488 = 0; gd_488 = g_ifractals_416 - (g_ifractals_416 - g_ifractals_424) / 2.0; gi_unused_496 = MathRound(iATR(Symbol(), PERIOD_M15, 4, 0) / gd_308); bool li_16 = FALSE; if (Close[0] <= g_ifractals_448 && Close[0] >= g_ifractals_456) li_16 = TRUE; if (gi_372 == TRUE) { for (int l_pos_20 = 0; l_pos_20 < OrdersTotal(); l_pos_20++) { OrderSelect(l_pos_20, SELECT_BY_POS, MODE_TRADES); if (OrderType() == OP_BUY && OrderMagicNumber() == Magic) { if (TimeCurrent() - OrderOpenTime() > 60 * gi_376 && TimeCurrent() - OrderOpenTime() < 60 * gi_384 && Bid >= OrderOpenPrice() + gi_380 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_384 && TimeCurrent() - OrderOpenTime() < 60 * gi_392 && Bid >= OrderOpenPrice() + gi_388 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_392 && TimeCurrent() - OrderOpenTime() < 60 * gi_400 && Bid >= OrderOpenPrice() - gi_396 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_400 && TimeCurrent() - OrderOpenTime() < 60 * gi_408 && Bid >= OrderOpenPrice() - gi_404 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_408 && Bid >= OrderOpenPrice() - gi_412 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } if (DayOfWeek() == 5 && Hour() >= 19) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_204, Orange); } } if (OrderType() == OP_SELL && OrderMagicNumber() == Magic) { if (TimeCurrent() - OrderOpenTime() > 60 * gi_376 && TimeCurrent() - OrderOpenTime() < 60 * gi_384 && Ask <= OrderOpenPrice() - gi_380 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_384 && TimeCurrent() - OrderOpenTime() < 60 * gi_392 && Ask <= OrderOpenPrice() - gi_388 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_392 && TimeCurrent() - OrderOpenTime() < 60 * gi_400 && Ask <= OrderOpenPrice() + gi_396 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_400 && TimeCurrent() - OrderOpenTime() < 60 * gi_408 && Ask <= OrderOpenPrice() + gi_404 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } if (TimeCurrent() - OrderOpenTime() > 60 * gi_408 && Ask <= OrderOpenPrice() + gi_412 * gd_308) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } if (DayOfWeek() == 5 && Hour() >= 19) { RefreshRates(); OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_204, Orange); } } } } if (gd_100 > 0.0 && AccountEquity() >= gd_100) { ForceCloseAll(); return (0); } int l_count_24 = 0; int l_count_28 = 0; int l_count_32 = 0; int l_ticket_36 = -1; int l_pos_40 = 0; for (l_pos_40 = 0; l_pos_40 < OrdersTotal(); l_pos_40++) { OrderSelect(l_pos_40, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderCloseTime() == 0) { l_count_32++; if (OrderType() == OP_BUY) { l_count_24++; g_ord_open_price_352 = OrderOpenPrice(); } if (OrderType() == OP_SELL) { l_count_28++; g_ord_open_price_360 = OrderOpenPrice(); } } } if (Tradetime() == 1) { if (Tradetime2() != 1) { if (l_count_32 <= gi_280) { if (g_bars_368 != Bars) { g_count_348 = 0; g_bars_368 = Bars; } RefreshRates(); if (l_count_28 <= gi_288 && li_16 && g_count_348 <= gi_284 && (Ask - g_ord_open_price_360 >= gi_276 * gd_308 || l_count_28 < 1 && Ask >= gd_488 + gi_252 * gd_308) && GetSignal(1) == 1) { if (!(AccountFreeMarginCheck(Symbol(), OP_SELL, GetLots()) <= 0.0) && !(GetLastError() == 134/* NOT_ENOUGH_MONEY */)) { if (gi_264 == TRUE) l_ticket_36 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_204, Bid + gi_240 * gd_308, 0, "Your_Lucky" + Symbol(), Magic, 0, Red); else l_ticket_36 = OrderSend(Symbol(), OP_SELL, GetLots(), Bid, g_slippage_204, Bid + gi_240 * gd_308, Bid - gi_216 * gd_308, "Your_Lucky" + Symbol(), Magic, 0, Red); if (l_ticket_36 > 0) g_count_348++; } } if (l_count_24 <= gi_288 && li_16 && g_count_348 <= gi_284 && (g_ord_open_price_352 - Bid >= gi_276 * gd_308 || l_count_24 < 1 && Bid <= gd_488 - gi_252 * gd_308) && GetSignal(0) == 1) { if (!(AccountFreeMarginCheck(Symbol(), OP_BUY, GetLots()) <= 0.0) && !(GetLastError() == 134/* NOT_ENOUGH_MONEY */)) { if (gi_264 == TRUE) l_ticket_36 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_204, Ask - gi_240 * gd_308, 0, "Your_Lucky" + Symbol(), Magic, 0, Blue); else l_ticket_36 = OrderSend(Symbol(), OP_BUY, GetLots(), Ask, g_slippage_204, Ask - gi_240 * gd_308, Ask + gi_216 * gd_308, "Your_Lucky" + Symbol(), Magic, 0, Blue); if (l_ticket_36 > 0) g_count_348++; } } } } } CloseAll(); return (0); } int GetSignal(int ai_0) { bool li_ret_4 = FALSE; if (ai_0 == 0) { if (iClose(Symbol(), 0, 0) < iMA(Symbol(), 0, g_period_292, 0, MODE_SMA, PRICE_OPEN, 0)) li_ret_4 = TRUE; } else { if (ai_0 == 1) if (iClose(Symbol(), 0, 0) > iMA(Symbol(), 0, g_period_292, 0, MODE_SMA, PRICE_OPEN, 0)) li_ret_4 = TRUE; } return (li_ret_4); } void CloseAll() { for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) { OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderCloseTime() == 0) { if (SecurProfit() == 1) { if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue); if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red); } else { if (Tradetime() == 0) { if (OrderType() == OP_BUY && (OrderOpenPrice() - Ask) / gd_308 > gi_228) OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue); if (OrderType() == OP_SELL && (Bid - OrderOpenPrice()) / gd_308 > gi_228) OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red); } else { if (OrderType() == OP_BUY && (OrderOpenPrice() - Ask) / gd_308 > gi_240) OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue); if (OrderType() == OP_SELL && (Bid - OrderOpenPrice()) / gd_308 > gi_240) OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red); } } } } } void ForceCloseAll() { for (int l_pos_0 = OrdersTotal() - 1; l_pos_0 >= 0; l_pos_0--) { OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES); if (OrderSymbol() == Symbol() && OrderMagicNumber() == Magic && OrderCloseTime() == 0) { if (OrderType() == OP_BUY) OrderClose(OrderTicket(), OrderLots(), Bid, 3, Blue); if (OrderType() == OP_SELL) OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red); } } } int Tradetime() { bool li_ret_0 = FALSE; if (Hour() <= EndTime || Hour() >= StartTime) li_ret_0 = TRUE; return (li_ret_0); } int Tradetime2() { bool li_ret_0 = FALSE; if ((DayOfWeek() == 1 && Hour() <= StartTime) || (DayOfWeek() == 5 && Hour() >= EndTime)) li_ret_0 = TRUE; return (li_ret_0); } double GetLots() { double l_lots_0; int li_48; double l_lotsize_40 = MarketInfo(Symbol(), MODE_LOTSIZE); double ld_8 = NormalizeDouble(MarketInfo(Symbol(), MODE_LOTSTEP), 2); double ld_16 = NormalizeDouble(MarketInfo(Symbol(), MODE_MARGINREQUIRED), 4); double ld_24 = 100.0 * (ld_16 + 5.0); if (gi_200 == 0) { if (ld_8 == 0.01) li_48 = 2; else li_48 = 1; gi_200 = li_48; } if (MM == TRUE) l_lots_0 = NormalizeDouble(AccountFreeMargin() * Risk / l_lotsize_40 / gi_280, gi_200); else l_lots_0 = Lots; double ld_32 = NormalizeDouble(MarketInfo(Symbol(), MODE_MINLOT), 2); if (l_lots_0 < ld_32) l_lots_0 = ld_32; if (l_lots_0 > gd_176) l_lots_0 = gd_176; return (l_lots_0); } double TickValue() { double ld_0 = NormalizeDouble(MarketInfo(Symbol(), MODE_TICKVALUE), 4); return (ld_0); } int SecurProfit() { bool li_ret_0 = FALSE; if (OrderProfit() > TickValue() * GetLots() * gi_216) li_ret_0 = TRUE; return (li_ret_0); }