/* Generated by EX4-TO-MQ4 decompiler V4.0.427.4 [-] Website: https://purebeam.biz E-mail : purebeam@gmail.com */ #property copyright "Copyright © 2011, AZM" #property link "azmgod@gmail.com" #include <WinUser32.mqh> extern string настройки_лота; extern double lot = 1.0; extern bool loss_percent_lot = FALSE; extern double MaxRisk = 2.0; extern bool trall = FALSE; extern int tlevel = 50; extern bool zero = FALSE; extern int zerolevel = 48; extern bool on_time = TRUE; extern int HourStart = 4; extern int HourStop = 22; extern string отключение; extern bool ZZ_M5 = TRUE; extern bool ZZ_M15 = TRUE; extern bool ZZ_M30 = TRUE; extern bool ZZ_H1 = TRUE; extern string настройки_ZZh1; extern int ExtDepth_h1_sell = 14; extern int ExtDeviatiion_h1_sell = 0; extern int ExtBackstep_h1_sell = 3; extern int profit_sell_h1 = 180; extern int profit_sell_h1_doli = 100; extern int stop_loss_sell_h1 = 20; extern int stop_loss_sell_h1_doli = 18; extern int indent_sell_h1 = 9; extern int indent_sell_h1_doli = 3; extern int ExtDepth_h1_buy = 15; extern int ExtDeviatiion_h1_buy = 0; extern int ExtBackstep_h1_buy = 3; extern int profit_buy_h1 = 220; extern int profit_buy_h1_doli = 300; extern int stop_loss_buy_h1 = 9; extern int stop_loss_buy_h1_doli = 6; extern int indent_buy_h1 = 11; extern int indent_buy_h1_doli = 29; extern string настройки_ZZm30; extern int ExtDepth_m30_sell = 29; extern int ExtDeviatiion_m30_sell = 0; extern int ExtBackstep_m30_sell = 3; extern int profit_sell_m30 = 220; extern int stop_loss_sell_m30 = 13; extern int indent_sell_m30 = 6; extern int ExtDepth_m30_buy = 15; extern int ExtDeviatiion_m30_buy = 0; extern int ExtBackstep_m30_buy = 3; extern int profit_buy_m30 = 190; extern int stop_loss_buy_m30 = 6; extern int indent_buy_m30 = 13; extern string настройки_ZZm15; extern int ExtDepth_m15_sell = 30; extern int ExtDeviatiion_m15_sell = 0; extern int ExtBackstep_m15_sell = 3; extern int profit_sell_m15 = 180; extern int stop_loss_sell_m15 = 10; extern int indent_sell_m15 = 18; extern int ExtDepth_m15_buy = 15; extern int ExtDeviatiion_m15_buy = 0; extern int ExtBackstep_m15_buy = 3; extern int profit_buy_m15 = 100; extern int stop_loss_buy_m15 = 11; extern int indent_buy_m15 = 8; extern string настройки_ZZm5; extern bool m5_filtr = TRUE; extern int ExtDepth_m5_sell = 28; extern int ExtDeviatiion_m5_sell = 0; extern int ExtBackstep_m5_sell = 3; extern int profit_sell_m5 = 320; extern int stop_loss_sell_m5 = 10; extern int indent_sell_m5 = 2; extern int ExtDepth_m5_buy = 22; extern int ExtDeviatiion_m5_buy = 0; extern int ExtBackstep_m5_buy = 3; extern int profit_buy_m5 = 185; extern int stop_loss_buy_m5 = 8; extern int indent_buy_m5 = 5; int gi_408; int gi_412; double gd_416; double gd_424; double g_digits_432; double g_icustom_440 = 0.0; double g_icustom_448 = 0.0; double g_icustom_456 = 0.0; double g_icustom_464 = 0.0; double g_icustom_472 = 0.0; double g_icustom_480 = 0.0; double g_icustom_488 = 0.0; double g_icustom_496 = 0.0; double g_icustom_504 = 0.0; double g_icustom_512 = 0.0; double g_icustom_520 = 0.0; double g_icustom_528 = 0.0; double g_icustom_536 = 0.0; double g_icustom_544 = 0.0; double g_icustom_552 = 0.0; double g_icustom_560 = 0.0; double g_icustom_568 = 0.0; double g_icustom_576 = 0.0; double g_icustom_584 = 0.0; double g_icustom_592 = 0.0; double g_icustom_600 = 0.0; double g_icustom_608 = 0.0; double g_icustom_616 = 0.0; double g_icustom_624 = 0.0; int g_datetime_632 = 0; int g_datetime_636 = 0; int g_datetime_640 = 0; int init() { double ld_8; double ld_16; g_digits_432 = MarketInfo(Symbol(), MODE_DIGITS); if (g_digits_432 == 5.0 || g_digits_432 == 3.0) gi_408 = 10; if (g_digits_432 == 5.0) gi_412 = 100000; if (g_digits_432 == 3.0) gi_412 = 1000; if (g_digits_432 == 4.0 || g_digits_432 == 2.0) gi_408 = 1; if (g_digits_432 == 4.0) gi_412 = 10000; if (g_digits_432 == 2.0) gi_412 = 100; gd_424 = MarketInfo(Symbol(), MODE_MINLOT); Comment("http://strategy4you.ru/"); double ld_0 = MarketInfo(Symbol(), MODE_MINLOT); Print("AZM for http://strategy4you.ru/"); if (lot < ld_0) { lot = ld_0; MessageBox("НЕ ДОПУСТИМЫЙ РАЗМЕР ЛОТА. РАБОТА БУДЕТ ПРОДОЛЖЕНА С ЛОТОМ " + ld_0, NULL, MB_ICONEXCLAMATION); } if (zero) { ld_8 = MarketInfo(Symbol(), MODE_STOPLEVEL); if (zerolevel < ld_8) MessageBox("НЕ ДОПУСТИМЫЙ УРОВЕНЬ zerolevel. РАБОТА БУДЕТ ПРОДОЛЖЕНА С УРОВНЕМ " + ld_8, NULL, MB_ICONEXCLAMATION); zerolevel = ld_8; } if (trall) { ld_16 = MarketInfo(Symbol(), MODE_STOPLEVEL); if (tlevel < ld_16) MessageBox("НЕ ДОПУСТИМЫЙ УРОВЕНЬ tlevel. РАБОТА БУДЕТ ПРОДОЛЖЕНА С УРОВНЕМ " + ld_16, NULL, MB_ICONEXCLAMATION); tlevel = ld_16; } return (0); } int deinit() { return (0); } int start() { gd_416 = MarketInfo(Symbol(), MODE_SPREAD); if (trall) { if (ZZ_M5) { f0_30("z5dn"); f0_30("z5up"); } if (ZZ_M15) { f0_30("z15dn"); f0_30("z15up"); } if (ZZ_M30) { f0_30("z30dn"); f0_30("z30up"); } if (ZZ_H1) { f0_30("zdn"); f0_30("zup"); } } if (zero) { if (ZZ_M5) { f0_15("z5dn"); f0_15("z5up"); } if (ZZ_M15) { f0_15("z15dn"); f0_15("z15up"); } if (ZZ_M30) { f0_15("z30dn"); f0_15("z30up"); } if (ZZ_H1) { f0_15("zdn"); f0_15("zup"); } } if (f0_32()) { if (f0_25()) { if (f0_4()) { f0_26(); f0_14(); f0_1(); f0_0(); f0_5(); if (m5_filtr) { if (GlobalVariableGet("trend" + Symbol()) == 5.0) f0_11(); if (GlobalVariableGet("trend" + Symbol()) == 4.0) f0_6(); } else { f0_11(); f0_6(); } f0_23(); f0_7(); f0_12(); f0_8(); f0_29(); f0_27(); f0_10(); f0_16(); f0_31(); f0_3(); f0_2(); f0_24(); f0_28(); f0_21(); f0_17(); f0_33(); f0_18(); f0_22(); } else { f0_26(); f0_14(); f0_1(); f0_0(); if (m5_filtr) { if (GlobalVariableGet("trend" + Symbol()) == 5.0) f0_11(); if (GlobalVariableGet("trend" + Symbol()) == 4.0) f0_6(); } else { f0_11(); f0_6(); } f0_23(); f0_7(); f0_12(); f0_8(); f0_29(); f0_27(); f0_28(); f0_21(); f0_17(); f0_33(); f0_18(); f0_22(); } } else { f0_26(); f0_14(); f0_1(); f0_0(); if (m5_filtr) { if (GlobalVariableGet("trend" + Symbol()) == 5.0) f0_11(); if (GlobalVariableGet("trend" + Symbol()) == 4.0) f0_6(); } else { f0_11(); f0_6(); } } } return (0); } void f0_2() { bool li_4; double icustom_8; double icustom_16; if (ZZ_H1) { if (on_time && f0_13() == 0) return; li_4 = FALSE; icustom_8 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 1, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 2, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_440 != icustom_16) { g_icustom_440 = icustom_16; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "zdn") if (Symbol() == OrderSymbol()) li_4 = TRUE; } } if (li_4) { OrderSend(Symbol(), OP_SELLSTOP, lot, NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1_doli * Point, Digits), 0, NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1_doli * Point + gi_408 * stop_loss_sell_h1_doli * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1_doli * Point - gi_408 * profit_sell_h1_doli * Point - gd_416 * Point, Digits), "zdn"); } f0_20(OP_SELLSTOP, lot, NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1 * Point, Digits), NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1 * Point + gi_408 * stop_loss_sell_h1 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_440 - gi_408 * indent_sell_h1 * Point - gi_408 * profit_sell_h1 * Point - gd_416 * Point, Digits), "zdn"); } } } } void f0_31() { double icustom_4; double icustom_12; if (ZZ_H1) { icustom_4 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 2, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_448 != icustom_12) { g_icustom_448 = icustom_12; f0_19("zdn", OP_SELLSTOP, lot); } } } } void f0_24() { bool li_4; double icustom_8; double icustom_16; if (ZZ_H1) { if (on_time && f0_13() == 0) return; li_4 = FALSE; icustom_8 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 2, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 1, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_456 != icustom_16) { g_icustom_456 = icustom_16; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "zup") if (Symbol() == OrderSymbol()) li_4 = TRUE; } } if (li_4) { OrderSend(Symbol(), OP_BUYSTOP, lot, NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1_doli * Point + gd_416 * Point, Digits), 0, NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1_doli * Point - gi_408 * stop_loss_buy_h1_doli * Point, Digits), NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1_doli * Point + gi_408 * profit_buy_h1_doli * Point, Digits), "zup"); } f0_20(OP_BUYSTOP, lot, NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1 * Point - gi_408 * stop_loss_buy_h1 * Point, Digits), NormalizeDouble(g_icustom_456 + gi_408 * indent_buy_h1 * Point + gi_408 * profit_buy_h1 * Point, Digits), "zup"); } } } } void f0_3() { double icustom_4; double icustom_12; if (ZZ_H1) { icustom_4 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 1, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_464 != icustom_12) { g_icustom_464 = icustom_12; f0_19("zup", OP_BUYSTOP, lot); } } } } void f0_16() { double icustom_4; double ld_12; if (ZZ_H1) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_sell, ExtDeviatiion_h1_sell, ExtBackstep_h1_sell, 1, li_0); if (ld_12 != 0.0) break; } if (g_icustom_472 != ld_12) { g_icustom_472 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "zdn") { if (Symbol() == OrderSymbol()) if (g_icustom_472 < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_472, OrderTakeProfit(), 0); } } } } } } } } void f0_10() { double icustom_4; double ld_12; if (ZZ_H1) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_H1, "ZigZag", ExtDepth_h1_buy, ExtDeviatiion_h1_buy, ExtBackstep_h1_buy, 2, li_0); if (ld_12 != 0.0) break; } if (g_icustom_480 != ld_12) { g_icustom_480 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "zup") { if (Symbol() == OrderSymbol()) if (OrderOpenPrice() < g_icustom_480) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_480, OrderTakeProfit(), 0); } } } } } } } } void f0_18() { int li_unused_4; double icustom_8; double icustom_16; double icustom_24; if (ZZ_M30) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 1, 1); icustom_16 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 1, 2); if (icustom_8 != 0.0 || icustom_16 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_24 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 2, li_0); if (icustom_24 != 0.0) break; } if (g_icustom_488 != icustom_24) { g_icustom_488 = icustom_24; f0_20(OP_SELLSTOP, lot, NormalizeDouble(g_icustom_488 - gi_408 * indent_sell_m30 * Point, Digits), NormalizeDouble(g_icustom_488 - gi_408 * indent_sell_m30 * Point + gi_408 * stop_loss_sell_m30 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_488 - gi_408 * indent_sell_m30 * Point - gi_408 * profit_sell_m30 * Point - gd_416 * Point, Digits), "z30dn"); } } } } void f0_17() { double icustom_4; double icustom_12; double icustom_20; if (ZZ_M30) { icustom_4 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 1, 1); icustom_12 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 1, 2); if (icustom_4 != 0.0 || icustom_12 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_20 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 2, li_0); if (icustom_20 != 0.0) break; } if (g_icustom_496 != icustom_20) { g_icustom_496 = icustom_20; f0_19("z30dn", OP_SELLSTOP, lot); } } } } void f0_22() { int li_unused_4; double icustom_8; double icustom_16; double icustom_24; if (ZZ_M30) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 2, 1); icustom_16 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 2, 2); if (icustom_8 != 0.0 || icustom_16 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_24 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 1, li_0); if (icustom_24 != 0.0) break; } if (g_icustom_504 != icustom_24) { g_icustom_504 = icustom_24; f0_20(OP_BUYSTOP, lot, NormalizeDouble(g_icustom_504 + gi_408 * indent_buy_m30 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_504 + gi_408 * indent_buy_m30 * Point - gi_408 * stop_loss_buy_m30 * Point, Digits), NormalizeDouble(g_icustom_504 + gi_408 * indent_buy_m30 * Point + gi_408 * profit_buy_m30 * Point, Digits), "z30up"); } } } } void f0_33() { double icustom_4; double icustom_12; double icustom_20; if (ZZ_M30) { icustom_4 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 2, 1); icustom_12 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 2, 2); if (icustom_4 != 0.0 || icustom_12 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_20 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 1, li_0); if (icustom_20 != 0.0) break; } if (g_icustom_512 != icustom_20) { g_icustom_512 = icustom_20; f0_19("z30up", OP_BUYSTOP, lot); } } } } void f0_28() { double icustom_4; double ld_12; if (ZZ_M30) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, ExtBackstep_m30_sell, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_sell, ExtDeviatiion_m30_sell, 3, 1, li_0); if (ld_12 != 0.0) break; } if (g_icustom_520 != ld_12) { g_icustom_520 = ld_12; for (li_0 = 1; li_0 <= OrdersTotal(); li_0++) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z30dn") if (g_icustom_520 < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_520, OrderTakeProfit(), 0); } } } } } } } void f0_21() { double icustom_4; double ld_12; if (ZZ_M30) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M30, "ZigZag", ExtDepth_m30_buy, ExtDeviatiion_m30_buy, ExtBackstep_m30_buy, 2, li_0); if (ld_12 != 0.0) break; } if (g_icustom_528 != ld_12) { g_icustom_528 = ld_12; for (li_0 = 1; li_0 <= OrdersTotal(); li_0++) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z30up") if (OrderOpenPrice() < g_icustom_528) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_528, OrderTakeProfit(), 0); } } } } } } } void f0_29() { int li_unused_4; double icustom_8; double icustom_16; if (ZZ_M15) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 1, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 2, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_536 != icustom_16) { g_icustom_536 = icustom_16; f0_20(OP_SELLSTOP, lot, NormalizeDouble(g_icustom_536 - gi_408 * indent_sell_m15 * Point, Digits), NormalizeDouble(g_icustom_536 - gi_408 * indent_sell_m15 * Point + gi_408 * stop_loss_sell_m15 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_536 - gi_408 * indent_sell_m15 * Point - gi_408 * profit_sell_m15 * Point - gd_416 * Point, Digits), "z15dn"); } } } } void f0_12() { double icustom_4; double icustom_12; if (ZZ_M15) { icustom_4 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 2, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_544 != icustom_12) { g_icustom_544 = icustom_12; f0_19("z15dn", OP_SELLSTOP, lot); } } } } void f0_27() { int li_unused_4; double icustom_8; double icustom_16; if (ZZ_M15) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 2, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 1, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_552 != icustom_16) { g_icustom_552 = icustom_16; f0_20(OP_BUYSTOP, lot, NormalizeDouble(g_icustom_552 + gi_408 * indent_buy_m15 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_552 + gi_408 * indent_buy_m15 * Point - gi_408 * stop_loss_buy_m15 * Point, Digits), NormalizeDouble(g_icustom_552 + gi_408 * indent_buy_m15 * Point + gi_408 * profit_buy_m15 * Point, Digits), "z15up"); } } } } void f0_8() { double icustom_4; double icustom_12; if (ZZ_M15) { icustom_4 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 1, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_560 != icustom_12) { g_icustom_560 = icustom_12; f0_19("z15up", OP_BUYSTOP, lot); } } } } void f0_7() { double icustom_4; double ld_12; if (ZZ_M15) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_sell, ExtDeviatiion_m15_sell, ExtBackstep_m15_sell, 1, li_0); if (ld_12 != 0.0) break; } if (g_icustom_568 != ld_12) { g_icustom_568 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z15dn") { if (Symbol() == OrderSymbol()) if (g_icustom_568 < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_568, OrderTakeProfit(), 0); } } } } } } } } void f0_23() { double icustom_4; double ld_12; if (ZZ_M15) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M15, "ZigZag", ExtDepth_m15_buy, ExtDeviatiion_m15_buy, ExtBackstep_m15_buy, 2, li_0); if (ld_12 != 0.0) break; } if (g_icustom_576 != ld_12) { g_icustom_576 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z15up") { if (Symbol() == OrderSymbol()) if (OrderOpenPrice() < g_icustom_576) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_576, OrderTakeProfit(), 0); } } } } } } } } void f0_11() { int li_unused_4; double icustom_8; double icustom_16; if (ZZ_M5) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 1, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 2, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_584 != icustom_16) { g_icustom_584 = icustom_16; f0_20(OP_SELLSTOP, lot, NormalizeDouble(g_icustom_584 - gi_408 * indent_sell_m5 * Point, Digits), NormalizeDouble(g_icustom_584 - gi_408 * indent_sell_m5 * Point + gi_408 * stop_loss_sell_m5 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_584 - gi_408 * profit_sell_m5 * Point - gd_416 * Point, Digits), "z5dn"); } } } } void f0_1() { double icustom_4; double icustom_12; if (ZZ_M5) { icustom_4 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 2, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_592 != icustom_12) { g_icustom_592 = icustom_12; f0_19("z5dn", OP_SELLSTOP, lot); } } } } void f0_6() { int li_unused_4; double icustom_8; double icustom_16; if (ZZ_M5) { if (on_time && f0_13() == 0) return; li_unused_4 = 0; icustom_8 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 2, 1); if (icustom_8 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_16 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 1, li_0); if (icustom_16 != 0.0) break; } if (g_icustom_600 != icustom_16) { g_icustom_600 = icustom_16; f0_20(OP_BUYSTOP, lot, NormalizeDouble(g_icustom_600 + gi_408 * indent_buy_m5 * Point + gd_416 * Point, Digits), NormalizeDouble(g_icustom_600 + gi_408 * indent_buy_m5 * Point - gi_408 * stop_loss_buy_m5 * Point, Digits), NormalizeDouble(g_icustom_600 + gi_408 * profit_buy_m5 * Point, Digits), "z5up"); } } } } void f0_0() { double icustom_4; double icustom_12; if (ZZ_M5) { icustom_4 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 1, li_0); if (icustom_12 != 0.0) break; } if (g_icustom_608 != icustom_12) { g_icustom_608 = icustom_12; f0_19("z5up", OP_BUYSTOP, lot); } } } } void f0_14() { double icustom_4; double ld_12; if (ZZ_M5) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 2, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_sell, ExtDeviatiion_m5_sell, ExtBackstep_m5_sell, 1, li_0); if (ld_12 != 0.0) break; } if (g_icustom_616 != ld_12) { g_icustom_616 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z5dn") { if (Symbol() == OrderSymbol()) if (g_icustom_616 < OrderOpenPrice()) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_616, OrderTakeProfit(), 0); } } } } } } } } void f0_26() { double icustom_4; double ld_12; if (ZZ_M5) { if (trall == FALSE) { icustom_4 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { ld_12 = iCustom(Symbol(), PERIOD_M5, "ZigZag", ExtDepth_m5_buy, ExtDeviatiion_m5_buy, ExtBackstep_m5_buy, 2, li_0); if (ld_12 != 0.0) break; } if (g_icustom_624 != ld_12) { g_icustom_624 = ld_12; for (li_0 = OrdersTotal(); li_0 >= 0; li_0--) { if (OrderSelect(li_0 - 1, SELECT_BY_POS) == TRUE) { if (OrderComment() == "z5up") { if (Symbol() == OrderSymbol()) if (OrderOpenPrice() < g_icustom_624) OrderModify(OrderTicket(), OrderOpenPrice(), g_icustom_624, OrderTakeProfit(), 0); } } } } } } } } void f0_15(string as_0) { for (int li_8 = OrdersTotal(); li_8 >= 0; li_8--) { if (OrderSelect(li_8 - 1, SELECT_BY_POS) == TRUE) { if (as_0 == OrderComment()) { if (Symbol() == OrderSymbol()) { if (OrderType() == OP_BUY) { if (OrderStopLoss() < OrderOpenPrice()) if (Bid > OrderOpenPrice() + gi_408 * zerolevel * Point) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + 1 * gi_408 * Point, OrderTakeProfit(), 0); } } } } } for (li_8 = OrdersTotal(); li_8 >= 0; li_8--) { if (OrderSelect(li_8 - 1, SELECT_BY_POS) == TRUE) { if (as_0 == OrderComment()) { if (Symbol() == OrderSymbol()) { if (OrderType() == OP_SELL) { if (OrderStopLoss() > OrderOpenPrice()) if (OrderOpenPrice() - gi_408 * zerolevel * Point > Bid) OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - 1 * gi_408 * Point, OrderTakeProfit(), 0); } } } } } } void f0_30(string as_0) { for (int li_8 = OrdersTotal(); li_8 >= 0; li_8--) { if (OrderSelect(li_8 - 1, SELECT_BY_POS) == TRUE) { if (as_0 == OrderComment()) { if (Symbol() == OrderSymbol()) { if (OrderType() == OP_BUY) { if (Bid - OrderOpenPrice() >= gi_408 * tlevel * Point) if (OrderStopLoss() + gi_408 * (tlevel + 1) * Point < Bid) OrderModify(OrderTicket(), OrderOpenPrice(), Bid - gi_408 * tlevel * Point, OrderTakeProfit(), 0); } if (OrderType() == OP_SELL) { if (OrderOpenPrice() - Bid >= gi_408 * tlevel * Point) if (OrderStopLoss() - gi_408 * (tlevel + 1) * Point > Bid) OrderModify(OrderTicket(), OrderOpenPrice(), Bid + gi_408 * tlevel * Point, OrderTakeProfit(), 0); } } } } } } double f0_9(int ai_0) { double ld_4 = AccountBalance(); double tickvalue_12 = MarketInfo(Symbol(), MODE_TICKVALUE); double ld_20 = MarketInfo(Symbol(), MODE_MINLOT); double ld_28 = MarketInfo(Symbol(), MODE_MAXLOT); double lotstep_36 = MarketInfo(Symbol(), MODE_LOTSTEP); Print(lotstep_36); double ld_ret_44 = MathFloor(ld_4 * MaxRisk / 100.0 / (ai_0 * tickvalue_12) / lotstep_36) * lotstep_36; if (ld_ret_44 < ld_20) ld_ret_44 = ld_20; if (ld_ret_44 > ld_28) ld_ret_44 = ld_28; return (ld_ret_44); } int f0_13() { if (HourStop == HourStart) return (0); if (HourStop < 0 || HourStart < 0) return (0); if (HourStart < HourStop) { if (!(Hour() >= HourStart && Hour() < HourStop)) return (0); return (1); } if (HourStart > HourStop) { if (!((Hour() >= HourStart && HourStart <= 23) || (Hour() < HourStop && HourStop >= 0))) return (0); return (1); } return (0); } void f0_5() { double icustom_4; double icustom_12; int li_20; double icustom_24; double icustom_32; double icustom_40; double icustom_48; double icustom_56; double icustom_64; if (ZZ_M5) { icustom_4 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 1, 1); if (icustom_4 != 0.0) { for (int li_0 = 2; li_0 < Bars; li_0++) { icustom_12 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 2, li_0); if (icustom_12 != 0.0) { li_20 = li_0; break; } } for (li_0 = li_20; li_0 < Bars; li_0++) { icustom_24 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 1, li_0); if (icustom_24 != 0.0) { li_20 = li_0; break; } } for (li_0 = li_20; li_0 < Bars; li_0++) { icustom_32 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 2, li_0); if (icustom_32 != 0.0) break; } } if (icustom_32 < icustom_12) GlobalVariableSet("trend" + Symbol(), 4); icustom_40 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 2, 1); if (icustom_40 != 0.0) { for (li_0 = 2; li_0 < Bars; li_0++) { icustom_48 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 1, li_0); if (icustom_48 != 0.0) { li_20 = li_0; break; } } for (li_0 = li_20; li_0 < Bars; li_0++) { icustom_56 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 2, li_0); if (icustom_56 != 0.0) { li_20 = li_0; break; } } for (li_0 = li_20; li_0 < Bars; li_0++) { icustom_64 = iCustom(Symbol(), PERIOD_H1, "ZigZag", 15, 0, 3, 1, li_0); if (icustom_64 != 0.0) break; } } if (icustom_64 > icustom_48) GlobalVariableSet("trend" + Symbol(), 5); } } void f0_20(int a_cmd_0, double a_minlot_4, double ad_12, double ad_20, double ad_28, string a_comment_36) { bool li_48 = FALSE; if (a_cmd_0 == OP_BUY || a_cmd_0 == OP_BUYLIMIT || a_cmd_0 == OP_BUYSTOP) { for (int li_44 = OrdersTotal(); li_44 >= 0; li_44--) { if (OrderSelect(li_44 - 1, SELECT_BY_POS) == TRUE) { if (a_comment_36 == OrderComment()) if (Symbol() == OrderSymbol()) li_48 = TRUE; } } if (!li_48) { while (!IsTradeAllowed()) Sleep(100); if (a_cmd_0 == OP_BUY) { ad_12 = Ask; if (ad_20 != 0.0 && Bid - ad_20 < 5 * gi_408 * Point) ad_20 = Bid - 5 * gi_408 * Point; } if (a_cmd_0 == OP_BUYSTOP) if (ad_12 < Ask + 7 * gi_408 * Point) ad_12 = Ask + 7 * gi_408 * Point; if (a_cmd_0 == OP_BUYLIMIT) { if (ad_12 > Ask - 5 * gi_408 * Point) ad_12 = Ask - 6 * gi_408 * Point; if (ad_20 > ad_12 - 5 * gi_408 * Point) ad_20 = ad_12 - 6 * gi_408 * Point; } if (loss_percent_lot) a_minlot_4 = f0_9((NormalizeDouble(ad_12, Digits) - NormalizeDouble(ad_20, Digits)) * gi_412); if (a_minlot_4 < gd_424) a_minlot_4 = gd_424; OrderSend(Symbol(), a_cmd_0, a_minlot_4, NormalizeDouble(ad_12, Digits), gi_408 * 2 * Point, NormalizeDouble(ad_20, Digits), NormalizeDouble(ad_28, Digits), a_comment_36); } } if (a_cmd_0 == OP_SELL || a_cmd_0 == OP_SELLLIMIT || a_cmd_0 == OP_SELLSTOP) { for (li_44 = OrdersTotal(); li_44 >= 0; li_44--) { if (OrderSelect(li_44 - 1, SELECT_BY_POS) == TRUE) { if (a_comment_36 == OrderComment()) if (Symbol() == OrderSymbol()) li_48 = TRUE; } } if (!li_48) { while (!IsTradeAllowed()) Sleep(100); if (a_cmd_0 == OP_SELL) { ad_12 = Bid; if (ad_20 != 0.0 && ad_20 - Ask < 5 * gi_408 * Point) ad_20 = Ask + 5 * gi_408 * Point; } if (a_cmd_0 == OP_SELLSTOP) if (ad_12 > Bid - 7 * gi_408 * Point) ad_12 = Bid - 7 * gi_408 * Point; if (a_cmd_0 == OP_SELLLIMIT) { if (ad_12 < Bid + 5 * gi_408 * Point) ad_12 = Bid + 6 * gi_408 * Point; if (ad_20 < ad_12 + 5 * gi_408 * Point) ad_20 = ad_12 + 6 * gi_408 * Point; } if (loss_percent_lot) a_minlot_4 = f0_9((NormalizeDouble(ad_20, Digits) - NormalizeDouble(ad_12, Digits)) * gi_412); if (a_minlot_4 < gd_424) a_minlot_4 = gd_424; OrderSend(Symbol(), a_cmd_0, a_minlot_4, NormalizeDouble(ad_12, Digits), gi_408 * 2 * Point, NormalizeDouble(ad_20, Digits), NormalizeDouble(ad_28, Digits), a_comment_36); } } } void f0_19(string as_0, int a_cmd_8, double a_lots_12) { double price_24; if (a_cmd_8 > OP_SELL) { for (int li_20 = OrdersTotal(); li_20 >= 0; li_20--) { if (OrderSelect(li_20 - 1, SELECT_BY_POS) == TRUE) { if (as_0 == OrderComment()) { if (a_cmd_8 == OrderType()) { if (Symbol() == OrderSymbol()) { while (!IsTradeAllowed()) Sleep(100); OrderDelete(OrderTicket()); } } } } } } if (a_cmd_8 < OP_BUYLIMIT) { for (li_20 = OrdersTotal(); li_20 >= 0; li_20--) { if (OrderSelect(li_20 - 1, SELECT_BY_POS) == TRUE) { if (as_0 == OrderComment()) { if (OrderType() <= OP_SELL) { if (Symbol() == OrderSymbol()) { while (!IsTradeAllowed()) Sleep(100); if (a_cmd_8 == OP_BUY) price_24 = Bid; if (a_cmd_8 == OP_SELL) price_24 = Ask; OrderClose(OrderTicket(), a_lots_12, NormalizeDouble(price_24, Digits), gi_408 * 2 * Point); } } } } } } } int f0_32() { bool li_ret_0 = FALSE; if (g_datetime_632 != iTime(Symbol(), PERIOD_M5, 0)) { g_datetime_632 = iTime(Symbol(), PERIOD_M5, 0); li_ret_0 = TRUE; } return (li_ret_0); } int f0_25() { bool li_ret_0 = FALSE; if (g_datetime_636 != iTime(Symbol(), PERIOD_M15, 0)) { g_datetime_636 = iTime(Symbol(), PERIOD_M15, 0); li_ret_0 = TRUE; } return (li_ret_0); } int f0_4() { bool li_ret_0 = FALSE; if (g_datetime_640 != iTime(Symbol(), PERIOD_H1, 0)) { g_datetime_640 = iTime(Symbol(), PERIOD_H1, 0); li_ret_0 = TRUE; } return (li_ret_0); }
Комментарии к исходному коду форекс советника ZZ1_3.mq4
В целях безопасности и борьбы со спамом в тексте комментариев запрещено размещать html-теги и ссылки. Благодарим за понимание.