extern int Key = 0;
extern double Lots = 1.0;
double gd_88;
double gd_96 = 0.0;
double gd_104 = 24.0;
double gd_112 = 0.0;
double gd_120 = 24.0;
extern double TakeProfit = 35.0;
extern double StopLoss = 1000.0;
bool gi_144 = FALSE;
bool gi_148 = FALSE;
double gd_152 = 10.0;
bool gi_160 = TRUE;
bool gi_164 = TRUE;
bool gi_168 = TRUE;
bool gi_172 = TRUE;
bool gi_176 = TRUE;
bool gi_180 = TRUE;
bool gi_184 = TRUE;
int g_magic_188 = 1841;
bool gi_192 = FALSE;
bool gi_196 = FALSE;
bool gi_200 = FALSE;
double g_lots_204 = 0.0;
double gd_unused_212 = 22.0;
double gd_220 = 20.0;
double gd_228 = 22.0;
double gd_236 = 20.0;
double gd_244 = 22.0;
double gd_252 = 20.0;
double gd_260 = 22.0;
double gd_268 = 20.0;
double gd_276 = 22.0;
double gd_284 = 20.0;
double gd_292 = 22.0;
double gd_300 = 20.0;
double gd_308 = 22.0;
double gd_316 = 20.0;
double gd_324 = 22.0;
double gd_332 = 20.0;
double gd_340 = 22.0;
double gd_348 = 20.0;
double gd_356 = 22.0;
double gd_364 = 22.0;
bool gi_372 = FALSE;
int f0_0() {
bool li_ret_0 = FALSE;
for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES) == FALSE) break;
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) li_ret_0 = li_ret_0 + OrderProfit() + OrderSwap() + OrderCommission();
}
return (li_ret_0);
}
int f0_1() {
bool li_ret_0 = FALSE;
for (int pos_4 = 0; pos_4 < OrdersTotal(); pos_4++) {
if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES) == FALSE) break;
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) li_ret_0 = li_ret_0 + OrderProfit() + OrderSwap() + OrderCommission();
}
return (li_ret_0);
}
double f0_5(int ai_0, int ai_4) {
int year_8;
int month_12;
int day_16;
int datetime_20;
int hist_total_24 = OrdersHistoryTotal();
double ld_ret_28 = 0;
for (int pos_36 = 0; pos_36 < hist_total_24; pos_36++) {
OrderSelect(pos_36, SELECT_BY_POS, MODE_HISTORY);
datetime_20 = OrderCloseTime();
year_8 = TimeYear(datetime_20);
month_12 = TimeMonth(datetime_20);
day_16 = TimeDay(datetime_20);
if (year_8 == Year() && month_12 == Month() && day_16 == Day() - ai_4 && OrderMagicNumber() == g_magic_188) {
if (ai_0 == 1)
if (OrderType() == OP_BUY || OrderType() == OP_SELL) ld_ret_28 = ld_ret_28 + OrderProfit() + OrderSwap() + OrderCommission();
}
}
return (ld_ret_28);
}
int init() {
string ls_0;
string ls_8;
string ls_unused_16;
gd_88 = 100.0 * Lots;
if (gi_200) g_lots_204 = 100000.0 * Lots;
else g_lots_204 = Lots;
return (0);
}
int start() {
double price_0;
double price_8;
double price_16;
double price_24;
double price_32;
double lots_40;
double pips_48;
double pips_56;
if (!f0_2()) return (0);
double ld_64 = (iHigh(NULL, PERIOD_H1, 1) - iLow(NULL, PERIOD_H1, 1)) / Point;
int ticket_72 = 0;
int ticket_76 = 0;
int ticket_80 = 0;
int ticket_84 = 0;
int ticket_88 = 0;
int ticket_92 = 0;
double order_lots_96 = 0;
double order_lots_104 = 0;
double order_open_price_112 = 0;
double order_open_price_120 = 0;
double ld_128 = 0;
double ld_136 = 0;
double ld_unused_144 = 0;
double order_lots_152 = 0;
double ld_unused_160 = 0;
double order_lots_168 = 0;
double ld_176 = 0;
double ld_184 = 0;
gi_196 = FALSE;
if (gi_144 == TRUE) {
switch (DayOfWeek()) {
case 0:
if (gi_160 != TRUE) break;
gi_196 = TRUE;
break;
case 1:
if (gi_164 != TRUE) break;
gi_196 = TRUE;
break;
case 2:
if (gi_168 != TRUE) break;
gi_196 = TRUE;
break;
case 3:
if (gi_172 != TRUE) break;
gi_196 = TRUE;
break;
case 4:
if (gi_176 != TRUE) break;
gi_196 = TRUE;
break;
case 5:
if (gi_180 != TRUE) break;
gi_196 = TRUE;
break;
case 6:
if (gi_184 != TRUE) break;
gi_196 = TRUE;
}
} else gi_196 = TRUE;
for (int pos_196 = 0; pos_196 < OrdersTotal(); pos_196++) {
OrderSelect(pos_196, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) {
if (OrderType() == OP_BUY && ticket_72 < OrderTicket()) {
order_lots_96 = OrderLots();
order_open_price_112 = OrderOpenPrice();
ticket_72 = OrderTicket();
ld_136 = OrderTakeProfit();
if (OrderLots() == g_lots_204) ld_176 = OrderOpenPrice() - StopLoss * Point;
}
if (OrderType() == OP_SELL && ticket_76 < OrderTicket()) {
order_lots_104 = OrderLots();
order_open_price_120 = OrderOpenPrice();
ticket_76 = OrderTicket();
ld_128 = OrderTakeProfit();
if (OrderLots() == g_lots_204) ld_184 = OrderOpenPrice() + StopLoss * Point;
}
if (OrderType() == OP_BUYLIMIT) {
ticket_80 = OrderTicket();
order_lots_168 = OrderLots();
}
if (OrderType() == OP_SELLLIMIT) {
ticket_84 = OrderTicket();
order_lots_168 = OrderLots();
}
if (OrderType() == OP_BUYSTOP) {
ticket_88 = OrderTicket();
order_lots_152 = OrderLots();
}
if (OrderType() == OP_SELLSTOP) {
ticket_92 = OrderTicket();
order_lots_152 = OrderLots();
}
}
}
int li_200 = f0_0() / (AccountBalance() / 100.0);
int li_204 = f0_1() / (AccountBalance() / 100.0);
int li_unused_208 = (f0_1() + f0_0()) / (AccountBalance() / 100.0);
if (li_200 < (-1.0 * gd_152) && gi_148 == TRUE) {
for (int pos_212 = OrdersTotal() - 1; pos_212 >= 0; pos_212--) {
if (!(OrderSelect(pos_212, SELECT_BY_POS, MODE_TRADES))) break;
if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 2);
if (OrderType() == OP_BUYSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderDelete(OrderTicket());
if (OrderType() == OP_BUYLIMIT && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderDelete(OrderTicket());
}
}
if (li_204 < (-1.0 * gd_152) && gi_148 == TRUE) {
for (int pos_216 = OrdersTotal() - 1; pos_216 >= 0; pos_216--) {
if (!(OrderSelect(pos_216, SELECT_BY_POS, MODE_TRADES))) break;
if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderClose(OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 2);
if (OrderType() == OP_SELLSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderDelete(OrderTicket());
if (OrderType() == OP_SELLLIMIT && OrderSymbol() == Symbol() && OrderMagicNumber() == g_magic_188) OrderDelete(OrderTicket());
}
}
int li_unused_220 = MarketInfo(Symbol(), MODE_SPREAD);
int li_unused_224 = MarketInfo(Symbol(), MODE_POINT);
int li_unused_228 = MarketInfo(Symbol(), MODE_DIGITS);
int li_unused_232 = MarketInfo(Symbol(), MODE_TICKVALUE);
if (ticket_72 == 0 && gi_196) {
if (ticket_80 != 0) OrderDelete(ticket_80);
if (ticket_88 != 0) OrderDelete(ticket_88);
price_16 = Ask - StopLoss * Point;
if (StopLoss <= 0.0) price_16 = 0;
price_32 = Ask + TakeProfit * Point;
if ((TimeHour(TimeCurrent()) >= gd_96 && TimeHour(TimeCurrent()) < gd_104) || (TimeHour(TimeCurrent()) >= gd_112 && TimeHour(TimeCurrent()) < gd_120)) OrderSend(Symbol(), OP_BUY, g_lots_204, Ask, 3, price_16, price_32, "Magic" + g_magic_188, g_magic_188, 0, Blue);
}
if (ticket_76 == 0 && gi_196) {
if (ticket_84 != 0) OrderDelete(ticket_84);
if (ticket_92 != 0) OrderDelete(ticket_92);
price_8 = Bid + StopLoss * Point;
if (StopLoss <= 0.0) price_8 = 0;
price_24 = Bid - TakeProfit * Point;
if ((TimeHour(TimeCurrent()) >= gd_96 && TimeHour(TimeCurrent()) < gd_104) || (TimeHour(TimeCurrent()) >= gd_112 && TimeHour(TimeCurrent()) < gd_120)) OrderSend(Symbol(), OP_SELL, g_lots_204, Bid, 3, price_8, price_24, "Magic" + g_magic_188, g_magic_188, 0, Red);
}
if (ticket_72 != 0 && ticket_80 == 0) {
pips_56 = f0_3(order_lots_96);
pips_48 = f0_4(order_lots_96);
price_0 = order_open_price_112 - pips_56 * Point;
if (gi_192 == FALSE) price_16 = price_0 - StopLoss * Point;
else price_16 = ld_176;
if (StopLoss <= 0.0) price_16 = 0;
price_32 = price_0 + pips_48 * Point;
lots_40 = NormalizeDouble(2.0 * order_lots_96, pips_48);
if (gi_196 && lots_40 < gd_88) OrderSend(Symbol(), OP_BUYLIMIT, lots_40, price_0, 3, price_16, price_32, "Magic" + g_magic_188, g_magic_188, 0, Blue);
}
if (ticket_76 != 0 && ticket_84 == 0) {
pips_56 = f0_3(order_lots_104);
pips_48 = f0_4(order_lots_104);
price_0 = order_open_price_120 + pips_56 * Point;
if (gi_192 == FALSE) price_8 = price_0 + StopLoss * Point;
else price_8 = ld_184;
if (StopLoss <= 0.0) price_8 = 0;
price_24 = price_0 - pips_48 * Point;
lots_40 = NormalizeDouble(2.0 * order_lots_104, pips_48);
if (gi_196 && lots_40 < gd_88) OrderSend(Symbol(), OP_SELLLIMIT, lots_40, price_0, 3, price_8, price_24, "Magic" + g_magic_188, g_magic_188, 0, Red);
}
Comment("\nЛицензия - OK! ProfitMakerPro запущен на ", AccountNumber(),
"\n",
"\n", " Прибыль за сегодня = ", NormalizeDouble(f0_5(1, 0), 2), " $ ",
"\n", " Прибыль за вчера = ", NormalizeDouble(f0_5(1, 1), 2), " $ ",
"\n", " Текущий баланс = ", AccountBalance(), " $ ");
for (pos_196 = 0; pos_196 < OrdersTotal(); pos_196++) {
OrderSelect(pos_196, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderType() == OP_BUY && ticket_72 != 0 && OrderMagicNumber() == g_magic_188) {
if (gi_192 == FALSE) price_16 = order_open_price_112 - StopLoss * Point;
else price_16 = ld_176;
if (StopLoss <= 0.0) price_16 = 0;
if (ticket_72 != OrderTicket()) price_32 = ld_136;
else price_32 = OrderTakeProfit();
if (price_32 != OrderTakeProfit() || price_16 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), price_16, price_32, 0, Blue);
}
if (OrderSymbol() == Symbol() && OrderType() == OP_SELL && ticket_76 != 0 && OrderMagicNumber() == g_magic_188) {
if (gi_192 == FALSE) price_8 = order_open_price_120 + StopLoss * Point;
else price_8 = ld_184;
if (StopLoss <= 0.0) price_8 = 0;
if (ticket_76 != OrderTicket()) price_24 = ld_128;
else price_24 = OrderTakeProfit();
if (price_24 != OrderTakeProfit() || price_8 != OrderStopLoss()) OrderModify(OrderTicket(), OrderOpenPrice(), price_8, price_24, 0, Red);
}
}
return (0);
}
int f0_3(double ad_0) {
ad_0 = NormalizeDouble(ad_0 / g_lots_204, 0);
switch (ad_0) {
case 1.0:
return (gd_228);
case 2.0:
return (gd_228);
case 4.0:
return (gd_244);
case 8.0:
return (gd_260);
case 16.0:
return (gd_276);
case 32.0:
return (gd_292);
case 64.0:
return (gd_308);
case 128.0:
return (gd_324);
case 256.0:
return (gd_340);
case 512.0:
return (gd_356);
}
return (gd_356);
}
int f0_4(double ad_0) {
ad_0 = NormalizeDouble(ad_0 / g_lots_204, 0);
switch (ad_0) {
case 1.0:
return (gd_220);
case 2.0:
return (gd_236);
case 4.0:
return (gd_252);
case 8.0:
return (gd_268);
case 16.0:
return (gd_284);
case 32.0:
return (gd_300);
case 64.0:
return (gd_316);
case 128.0:
return (gd_332);
case 256.0:
return (gd_348);
case 512.0:
return (gd_364);
}
return (gd_364);
}