/*
Generated by EX4-TO-MQ4 decompiler V4.0.220.2c []
Website: http://purebeam.biz
E-mail : purebeam@gmail.com
*/
#property copyright “Copyright ?2007-2009, MZenF”
#property link “http://www.metaquotes.net”int gi_76 = 1111111;
int gi_80 = 0;
string gs_zen_84 = “Zen”;
string gs_92 = “Other Broker”;
int gi_100 = 31;
int gi_104 = 12;
int gi_108 = 2009;
int gi_112 = 2010;
string g_str_concat_116 = “TOProfit v.1.4.2”;
extern string TradeCondition = “Depend on Trading Terms of your Account Type and Broker “;
extern int ContractSize = 100000;
extern double MinimalLot = 0.1;
extern double MaxLots = 100.0;
extern double CallMargin_percent = 30.0;
extern string ________ = “MONEY MANAGEMENT”;
extern bool MM = TRUE;
extern bool Agresip_MM = TRUE;
extern double RiskFactor = 0.5;
extern double Lots = 0.1;
extern bool Hedging_Loss = TRUE;
extern string _________ = “ADDITIONAL SETTING”;
extern bool Show_Settings = TRUE;
extern bool JustCloseOrder = FALSE;
bool gi_212 = TRUE;
double gd_216 = 0.0001;
double gd_224 = 0.0;
int g_slippage_232 = 2;
int g_slippage_236 = 10;
int gi_240 = 10;
int gi_244 = 50;
int gi_248 = 5000;
bool gi_unused_252 = FALSE;
int gi_unused_256 = 0;
int gi_unused_260 = 24;
bool gi_264 = TRUE;
bool gi_268 = TRUE;
bool gi_272 = TRUE;
bool gi_276 = TRUE;
bool gi_280 = TRUE;
bool gi_284 = TRUE;
bool gi_288 = TRUE;
bool gi_292 = TRUE;
bool gi_296 = TRUE;
bool gi_300 = TRUE;
int gi_304 = 10;
int gi_308 = 3;
int gi_312 = 3;
int gi_316 = 4;
int gi_320 = 3;
int gi_324 = 3;
int gi_328 = 5;
int gi_332 = 5;
int gi_336 = 3;
int gi_340 = 5;
int gi_344 = 4;
int g_magic_348 = 923451;
int g_magic_352 = 923452;
int g_magic_356 = 923453;
int gi_unused_360 = 923454;
int g_magic_364 = 923455;
int g_magic_368 = 923456;
int g_magic_372 = 923457;
int g_magic_376 = 923458;
int g_magic_380 = 9234581;
int g_magic_384 = 923459;
int gi_unused_388 = 9234510;
int g_magic_392 = 9234511;
int g_magic_396 = 92222201;
int gi_400 = 91111101;
int g_magic_404 = 92222202;
int g_magic_408 = 91111102;
bool gi_412 = TRUE;
double gd_416 = 15.0;
double gd_424 = 20.0;
double gd_432 = 50.0;
bool gi_440 = FALSE;
int gi_444 = 0;
int gi_448 = 0;
int gi_452 = 0;
int g_count_456;
int g_count_460;
int g_bars_464;
int g_bars_468;
int gi_unused_472;
bool gi_476 = FALSE;
bool gi_unused_480 = TRUE;
int g_hist_total_484 = 0;
int gi_488;
int g_count_492;
int g_count_496;
bool gi_500 = FALSE;
bool gi_504 = FALSE;
double g_price_508 = 0.0;
double g_price_516 = 1000.0;
double gd_unused_524;
double gd_unused_532;
bool gi_540 = FALSE;
bool gi_544 = FALSE;
bool gi_548 = FALSE;
bool gi_552 = FALSE;
int g_timeframe_556 = PERIOD_M5;
bool gi_unused_560 = FALSE;
double gd_564;
double gd_572;
double gd_580 = 0.0;
double g_price_588;
double g_price_596;
int gi_604;
int gi_unused_608;
int gi_612;
double g_ima_616;
double g_ima_624;
bool gi_632 = FALSE;
string gs_636;
string gs_644 = “Checking Condition”;
string gs_652 = “Upgrade Your Balance “;
string gs_660 = “Spread more than 4”;
string gs_668 = “We Avoid Bad Influence of Big-News “;
string gs_676 = “Time usage has EXPIRED”;
string gs_684 = “Invalid Account”;
string gs_692 = “Open Order not Allowed by Setting”;int init() {
g_str_concat_116 = StringConcatenate(g_str_concat_116, “-“, Symbol(), “-“, Period());
g_bars_468 = Bars;
if (gi_212) gi_unused_472 = 0;
else gi_unused_472 = 1;
return (0);
}int deinit() {
return (0);
}int start() {
double ld_164;
double ld_172;
double ld_180;
int l_magic_380;
int li_0 = 0;
int li_32 = 21;
int li_unused_220 = 0;
bool li_224 = FALSE;
int li_unused_228 = 0;
bool li_232 = FALSE;
bool li_236 = FALSE;
int li_unused_312 = 0;
bool li_316 = FALSE;
bool li_320 = FALSE;
bool li_340 = FALSE;
bool li_344 = FALSE;
bool li_372 = FALSE;
bool li_376 = FALSE;
bool li_472 = FALSE;
bool li_476 = FALSE;
bool li_544 = FALSE;
bool li_548 = FALSE;
int li_592 = 20;
bool li_596 = FALSE;
bool li_600 = FALSE;
bool li_604 = FALSE;
bool li_608 = FALSE;
bool li_612 = FALSE;
bool li_616 = FALSE;
bool li_620 = FALSE;
bool li_624 = FALSE;
int li_unused_644 = 0;
int li_unused_648 = 0;
int li_unused_652 = 0;
int li_unused_656 = 0;
if (gi_212 && Bars != g_bars_468) gi_476 = FALSE;
int l_ord_total_4 = OrdersTotal();
li_0 = 0;
HideTestIndicators(TRUE);
double l_imacd_36 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_44 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_52 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_76 = iMACD(NULL, 0, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_60 = iMACD(NULL, 0, 100, 200, 100, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_68 = iMACD(NULL, 0, 100, 200, 100, PRICE_CLOSE, MODE_MAIN, 1);
double ld_84 = 20;
double ld_92 = 50;
double ld_148 = 0;
double l_ihigh_100 = iHigh(NULL, PERIOD_D1, 0);
double l_ihigh_108 = iHigh(NULL, PERIOD_D1, 1);
double l_ihigh_116 = iHigh(NULL, PERIOD_D1, 2);
double l_ilow_124 = iLow(NULL, PERIOD_D1, 0);
double l_ilow_132 = iLow(NULL, PERIOD_D1, 1);
double l_ilow_140 = iLow(NULL, PERIOD_D1, 2);
double l_ima_156 = iMA(NULL, PERIOD_D1, 24, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_imacd_240 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_248 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_348 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 2);
double l_imacd_256 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_264 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_660 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 2);
double l_ima_272 = iMA(NULL, PERIOD_H4, 26, 0, MODE_EMA, PRICE_MEDIAN, 0);
double l_ima_280 = iMA(NULL, PERIOD_H4, 26, 0, MODE_EMA, PRICE_MEDIAN, 1);
double l_ima_636 = iMA(NULL, PERIOD_M30, 100, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_ima_288 = iMA(NULL, PERIOD_H4, 100, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_ima_296 = iMA(NULL, PERIOD_H4, 52, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_ima_356 = iMA(NULL, PERIOD_H4, 8, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_ima_364 = iMA(NULL, PERIOD_H4, 30, 0, MODE_EMA, PRICE_CLOSE, 0);
double ld_304 = 1;
double l_ihigh_324 = iHigh(NULL, PERIOD_H4, 1);
double l_ilow_332 = iLow(NULL, PERIOD_H4, 1);
double l_imacd_384 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_392 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_400 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_MAIN, 2);
double l_imacd_408 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_MAIN, 3);
double l_imacd_416 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_MAIN, 4);
double l_imacd_424 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_432 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_440 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 2);
double l_imacd_448 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 3);
double l_imacd_456 = iMACD(NULL, PERIOD_H4, 3, 13, 4, PRICE_CLOSE, MODE_SIGNAL, 4);
double l_ima_464 = iMA(NULL, PERIOD_H4, 26, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_imacd_480 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_488 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_668 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 2);
double l_ima_504 = iMA(NULL, PERIOD_H4, 26, 0, MODE_EMA, PRICE_CLOSE, 1);
double l_ima_512 = iMA(NULL, PERIOD_H4, 26, 0, MODE_LWMA, PRICE_CLOSE, 2);
double l_ima_520 = iMA(NULL, PERIOD_H4, 6, 0, MODE_EMA, PRICE_CLOSE, 0);
double l_ima_528 = iMA(NULL, PERIOD_H4, 6, 1, MODE_EMA, PRICE_CLOSE, 1);
double l_ima_536 = iMA(NULL, PERIOD_H4, 6, 2, MODE_EMA, PRICE_CLOSE, 2);
double l_imacd_552 = iMACD(NULL, PERIOD_H4, 3, 13, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_560 = iMACD(NULL, PERIOD_H4, 3, 13, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_568 = iMACD(NULL, PERIOD_H4, 3, 13, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_576 = iMACD(NULL, PERIOD_H4, 3, 13, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_584 = iMACD(NULL, PERIOD_H4, 3, 13, 9, PRICE_CLOSE, MODE_SIGNAL, 2);
double l_ima_676 = iMA(NULL, 0, 2, 0, MODE_EMA, PRICE_HIGH, 0);
double l_ima_684 = iMA(NULL, 0, 2, 0, MODE_EMA, PRICE_HIGH, 1);
double l_ima_692 = iMA(NULL, 0, 2, 0, MODE_EMA, PRICE_LOW, 0);
double l_ima_700 = iMA(NULL, 0, 2, 0, MODE_EMA, PRICE_LOW, 1);
double l_imacd_708 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 0);
double l_imacd_716 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 1);
double l_imacd_724 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_OPEN, MODE_MAIN, 2);
double l_imacd_732 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 0);
double l_imacd_740 = iMACD(NULL, PERIOD_H4, 12, 26, 9, PRICE_OPEN, MODE_SIGNAL, 1);
double l_imacd_748 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_756 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_764 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 2);
double l_imacd_772 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_780 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_788 = iMACD(NULL, PERIOD_M5, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_796 = iMACD(NULL, PERIOD_M5, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_804 = iMACD(NULL, PERIOD_M5, 12, 26, 9, PRICE_CLOSE, MODE_MAIN, 2);
double l_imacd_812 = iMACD(NULL, PERIOD_M5, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 0);
double l_imacd_820 = iMACD(NULL, PERIOD_M5, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 1);
double l_imacd_828 = iMACD(NULL, PERIOD_M30, 12, 26, 9, PRICE_CLOSE, MODE_SIGNAL, 2);
double l_ima_836 = iMA(NULL, PERIOD_M30, 200, 0, MODE_SMA, PRICE_MEDIAN, 0);
double l_ima_844 = iMA(NULL, PERIOD_M30, 200, 0, MODE_SMA, PRICE_MEDIAN, 1);
double l_ima_852 = iMA(NULL, PERIOD_H4, 14, 0, MODE_SMA, PRICE_MEDIAN, 0);
double l_ima_860 = iMA(NULL, PERIOD_H4, 14, 0, MODE_SMA, PRICE_MEDIAN, 1);
double l_ima_868 = iMA(NULL, PERIOD_H4, 14, 0, MODE_SMA, PRICE_MEDIAN, 2);
double l_ima_876 = iMA(NULL, PERIOD_M5, 14, 0, MODE_SMA, PRICE_MEDIAN, 0);
double l_imacd_884 = iMACD(NULL, PERIOD_M1, 120, 260, 90, PRICE_CLOSE, MODE_MAIN, 0);
double l_imacd_892 = iMACD(NULL, PERIOD_M1, 120, 260, 90, PRICE_CLOSE, MODE_MAIN, 1);
double l_imacd_900 = iMACD(NULL, PERIOD_M1, 120, 260, 90, PRICE_CLOSE, MODE_MAIN, 2);
if (l_imacd_764 < 0.0 && l_imacd_756 > 0.0 && iHigh(NULL, PERIOD_M30, 1) < l_ima_836) {
gi_540 = TRUE;
gd_unused_524 = Low[iLowest(NULL, 0, MODE_HIGH, 2, 1)];
gi_548 = FALSE;
gi_544 = FALSE;
}
if (gi_540)
if (l_imacd_764 < 0.0 && l_imacd_756 > 0.0 && iHigh(NULL, PERIOD_M30, 1) > l_ima_836 && l_imacd_748 > 0.0 && Bid > l_ima_836) gi_548 = TRUE;
if (g_count_456 > 5) {
gi_540 = FALSE;
gi_548 = FALSE;
}
if (l_imacd_764 > 0.0 && l_imacd_756 < 0.0 && iLow(NULL, PERIOD_M30, 1) > l_ima_836) {
gi_544 = TRUE;
gd_unused_532 = High[iHighest(NULL, 0, MODE_HIGH, 2, 1)];
gi_552 = FALSE;
gi_540 = FALSE;
}
if (gi_544)
if (l_imacd_764 > 0.0 && l_imacd_756 < 0.0 && iLow(NULL, PERIOD_M30, 1) < l_ima_836 && l_imacd_748 < 0.0 && Bid < l_ima_836) gi_552 = TRUE;
if (g_count_460 > 5) {
gi_544 = FALSE;
gi_552 = FALSE;
}
HideTestIndicators(FALSE);
g_price_588 = MathRound(Bid / gd_216) * gd_216;
g_price_596 = MathRound(Ask / gd_216) * gd_216;
double l_iclose_628 = iClose(NULL, PERIOD_D1, 1);
gi_612 = (g_price_596 – g_price_588) / gd_216;
if (Show_Settings) subPrintDetails(gi_80);
else Comment(“”);
if (!IsConnected() && !IsTesting()) {
Print(“No connection!”);
return (0);
}
gs_636 = gs_644;
if (OrdersTotal() >= 1) {
gi_412 = TRUE;
gd_416 = 15;
gd_424 = 15;
gd_432 = 50;
gi_440 = TRUE;
gi_444 = 25;
gi_448 = 15;
gi_452 = 5;
gd_580 = 100.0 * (AccountEquity() / AccountMargin());
}
if (OrdersTotal() == 0) {
g_count_460 = 0;
g_count_456 = 0;
g_count_496 = 0;
g_count_492 = 0;
gi_500 = FALSE;
gi_504 = FALSE;
g_price_508 = 0;
g_price_516 = 1000;
gd_564 = AccountBalance();
gi_unused_608 = (g_price_596 – g_price_588) / gd_216;
}
if (OrdersTotal() == g_count_460) {
g_count_456 = 0;
g_count_492 = 0;
}
if (OrdersTotal() == g_count_456) {
g_count_460 = 0;
g_count_496 = 0;
}
if (g_hist_total_484 < OrdersHistoryTotal()) {
g_hist_total_484 = OrdersHistoryTotal();
gi_488 = iBars(NULL, PERIOD_H4);
}
int li_908 = 5;
double ld_912 = iHighest(NULL, PERIOD_D1, MODE_HIGH, 30, 0);
double ld_920 = iLowest(NULL, PERIOD_D1, MODE_LOW, 30, 0);
double ld_928 = (iHigh(NULL, PERIOD_D1, ld_912) – iLow(NULL, PERIOD_D1, ld_920)) / 2.0 + iHigh(NULL, PERIOD_H4, 1);
double ld_936 = AccountLeverage();
double ld_944 = 1 / ld_936;
double ld_952 = MathCeil(ContractSize * ld_944 * ld_928 * li_908 * MinimalLot / RiskFactor);
double ld_960 = ContractSize * ld_944 * ld_928 * li_908 * MinimalLot / 1.0;
double ld_968 = CallMargin_percent / 100.0;
gd_572 = ld_968 * ld_952 + 10000.0 * MinimalLot;
double ld_976 = ld_968 * ld_960 + 1000.0;
if (MM && Agresip_MM && AccountFreeMargin() > gd_572) Lots = subLotSize();
if (MM && !Agresip_MM && gd_564 > gd_572) Lots = subLotSize2();
if (!MM) {
}
for (int l_pos_984 = 0; l_pos_984 < l_ord_total_4; l_pos_984++) {
OrderSelect(l_pos_984, SELECT_BY_POS, MODE_TRADES);
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
li_unused_652 = 1;
if (OrderType() == OP_BUY) {
li_unused_644 = 1;
if ((gi_264 && OrderMagicNumber() == g_magic_348 && l_imacd_36 > 0.0 && l_imacd_36 < l_imacd_52 && l_imacd_44 > l_imacd_76 && l_imacd_36 > ld_148 * gd_216 && Bid – OrderOpenPrice() >= 1.0 * gd_216) ||
(OrderMagicNumber() != g_magic_372 && OrderMagicNumber() != g_magic_376 && OrderMagicNumber() != g_magic_384 && TimeCurrent() – OrderOpenTime() > 1500 && iLow(NULL, PERIOD_M15, 1) > OrderOpenPrice() &&
Low[2] >= Low[1] && Bid < Low[1] – 3.0 * gd_216 && Bid – OrderOpenPrice() <= 2.0 * gd_216 && Bid – OrderOpenPrice() >= 0.0 * gd_216) || (!gi_268 && OrderMagicNumber() == g_magic_352 && l_imacd_240 > 0.0 && l_imacd_240 < l_imacd_256 && l_imacd_248 > l_imacd_264 && l_imacd_240 > ld_304 * gd_216) ||
(gi_284 && OrderMagicNumber() == g_magic_372 && l_imacd_384 <= l_imacd_424 && Bid > OrderOpenPrice() + 1.0 * gd_216) || (gi_284 && OrderMagicNumber() == g_magic_372 &&
Bid > OrderOpenPrice() + 15.0 * gd_216 && l_ord_total_4 > 1) || (gi_288 && OrderMagicNumber() == g_magic_376 && l_ima_536 < l_ima_512 && l_ima_528 > l_ima_504 && l_ima_520 > l_ima_464) ||
(gi_288 && OrderMagicNumber() == g_magic_376 && l_imacd_384 <= l_imacd_424 && Bid > OrderOpenPrice() + 1.0 * gd_216) || (gi_288 && OrderMagicNumber() == g_magic_376 &&
Bid > l_ima_464 && iLow(NULL, PERIOD_H4, 0) < l_ima_464 && l_ima_464 < OrderOpenPrice() – 4.0 * gd_216 && l_imacd_384 < 0.0) || (gi_292 && OrderMagicNumber() == g_magic_384 && l_imacd_384 <= l_imacd_424 && Bid > OrderOpenPrice() + 1.0 * gd_216 && OrderProfit() > 1.0) ||
(OrderMagicNumber() == g_magic_348 && OrdersTotal() > 0 && Bid <= iHigh(NULL, PERIOD_M5, 0) – 3.0 * gd_216 && Bid – OrderOpenPrice() >= 10.0 * gd_216 && Bid – OrderOpenPrice() <= 20.0 * gd_216) ||
(gi_440 == TRUE && Bid <= ld_164 && li_224) || (OrderMagicNumber() == g_magic_364 && Bid <= High[0] – 3.0 * gd_216 && Bid – OrderOpenPrice() >= 7.0 * gd_216 && Bid – OrderOpenPrice() <= 100.0 * gd_216) ||
(OrderMagicNumber() == g_magic_368 && Bid <= iHigh(NULL, PERIOD_M5, 0) – 3.0 * gd_216 && Bid – OrderOpenPrice() >= 10.0 * gd_216 && Bid – OrderOpenPrice() <= 20.0 * gd_216) ||
(OrderMagicNumber() == g_magic_372 && OrdersTotal() >= 1 && Bid <= iHigh(NULL, PERIOD_H4, 0) – 5.0 * gd_216 && Bid – OrderOpenPrice() >= 10.0 * gd_216 && Bid – OrderOpenPrice() <= 80.0 * gd_216) ||
(OrderMagicNumber() == g_magic_376 && Bid <= iHigh(NULL, PERIOD_H4, 0) – 3.0 * gd_216 && Bid – OrderOpenPrice() >= 10.0 * gd_216 && Bid – OrderOpenPrice() <= 20.0 * gd_216 &&
OrderProfit() > 1.0) || (gi_292 && OrderMagicNumber() == g_magic_384 && Bid <= iHigh(NULL, PERIOD_H4, 0) – 4.0 * gd_216 && Bid – OrderOpenPrice() >= 9.0 * gd_216 && Bid – OrderOpenPrice() <= 15.0 * gd_216 && OrderProfit() > 1.0) ||
(OrderMagicNumber() == g_magic_372 && gi_500 && iOpen(NULL, PERIOD_H1, 0) < l_ima_852) || (OrderMagicNumber() == g_magic_392 && iHigh(NULL, 0, 2) < l_ima_852 && l_ima_860 < l_ima_868 &&
Bid > OrderOpenPrice())) li_0 = 1;
if (li_0 == 1 && (gi_212 && !gi_476) || (!gi_212 && Bars != g_bars_468)) {
subCloseBuy();
g_count_456–;
if (gi_500) return (0);
li_unused_644 = 0;
ld_164 = 0;
li_224 = FALSE;
li_236 = FALSE;
li_316 = FALSE;
li_340 = FALSE;
} else {
if ((OrderMagicNumber() != g_magic_404 && Bid < OrderOpenPrice() – 0.05 && OrdersTotal() > g_count_456 – g_count_460) || (OrderMagicNumber() != g_magic_404 && Bid < OrderOpenPrice() – 0.04 &&
OrdersTotal() == g_count_456 – g_count_460)) {
subCloseBuy();
g_count_456–;
gi_632 = TRUE;
} else {
if (OrderMagicNumber() == g_magic_396 && l_imacd_568 < l_imacd_576 && l_imacd_552 < 0.0 && l_imacd_552 < l_imacd_560) {
subCloseBuy();
ld_172 = gd_224;
ld_180 = 50;
l_magic_380 = gi_400;
subOpenSell(ld_172, ld_180, l_magic_380);
} else {
if (Hedging_Loss && OrderMagicNumber() != g_magic_404 && OrderMagicNumber() != g_magic_408 && l_ima_852 < l_ima_860 && Bid < iLow(NULL, PERIOD_H1, 1) && iLow(NULL, PERIOD_H1, 1) > iLow(NULL, PERIOD_H1, 2) &&
iHigh(NULL, PERIOD_H1, 1) > l_ima_860 && Bid == Low[0] && l_ima_852 < g_ima_616 – 0.0045 && Bid < l_ima_852 && g_count_496 < g_count_456 && !gi_500 && g_count_492 == 0 && g_count_496 < 5) {
ld_172 = (High[1] – Bid) / 0.0001 + 20.0;
ld_180 = (OrderOpenPrice() – 0.5 – OrderStopLoss()) / 0.0001;
l_magic_380 = g_magic_408;
subOpenSell2(ld_172, ld_180, l_magic_380);
} else {
if (OrderMagicNumber() == g_magic_404 && gi_632) {
gi_632 = FALSE;
subCloseBuy2();
return (0);
}
if (OrderMagicNumber() != g_magic_404 && gi_412 && gd_416 > 0.0 && Bid – OrderOpenPrice() < gd_216 * gd_432) {
if (Bid – OrderOpenPrice() <= gd_216 * gd_424) continue;
if (!(OrderStopLoss() < Bid – gd_216 * gd_416 || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Bid – gd_216 * gd_416, OrderTakeProfit(), 0, Green);
return (0);
}
if (OrderMagicNumber() == g_magic_404 && Bid > OrderOpenPrice() + 80.0 * gd_216) {
if (!(OrderStopLoss() < OrderOpenPrice() || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Bid – 80.0 * gd_216, OrderTakeProfit(), 0, Green);
return (0);
}
if (OrderMagicNumber() == g_magic_404 && OrderStopLoss() < OrderOpenPrice() + 100.0 * gd_216) {
if (!(l_ima_852 > OrderOpenPrice() && Bid > OrderOpenPrice() + 45.0 * gd_216)) continue;
if (!(OrderStopLoss() < Bid – 45.0 * gd_216 || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Bid – 45.0 * gd_216, OrderTakeProfit(), 0, Green);
return (0);
}
if (gi_440 && !li_224 && gi_448 + gi_452 > 0 && Bid – OrderOpenPrice() < gd_216 * gi_444) {
if (Bid – OrderOpenPrice() >= gd_216 * (gi_448 + gi_452)) {
ld_164 = Bid – gi_452 * gd_216;
li_224 = TRUE;
}
} else
if (gi_440 && li_224 && Bid – gi_452 * gd_216 > ld_164 && Bid – OrderOpenPrice() < gd_216 * gi_444) ld_164 = Bid – gi_452 * gd_216;
}
}
}
}
} else {
if (OrderType() == OP_SELL) {
li_unused_648 = 1;
if ((gi_264 && OrderMagicNumber() == g_magic_348 && l_imacd_36 < 0.0 && l_imacd_36 > l_imacd_52 && l_imacd_44 < l_imacd_76 && MathAbs(l_imacd_36) > ld_148 * gd_216 &&
OrderOpenPrice() – Ask >= 1.0 * gd_216) || (OrderMagicNumber() != g_magic_408 && OrderMagicNumber() != g_magic_372 && OrderMagicNumber() != g_magic_376 && OrderMagicNumber() != g_magic_384 && TimeCurrent() – OrderOpenTime() > 1500 && High[2] <= High[1] && High[1] < OrderOpenPrice() && Bid > High[1] + 3.0 * gd_216 && OrderOpenPrice() – Ask <= 2.0 * gd_216 && OrderOpenPrice() – Ask >= 0.0 * gd_216) ||
(!gi_268 && OrderMagicNumber() == g_magic_352 && l_imacd_240 < 0.0 && l_imacd_240 > l_imacd_256 && l_imacd_248 < l_imacd_264 && MathAbs(l_imacd_240) > ld_304 * gd_216) ||
(gi_284 && OrderMagicNumber() == g_magic_372 && l_imacd_384 >= l_imacd_424 && Ask < OrderOpenPrice() – 1.0 * gd_216) || (gi_284 && OrderMagicNumber() == g_magic_372 &&
Ask < OrderOpenPrice() – 15.0 * gd_216 && l_ord_total_4 > 3) || (gi_288 && OrderMagicNumber() == g_magic_380 && l_ima_536 > l_ima_512 && l_ima_528 < l_ima_504 && l_ima_520 < l_ima_464) ||
(gi_288 && OrderMagicNumber() == g_magic_380 && l_imacd_384 >= l_imacd_424 && Ask < OrderOpenPrice() – 1.0 * gd_216) || (gi_288 && OrderMagicNumber() == g_magic_380 &&
Bid < l_ima_464 && iHigh(NULL, PERIOD_H4, 0) > l_ima_464 && l_ima_464 > OrderOpenPrice() + 4.0 * gd_216 && l_imacd_384 > 0.0) || (gi_292 && OrderMagicNumber() == g_magic_384 && l_imacd_384 >= l_imacd_424 && Ask < OrderOpenPrice() – 1.0 * gd_216 && OrderProfit() > 1.0) ||
(OrderMagicNumber() == g_magic_348 && Bid > iLow(NULL, PERIOD_M5, 0) + 3.0 * gd_216 && OrderOpenPrice() – Ask >= 10.0 * gd_216 && OrderOpenPrice() – Ask <= 20.0 * gd_216) ||
(OrderMagicNumber() == g_magic_368 && Bid > iLow(NULL, PERIOD_M5, 0) + 3.0 * gd_216 && OrderOpenPrice() – Ask >= 10.0 * gd_216 && OrderOpenPrice() – Ask <= 20.0 * gd_216) ||
(gi_440 == TRUE && Ask >= ld_164 && li_224) || (OrderMagicNumber() == g_magic_364 && Ask > Low[0] + 3.0 * gd_216 && OrderOpenPrice() – Ask >= 7.0 * gd_216 && OrderOpenPrice() – Ask <= 100.0 * gd_216) ||
(OrderMagicNumber() == g_magic_372 && OrdersTotal() >= 1 && Ask > iLow(NULL, PERIOD_H4, 0) + 5.0 * gd_216 && OrderOpenPrice() – Ask >= 10.0 * gd_216 && OrderOpenPrice() – Ask <= 80.0 * gd_216) ||
(OrderMagicNumber() == g_magic_380 && Bid > iLow(NULL, PERIOD_H4, 0) + 3.0 * gd_216 && OrderOpenPrice() – Ask >= 10.0 * gd_216 && OrderOpenPrice() – Ask <= 20.0 * gd_216 &&
OrderProfit() > 1.0) || (OrderMagicNumber() == g_magic_384 && Bid > iLow(NULL, PERIOD_H4, 0) + 4.0 * gd_216 && OrderOpenPrice() – Ask >= 9.0 * gd_216 && OrderOpenPrice() – Ask <= 15.0 * gd_216) ||
(OrderMagicNumber() == g_magic_372 && gi_504 && iOpen(NULL, PERIOD_H1, 0) > l_ima_852) || (OrderMagicNumber() == g_magic_392 && iLow(NULL, 0, 2) > l_ima_852 && l_ima_860 > l_ima_868 &&
Ask < OrderOpenPrice())) li_0 = 2;
if (li_0 == 2 && (gi_212 && !gi_476) || (!gi_212 && Bars != g_bars_468)) {
subCloseSell();
g_count_460–;
if (gi_504) return (0);
li_unused_648 = 0;
ld_164 = 0;
li_224 = FALSE;
li_232 = FALSE;
li_320 = FALSE;
li_344 = FALSE;
li_376 = FALSE;
} else {
if ((OrderMagicNumber() != g_magic_408 && Bid > OrderOpenPrice() + 0.05 && OrdersTotal() > g_count_460 – g_count_456) || (OrderMagicNumber() != g_magic_408 && Bid > OrderOpenPrice() +
0.04 && OrdersTotal() == g_count_460 – g_count_456)) {
subCloseSell();
g_count_460–;
gi_632 = TRUE;
} else {
if (OrderMagicNumber() == g_magic_356 && l_imacd_568 > l_imacd_576 && l_imacd_552 > l_imacd_568 && l_imacd_552 > l_imacd_560 && Bid > High[1]) {
subCloseSell();
ld_172 = gd_224;
ld_180 = 50;
l_magic_380 = g_magic_396;
subOpenBuy(ld_172, ld_180, l_magic_380);
} else {
if (Hedging_Loss && OrderMagicNumber() != g_magic_404 && OrderMagicNumber() != g_magic_408 && l_ima_852 > l_ima_860 && Bid > iHigh(NULL, PERIOD_H1, 1) && iHigh(NULL, PERIOD_H1, 1) < iHigh(NULL, PERIOD_H1, 2) &&
iLow(NULL, PERIOD_H1, 1) < l_ima_860 && Bid == High[0] && l_ima_852 > g_ima_624 + 0.0045 && Bid > l_ima_852 && g_count_492 < g_count_460 && !gi_504 && g_count_496 == 0 && g_count_492 < 5) {
ld_172 = (Bid – Low[1]) / 0.0001 + 20.0;
ld_180 = (OrderOpenPrice() + 0.5 – Ask) / 0.0001 – 3.0;
l_magic_380 = g_magic_404;
subOpenBuy2(ld_172, ld_180, l_magic_380);
} else {
if (OrderMagicNumber() == g_magic_408 && gi_632) {
gi_632 = FALSE;
subCloseSell2();
return (0);
}
}
}
}
}
if (OrderMagicNumber() != g_magic_408 && gi_412 && gd_416 > 0.0 && OrderOpenPrice() – Ask < gd_216 * gd_432) {
if (OrderOpenPrice() – Ask <= gd_216 * gd_424) continue;
if (!(OrderStopLoss() > Ask + gd_216 * gd_416 || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + gd_216 * gd_416, OrderTakeProfit(), 0, Red);
return (0);
}
if (OrderMagicNumber() == g_magic_408 && Ask < OrderOpenPrice() – 80.0 * gd_216) {
if (!(OrderStopLoss() > OrderOpenPrice() || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Ask – 80.0 * gd_216, OrderTakeProfit(), 0, Red);
return (0);
}
if (OrderMagicNumber() == g_magic_408 && OrderStopLoss() > OrderOpenPrice() – 100.0 * gd_216) {
if (!(l_ima_852 < OrderOpenPrice() && Ask < OrderOpenPrice() – 45.0 * gd_216)) continue;
if (!(OrderStopLoss() > Ask + 45.0 * gd_216 || OrderStopLoss() == 0.0)) continue;
OrderModify(OrderTicket(), OrderOpenPrice(), Ask + 45.0 * gd_216, OrderTakeProfit(), 0, Red);
return (0);
}
if (gi_440 && !li_224 && gi_448 + gi_452 > 0 && OrderOpenPrice() – Ask < gd_216 * gi_444) {
if (OrderOpenPrice() – Ask >= gd_216 * (gi_448 + gi_452)) {
ld_164 = Ask + gi_452 * gd_216;
li_224 = TRUE;
}
} else
if (gi_440 && li_224 && Ask + gi_452 * gd_216 < ld_164 && OrderOpenPrice() – Ask < gd_216 * gi_444) ld_164 = Ask + gi_452 * gd_216;
}
}
}
}
l_ord_total_4 = OrdersTotal();
if (l_ord_total_4 < gi_304) {
if (JustCloseOrder) {
gs_636 = gs_692;
return (0);
}
if (AccountBalance() < gd_572) {
gs_636 = gs_652;
return (0);
}
if (gi_612 > 4) {
gs_636 = gs_660;
gi_604 = iBars(NULL, PERIOD_M5);
if (gi_604 == iBars(NULL, PERIOD_M5)) Print(gs_660);
return (0);
}
/*if (!IsTesting()) {
if (!IsDemo() && AccountNumber() != gi_76) {
gs_636 = gs_684;
return (0);
}*/
/*if (IsDemo() && li_32 != 21) {
Comment(“Non-User!”);
return (0);
} */
else {
if (TimeDayOfWeek(TimeCurrent()) == 5 && TimeDay(TimeCurrent()) < 9 && TimeDay(TimeCurrent()) >= 1 && Hour() >= 14) {
gs_636 = gs_668;
return (0);
}
if (TimeDayOfWeek(TimeCurrent()) == 1 && Hour() < 4) return (0);
/* if ((gi_80 > 1 && !IsTesting() && !IsDemo() && TimeMonth(TimeCurrent()) >= gi_104 && TimeYear(TimeCurrent()) >= gi_108 && TimeDay(TimeCurrent()) >= gi_100) || (gi_80 > 1 &&
!IsTesting() && !IsDemo() && TimeYear(TimeCurrent()) >= gi_112)) {
gs_636 = gs_676;
return (0);
}*/
if (iBars(NULL, PERIOD_M5) < 100) {
Print(“bars of M5 less than 100”);
return (0);
}
if ((gi_264 && l_ihigh_108 > l_ima_156 && l_ihigh_108 < l_ihigh_116 – ld_84 * gd_216 && l_ilow_132 < l_ilow_140 && Bid > l_ihigh_108 + 2.0 * gd_216 && l_ihigh_100 – l_ihigh_108 < ld_92 * gd_216 &&
TimeDayOfYear(OrderCloseTime()) != TimeDayOfYear(TimeCurrent()) && g_count_456 < 1 && l_imacd_36 > l_imacd_52 && l_imacd_44 < l_imacd_76 && l_imacd_36 < 0.0 && l_imacd_60 > l_imacd_68) ||
(gi_264 && l_ihigh_108 > l_ima_156 && l_ilow_132 < l_ima_156 && Bid > l_ihigh_108 && l_ihigh_108 > l_ihigh_116 && g_count_456 < gi_308 && l_imacd_36 > l_imacd_52 &&
l_imacd_44 < l_imacd_76 && l_imacd_36 < 0.0 && l_imacd_60 > l_imacd_68)) li_236 = TRUE;
else {
if ((gi_268 && Bid > High[1] && l_imacd_240 < 0.0 && l_imacd_240 > l_imacd_256 && l_imacd_248 < l_imacd_264 && l_imacd_576 > l_imacd_584 && MathAbs(l_imacd_240) > 20.0 * gd_216 &&
l_ima_272 > l_ima_280 && g_count_456 < 2) || (gi_268 && Bid > High[1] && !li_236 && !li_340 && l_imacd_240 < 0.0 && l_imacd_240 > l_imacd_256 && l_imacd_248 < l_imacd_264 && l_imacd_576 > l_imacd_584 && MathAbs(l_imacd_240) > 20.0 * gd_216 && l_ima_272 > l_ima_280 && Ask <= OrderOpenPrice() – 5.0 * gd_216 && g_count_456 < gi_312 && iBars(NULL, PERIOD_H4) != gi_488)) li_316 = TRUE;
else {
if (gi_272 && g_count_460 > 1 && l_imacd_248 > l_imacd_264 && l_imacd_240 > l_imacd_256 && l_imacd_552 > l_imacd_568 && l_imacd_560 < l_imacd_576 && l_imacd_560 > 0.0 &&
g_count_456 < gi_316 && iBars(NULL, PERIOD_H4) != gi_488) li_340 = TRUE;
}
}
}
if ((gi_276 && Bid == High[0] && l_imacd_240 < 0.0 && l_imacd_240 > l_imacd_256 && l_imacd_248 < l_imacd_264 – 0.0001 && l_imacd_348 < l_imacd_248 && Bid < l_ima_272 +
5.0 * gd_216 && MathAbs(l_imacd_240) > 3.0 * gd_216 && l_ima_272 > l_ima_280 && g_count_456 < 1) || (gi_276 && l_imacd_240 > 0.0 && l_imacd_240 > l_imacd_256 && l_imacd_248 < l_imacd_264 – 0.0001 && l_imacd_348 < l_imacd_248 && Bid < l_ima_356 + 5.0 * gd_216 && l_imacd_240 > 1.0 * gd_216 && l_ima_272 > l_ima_280 && l_ima_272 > l_ima_364 && g_count_456 < gi_320)) li_372 = TRUE;
if (gi_280 && OrderMagicNumber() != g_magic_372 && OrderMagicNumber() != g_magic_376 && OrderMagicNumber() != g_magic_384 && TimeCurrent() – OrderOpenTime() > 1500 &&
Bars > g_bars_464 && High[2] <= High[1] && High[1] < OrderOpenPrice() && Bid > High[1] + 3.0 * gd_216 && OrderOpenPrice() – Ask <= 1.0 * gd_216 && OrderOpenPrice() – Ask >= 0.0 * gd_216 && OrderProfit() < 5.0 && g_count_456 < gi_324) li_620 = TRUE;
else {
if ((gi_284 && l_imacd_668 < l_imacd_488 && l_imacd_416 > l_imacd_456 && l_imacd_408 < l_imacd_448 && l_imacd_400 < l_imacd_440 && l_imacd_392 > l_imacd_432 && iHigh(NULL, PERIOD_H4, 1) > iHigh(NULL, PERIOD_H4, 2) &&
Bid > iHigh(NULL, PERIOD_H4, 2) && Bid < iHigh(NULL, PERIOD_H4, 1) + 0.0 * gd_216 && Bid == iHigh(NULL, PERIOD_H4, 0) && l_imacd_384 > 0.0 && l_imacd_392 > 0.0 && l_imacd_400 > 0.0 && l_imacd_408 > 0.0 && iLow(NULL, PERIOD_H4, 1) > l_ima_464 && iLow(NULL, PERIOD_H4, 2) > l_ima_464 && l_imacd_408 < 0.01 && Bid < iOpen(NULL, PERIOD_H4, 0) + 15.0 * gd_216 && iLow(NULL, PERIOD_H1, 2) > l_ima_852 && g_count_456 < gi_328) ||
(gi_284 && l_imacd_668 < l_imacd_488 && l_imacd_408 > l_imacd_448 && l_imacd_400 < l_imacd_440 && l_imacd_392 > l_imacd_432 && iHigh(NULL, PERIOD_H4, 1) > iHigh(NULL, PERIOD_H4, 2) &&
Bid > iHigh(NULL, PERIOD_H4, 2) && Bid < iHigh(NULL, PERIOD_H4, 1) + 0.0 * gd_216 && Bid == iHigh(NULL, PERIOD_H4, 0) && l_imacd_384 > 0.0 && l_imacd_392 > 0.0 && l_imacd_400 > 0.0 && l_imacd_408 > 0.0 && iLow(NULL, PERIOD_H4, 1) > l_ima_464 && iLow(NULL, PERIOD_H4, 2) > l_ima_464 && l_imacd_408 < 0.01 && Bid < iOpen(NULL, PERIOD_H4, 0) + 15.0 * gd_216 && iLow(NULL, PERIOD_H1, 2) > l_ima_852 && g_count_456 < gi_328)) li_472 = TRUE;
}
if ((gi_288 && iLow(NULL, PERIOD_H1, 2) > l_ima_852 && l_imacd_392 < 0.0 && l_imacd_384 > 0.0 && g_count_456 == 0 && Bid == iHigh(NULL, PERIOD_M15, 0) && Bid > l_ima_464 &&
Bid < l_ima_464 + 3.0 * gd_216 && l_imacd_384 > l_imacd_392 && l_imacd_392 > l_imacd_400 && l_imacd_400 > l_imacd_408 && l_imacd_480 > l_imacd_488 && g_count_456 < gi_332) ||
(gi_288 && iLow(NULL, PERIOD_H1, 2) > l_ima_852 && l_imacd_392 < 0.0 && l_imacd_384 > 0.0 && g_count_456 >= 1 && Bid == iHigh(NULL, PERIOD_H4, 0) && Bid > l_ima_464 &&
Bid < l_ima_464 + 3.0 * gd_216 && l_imacd_384 > l_imacd_392 && l_imacd_392 > l_imacd_400 && l_imacd_400 > l_imacd_408 && l_imacd_480 > l_imacd_488 && g_count_456 < gi_332) ||
(gi_288 && l_imacd_392 < 0.0 && l_imacd_384 > 0.0 && g_count_456 == 0 && Bid == iHigh(NULL, PERIOD_M15, 0) && Bid > l_ima_464 && Bid < l_ima_464 + 3.0 * gd_216 && l_imacd_384 > l_imacd_392 &&
l_imacd_392 > l_imacd_400 && l_imacd_400 > l_imacd_408 && l_imacd_480 > l_imacd_488 && g_count_456 < 3) || (gi_288 && l_imacd_392 < 0.0 && l_imacd_384 > 0.0 && g_count_456 >= 1 && Bid == iHigh(NULL, PERIOD_H4, 0) && Bid > l_ima_464 && Bid < l_ima_464 + 3.0 * gd_216 && l_imacd_384 > l_imacd_392 && l_imacd_392 > l_imacd_400 && l_imacd_400 > l_imacd_408 && l_imacd_480 > l_imacd_488 && g_count_456 < 3)) li_544 = TRUE;
if ((gi_292 && l_imacd_552 > l_imacd_568 && l_imacd_552 > 0.0 && l_imacd_560 < 0.0001 && l_imacd_568 > 0.0 && l_imacd_576 > 0.0 && l_imacd_584 > l_imacd_576 && Bid < l_ima_520 +
li_592 * gd_216 && Bid == iHigh(NULL, PERIOD_H4, 0) && Bid > iHigh(NULL, PERIOD_H4, 1) && Bid > iHigh(NULL, PERIOD_H4, 2) && g_count_456 < gi_336) || (gi_292 && l_imacd_552 > l_imacd_568 && l_imacd_552 > 0.0 && l_imacd_560 < 0.0001 && l_imacd_568 > 0.0 && l_imacd_576 > 0.0 && l_imacd_584 > l_imacd_576 && Ask <= iHigh(NULL, PERIOD_H4, 1) && Bid == iHigh(NULL, PERIOD_H4, 0) && g_count_456 < gi_336) ||
(gi_292 && l_imacd_552 > l_imacd_568 && l_imacd_552 > 0.0 && l_imacd_560 < 0.0001 && l_imacd_568 > 0.0 && l_imacd_576 > 0.0 && l_imacd_584 > l_imacd_576 && Ask <= iHigh(NULL, PERIOD_H4, 2) &&
Bid == iHigh(NULL, PERIOD_H4, 0) && g_count_456 < gi_336) || (gi_292 && l_imacd_240 > l_imacd_248 && l_imacd_256 > l_imacd_264 && l_imacd_384 > l_imacd_432 && l_imacd_384 > 0.0 && l_imacd_392 < 0.0001 && l_imacd_424 > 0.0 && l_imacd_432 > 0.0 && l_imacd_440 > l_imacd_432 && Ask <= iHigh(NULL, PERIOD_H4, 2) && Bid == iHigh(NULL, PERIOD_H4, 0) && g_count_456 < gi_336)) li_596 = TRUE;
if (gi_296 && gi_552 && l_imacd_756 < 0.0 && l_imacd_748 > 0.0 && iLow(NULL, PERIOD_M30, 1) > l_ima_836 && l_ima_836 > l_ima_844 && Bid < Open[0] + 0.008 && g_count_456 < gi_340) li_604 = TRUE;
if (gi_300 && iLow(NULL, 0, 0) < l_ima_852 && l_ima_876 > l_ima_852 && iLow(NULL, g_timeframe_556, 3) < l_ima_876 && iLow(NULL, g_timeframe_556, 2) > l_ima_876 && iLow(NULL, g_timeframe_556, 1) > l_ima_876 &&
l_imacd_708 > l_imacd_716 && l_ima_860 > l_ima_868 && iLow(NULL, 0, 2) > l_ima_852 && g_count_456 < gi_344) li_612 = TRUE;
if (li_236 || li_316 || li_340 || li_372 || li_620 || li_472 || li_544 || li_596 || li_604 || li_612) {
if (li_236) {
ld_172 = gd_224;
ld_180 = 51;
l_magic_380 = g_magic_348;
} else {
if (li_316) {
ld_172 = gd_224;
ld_180 = 40;
l_magic_380 = g_magic_352;
} else {
if (li_340) {
ld_172 = gd_224;
ld_180 = 15;
l_magic_380 = g_magic_356;
} else {
if (li_372 && TimeCurrent() – OrderCloseTime() > 1500) {
ld_172 = gd_224;
ld_180 = 64;
l_magic_380 = g_magic_364;
} else {
if (li_620) {
ld_172 = gd_224;
ld_180 = 28;
l_magic_380 = g_magic_368;
} else {
if (li_472 && g_count_456 < gi_328) {
ld_172 = gd_224;
ld_180 = 28;
l_magic_380 = g_magic_372;
} else {
if (li_544) {
ld_172 = gd_224;
ld_180 = 120;
l_magic_380 = g_magic_376;
} else {
if (li_596) {
ld_172 = gd_224;
ld_180 = 35;
l_magic_380 = g_magic_384;
} else {
if (li_604) {
gi_548 = FALSE;
ld_172 = gd_224;
l_magic_380 = g_magic_384;
if (g_count_456 == 0) ld_180 = 100;
if (g_count_456 == 1) ld_180 = 50;
if (g_count_456 == 2) ld_180 = 25;
if (g_count_456 == 3) ld_180 = 20;
if (g_count_456 == 4) ld_180 = 20;
} else {
if (li_612) {
ld_172 = gd_224;
l_magic_380 = g_magic_392;
if (g_count_456 == 0) ld_180 = 50;
if (g_count_456 == 1) ld_180 = 20;
if (g_count_456 == 2) ld_180 = 15;
if (g_count_456 == 3) ld_180 = 10;
if (g_count_456 == 4) ld_180 = 10;
}
}
}
}
}
}
}
}
}
}
g_hist_total_484 = OrdersHistoryTotal();
g_bars_464 = Bars;
g_ima_616 = l_ima_852;
if (g_count_496 == 0 && g_count_492 == 0 && Hedging_Loss) subOpenBuy(ld_172, ld_180, l_magic_380);
if (!Hedging_Loss) subOpenBuy(ld_172, ld_180, l_magic_380);
}
if ((gi_264 && l_ilow_132 < l_ima_156 && l_ilow_132 > l_ilow_140 + ld_84 * gd_216 && l_ihigh_108 > l_ihigh_116 && Bid < l_ilow_132 – 2.0 * gd_216 && l_ilow_132 – l_ilow_124 < ld_92 * gd_216 &&
TimeDayOfYear(OrderCloseTime()) != TimeDayOfYear(TimeCurrent()) && g_count_460 < 1 && l_imacd_36 < l_imacd_52 && l_imacd_44 > l_imacd_76 && l_imacd_36 > 0.0 && l_imacd_60 < l_imacd_68) ||
(gi_264 && l_ilow_132 < l_ima_156 && l_ihigh_108 > l_ima_156 && Bid < l_ilow_132 && g_count_460 < gi_308 && l_ilow_132 < l_ilow_140 && l_imacd_36 < l_imacd_52 && l_imacd_44 > l_imacd_76 &&
l_imacd_36 > 0.0 && l_imacd_60 < l_imacd_68)) li_232 = TRUE;
else {
if ((gi_268 && Bid < Low[1] && l_imacd_240 > 0.0 && l_imacd_240 < l_imacd_256 && l_imacd_248 > l_imacd_264 && l_imacd_576 < l_imacd_584 && l_imacd_240 > 20.0 * gd_216 &&
l_ima_272 < l_ima_280 && g_count_460 < 2) || (gi_268 && Bid < Low[1] && !li_232 && !li_344 && l_imacd_240 > 0.0 && l_imacd_240 < l_imacd_256 && l_imacd_248 > l_imacd_264 && l_imacd_576 < l_imacd_584 && l_imacd_240 > 20.0 * gd_216 && l_ima_272 < l_ima_280 && Bid >= OrderOpenPrice() + 5.0 * gd_216 && g_count_460 < gi_312 && l_ord_total_4 >= 1 && iBars(NULL, PERIOD_H4) != gi_488)) li_320 = TRUE;
else {
if (gi_272 && g_count_456 > 1 && l_imacd_248 < l_imacd_264 && l_imacd_240 < l_imacd_256 && l_imacd_552 < l_imacd_568 && l_imacd_560 > l_imacd_576 && l_imacd_560 < 0.0 &&
g_count_460 < gi_316 && iBars(NULL, PERIOD_H4) != gi_488) li_344 = TRUE;
}
}
if ((gi_276 && Bid == Low[0] && l_imacd_240 > 0.0 && l_imacd_240 < l_imacd_256 && l_imacd_248 > l_imacd_264 + 0.0001 && l_imacd_348 > l_imacd_248 && Bid > l_ima_272 – 5.0 * gd_216 &&
l_imacd_240 > 3.0 * gd_216 && l_ima_272 < l_ima_280 && g_count_460 < 1) || (gi_276 && l_imacd_240 < 0.0 && l_imacd_240 < l_imacd_256 && l_imacd_248 > l_imacd_264 + 0.0001 && l_imacd_348 > l_imacd_248 && Bid > l_ima_356 – 5.0 * gd_216 && MathAbs(l_imacd_240) > 1.0 * gd_216 && l_ima_272 < l_ima_280 && l_ima_272 < l_ima_364 && g_count_460 < gi_320)) li_376 = TRUE;
if (gi_280 && OrderMagicNumber() != g_magic_372 && OrderMagicNumber() != g_magic_376 && OrderMagicNumber() != g_magic_384 && TimeCurrent() – OrderOpenTime() > 1500 &&
Bars > g_bars_464 && Low[1] > OrderOpenPrice() && Low[2] >= Low[1] && Bid < Low[1] – 3.0 * gd_216 && Bid – OrderOpenPrice() <= 2.0 * gd_216 && Bid – OrderOpenPrice() >= 0.0 * gd_216 && OrderProfit() < 5.0 && g_count_460 < gi_324) li_624 = TRUE;
if ((gi_284 && l_imacd_668 > l_imacd_488 && l_imacd_416 < l_imacd_456 && l_imacd_408 > l_imacd_448 && l_imacd_400 > l_imacd_440 && l_imacd_392 < l_imacd_432 && iLow(NULL, PERIOD_H4, 1) < iLow(NULL, PERIOD_H4, 2) &&
Bid < iLow(NULL, PERIOD_H4, 2) && Bid > iLow(NULL, PERIOD_H4, 1) – 0.0 * gd_216 && Bid == iLow(NULL, PERIOD_H4, 0) && l_imacd_384 < 0.0 && l_imacd_392 < 0.0 && l_imacd_400 < 0.0 && l_imacd_408 < 0.0 && l_imacd_408 > -0.01 && Bid > iOpen(NULL, PERIOD_H4, 0) – 15.0 * gd_216 && iHigh(NULL, PERIOD_H1, 2) < l_ima_852 && g_count_460 < gi_328) ||
(gi_284 && l_imacd_668 > l_imacd_488 && l_imacd_408 < l_imacd_448 && l_imacd_400 > l_imacd_440 && l_imacd_392 < l_imacd_432 && iLow(NULL, PERIOD_H4, 1) < iLow(NULL, PERIOD_H4, 2) &&
Bid < iLow(NULL, PERIOD_H4, 2) && Bid > iLow(NULL, PERIOD_H4, 1) – 0.0 * gd_216 && Bid == iLow(NULL, PERIOD_H4, 0) && l_imacd_384 < 0.0 && l_imacd_392 < 0.0 && l_imacd_400 < 0.0 && l_imacd_408 < 0.0 && l_imacd_408 > -0.01 && Bid > iOpen(NULL, PERIOD_H4, 0) – 15.0 * gd_216 && iHigh(NULL, PERIOD_H1, 2) < l_ima_852 && g_count_460 < gi_328)) li_476 = TRUE;
if ((!gi_288 && iHigh(NULL, PERIOD_H1, 2) < l_ima_852 && l_imacd_392 > 0.0 && l_imacd_384 < 0.0 && g_count_460 == 0 && Bid == iLow(NULL, PERIOD_M15, 0) && Bid < l_ima_464 &&
Bid > l_ima_464 – 3.0 * gd_216 && l_imacd_384 < l_imacd_392 && l_imacd_392 < l_imacd_400 && l_imacd_400 < l_imacd_408 && l_imacd_480 < l_imacd_488 && g_count_460 < gi_332) ||
(!gi_288 && iHigh(NULL, PERIOD_H1, 2) < l_ima_852 && l_imacd_392 > 0.0 && l_imacd_384 < 0.0 && g_count_460 >= 1 && Bid == iLow(NULL, PERIOD_H4, 0) && Bid < l_ima_464 &&
Bid > l_ima_464 – 3.0 * gd_216 && l_imacd_384 < l_imacd_392 && l_imacd_392 < l_imacd_400 && l_imacd_400 < l_imacd_408 && l_imacd_480 < l_imacd_488 && g_count_460 < gi_332) ||
(gi_288 && l_imacd_392 > 0.0 && l_imacd_384 < 0.0 && g_count_460 == 0 && Bid == iLow(NULL, PERIOD_M15, 0) && Bid < l_ima_464 && Bid > l_ima_464 – 3.0 * gd_216 && l_imacd_384 < l_imacd_392 &&
l_imacd_392 < l_imacd_400 && l_imacd_400 < l_imacd_408 && l_imacd_480 < l_imacd_488 && g_count_460 < 3) || (gi_288 && l_imacd_392 > 0.0 && l_imacd_384 < 0.0 && g_count_460 >= 1 && Bid == iLow(NULL, PERIOD_H4, 0) && Bid < l_ima_464 && Bid > l_ima_464 – 3.0 * gd_216 && l_imacd_384 < l_imacd_392 && l_imacd_392 < l_imacd_400 && l_imacd_400 < l_imacd_408 && l_imacd_480 < l_imacd_488 && g_count_460 < 3)) li_548 = TRUE;
if ((gi_292 && l_imacd_552 < l_imacd_568 && l_imacd_552 < 0.0 && l_imacd_560 > -0.0001 && l_imacd_568 < 0.0 && l_imacd_576 < 0.0 && l_imacd_584 < l_imacd_576 && Bid > l_ima_520 – li_592 * gd_216 &&
Bid == iLow(NULL, PERIOD_H4, 0) && Bid < iLow(NULL, PERIOD_H4, 1) && Bid < iLow(NULL, PERIOD_H4, 2) && g_count_460 < gi_336) || (gi_292 && l_imacd_552 < l_imacd_568 && l_imacd_552 < 0.0 && l_imacd_560 > -0.0001 && l_imacd_568 < 0.0 && l_imacd_576 < 0.0 && l_imacd_584 < l_imacd_576 && Bid + 3.0 * gd_216 >= iLow(NULL, PERIOD_H4, 1) && Bid == iLow(NULL, PERIOD_H4, 0) && g_count_460 < gi_336) ||
(gi_292 && l_imacd_552 < l_imacd_568 && l_imacd_552 < 0.0 && l_imacd_560 > -0.0001 && l_imacd_568 < 0.0 && l_imacd_576 < 0.0 && l_imacd_584 < l_imacd_576 && Bid +
3.0 * gd_216 >= iLow(NULL, PERIOD_H4, 2) && Bid == iLow(NULL, PERIOD_H4, 0) && g_count_460 < gi_336) || (gi_292 && l_imacd_240 < l_imacd_248 && l_imacd_256 < l_imacd_264 && l_imacd_384 < l_imacd_432 && l_imacd_384 < 0.0 && l_imacd_392 > -0.0001 && l_imacd_424 < 0.0 && l_imacd_432 < 0.0 && l_imacd_440 < l_imacd_432 && Bid + 3.0 * gd_216 >= iLow(NULL, PERIOD_H4, 2) && Bid == iLow(NULL, PERIOD_H4, 0) && g_count_460 < gi_336)) li_600 = TRUE;
if (gi_296 && gi_548 && l_imacd_756 > 0.0 && l_imacd_748 < 0.0 && iHigh(NULL, PERIOD_M30, 1) < l_ima_836 && l_ima_836 < l_ima_844 && Bid > Open[0] – 0.008 && g_count_460 < gi_340) li_608 = TRUE;
if (gi_300 && iHigh(NULL, 0, 0) > l_ima_852 && l_ima_876 < l_ima_852 && iHigh(NULL, g_timeframe_556, 3) > l_ima_876 && iHigh(NULL, g_timeframe_556, 2) < l_ima_876 &&
iHigh(NULL, g_timeframe_556, 1) < l_ima_876 && l_imacd_708 < l_imacd_716 && l_ima_860 < l_ima_868 && iHigh(NULL, 0, 2) < l_ima_852 && g_count_460 < gi_344) li_616 = TRUE;
if (li_232 || li_320 || li_344 || li_376 || li_624 || li_476 || li_548 || li_600 || li_608 || li_616) {
if (li_232) {
ld_172 = gd_224;
ld_180 = 51;
l_magic_380 = g_magic_348;
} else {
if (li_320) {
ld_172 = gd_224;
ld_180 = 40;
l_magic_380 = g_magic_352;
} else {
if (li_344) {
ld_172 = gd_224;
ld_180 = 15;
l_magic_380 = g_magic_356;
} else {
if (li_376) {
ld_172 = gd_224;
ld_180 = 104;
l_magic_380 = g_magic_364;
} else {
if (li_624) {
ld_172 = gd_224;
ld_180 = 28;
l_magic_380 = g_magic_368;
} else {
if (li_476 && g_count_460 < gi_328) {
ld_172 = gd_224;
ld_180 = 28;
l_magic_380 = g_magic_372;
} else {
if (li_548) {
ld_172 = gd_224;
ld_180 = 120;
l_magic_380 = g_magic_380;
} else {
if (li_600) {
ld_172 = gd_224;
ld_180 = 35;
l_magic_380 = g_magic_384;
} else {
if (li_608) {
gi_552 = FALSE;
ld_172 = gd_224;
l_magic_380 = g_magic_384;
if (g_count_460 == 0) ld_180 = 100;
if (g_count_460 == 1) ld_180 = 50;
if (g_count_460 == 2) ld_180 = 25;
if (g_count_460 == 3) ld_180 = 20;
if (g_count_460 == 4) ld_180 = 20;
} else {
if (li_616) {
ld_172 = gd_224;
l_magic_380 = g_magic_392;
if (g_count_460 == 0) ld_180 = 50;
if (g_count_460 == 1) ld_180 = 20;
if (g_count_460 == 2) ld_180 = 15;
if (g_count_460 == 3) ld_180 = 10;
if (g_count_460 == 4) ld_180 = 10;
}
}
}
}
}
}
}
}
}
}
g_hist_total_484 = OrdersHistoryTotal();
g_bars_464 = Bars;
g_ima_624 = l_ima_852;
if (g_count_492 == 0 && g_count_496 == 0 && Hedging_Loss) subOpenSell(ld_172, ld_180, l_magic_380);
if (!Hedging_Loss) subOpenSell(ld_172, ld_180, l_magic_380);
}
return (0);
}
return (0);
}double subLotSize() {
double ld_ret_0 = MathRound(AccountFreeMargin() * RiskFactor / 100.0) / 100.0;
if (MinimalLot == 0.1) {
if (ld_ret_0 < 0.1) ld_ret_0 = Lots;
if (ld_ret_0 >= 0.1 && ld_ret_0 < 0.2) ld_ret_0 = 0.1;
if (ld_ret_0 >= 0.2 && ld_ret_0 < 0.3) ld_ret_0 = 0.2;
if (ld_ret_0 >= 0.3 && ld_ret_0 < 0.4) ld_ret_0 = 0.3;
if (ld_ret_0 >= 0.4 && ld_ret_0 < 0.5) ld_ret_0 = 0.4;
if (ld_ret_0 >= 0.5 && ld_ret_0 < 0.6) ld_ret_0 = 0.5;
if (ld_ret_0 >= 0.6 && ld_ret_0 < 0.7) ld_ret_0 = 0.6;
if (ld_ret_0 >= 0.7 && ld_ret_0 < 0.8) ld_ret_0 = 0.7;
if (ld_ret_0 >= 0.8 && ld_ret_0 < 0.9) ld_ret_0 = 0.8;
if (ld_ret_0 >= 0.9 && ld_ret_0 < 1.0) ld_ret_0 = 0.9;
if (ld_ret_0 > 1.0) ld_ret_0 = MathCeil(ld_ret_0);
if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;
} else {
if (MinimalLot == 0.01) {
if (ld_ret_0 < 0.01) ld_ret_0 = Lots;
if (ld_ret_0 > 1.0) ld_ret_0 = MathCeil(ld_ret_0);
if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;
}
}
return (ld_ret_0);
}double subLotSize2() {
double ld_ret_0 = MathRound(gd_564 / gd_572) * MinimalLot;
if (MinimalLot == 0.1) {
if (ld_ret_0 < 0.1) ld_ret_0 = Lots;
if (ld_ret_0 >= 0.1 && ld_ret_0 < 0.2) ld_ret_0 = 0.1;
if (ld_ret_0 >= 0.2 && ld_ret_0 < 0.3) ld_ret_0 = 0.2;
if (ld_ret_0 >= 0.3 && ld_ret_0 < 0.4) ld_ret_0 = 0.3;
if (ld_ret_0 >= 0.4 && ld_ret_0 < 0.5) ld_ret_0 = 0.4;
if (ld_ret_0 >= 0.5 && ld_ret_0 < 0.6) ld_ret_0 = 0.5;
if (ld_ret_0 >= 0.6 && ld_ret_0 < 0.7) ld_ret_0 = 0.6;
if (ld_ret_0 >= 0.7 && ld_ret_0 < 0.8) ld_ret_0 = 0.7;
if (ld_ret_0 >= 0.8 && ld_ret_0 < 0.9) ld_ret_0 = 0.8;
if (ld_ret_0 >= 0.9 && ld_ret_0 < 1.0) ld_ret_0 = 0.9;
if (ld_ret_0 > 1.0) ld_ret_0 = MathCeil(ld_ret_0);
if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;
} else {
if (MinimalLot == 0.01) {
if (ld_ret_0 < 0.01) ld_ret_0 = Lots;
if (ld_ret_0 > 1.0) ld_ret_0 = MathCeil(ld_ret_0);
if (ld_ret_0 > MaxLots) ld_ret_0 = MaxLots;
}
}
return (ld_ret_0);
}void subPrintDetails(int ai_0) {
string ls_4 = “”;
string ls_12 = “—————————————-\n”;
string ls_20 = “\n”;
string ls_28 = gs_636;
string ls_unused_36 = gs_zen_84;
string ls_unused_44 = gs_92;
string ls_52 = “This Program Just For Demo Trading and Strategy Tester”;
string ls_60 = “Unlimited Usage”;
string ls_68 = “Limited for 6 Month”;
string ls_76 = “Limited for 12 Month”;
string ls_84 = “IdExpertAdvisor.com”;
int li_unused_92 = gi_76;
int li_96 = gi_104;
int li_100 = gi_108;
int li_104 = gi_100;
ls_4 = ls_4 + ls_12;
ls_4 = ls_4 + ls_28 + ls_20;
ls_4 = ls_4 + “Minimal Balance =” + DoubleToStr(gd_572, 0) + ls_20;
ls_4 = ls_4 + “Leverage =” + DoubleToStr(AccountLeverage(), 0) + ls_20;
ls_4 = ls_4 + ls_12;
if (ai_0 == 0) {
ls_4 = ls_4 + ls_52 + ” | “;
ls_4 = ls_4 + ls_84 + ls_20;
ls_4 = ls_4 + ls_12;
}
if (ai_0 == 1) {
ls_4 = ls_4 + ls_60 + ” | “;
ls_4 = ls_4 + ls_84 + ls_20;
ls_4 = ls_4 + ls_12;
ls_4 = ls_4 + “User Name =” + gs_zen_84 + ” | “;
ls_4 = ls_4 + “Account Number =” + gi_76 + ls_20;
ls_4 = ls_4 + “Broker =” + gs_92 + ls_20;
ls_4 = ls_4 + ls_12;
}
if (ai_0 == 6) {
ls_4 = ls_4 + ls_68 + ” | “;
ls_4 = ls_4 + “Valid Before D/M/Y= ” + li_104 + “/” + li_96 + “/” + li_100 + ls_20;
ls_4 = ls_4 + ls_84 + ls_20;
ls_4 = ls_4 + ls_12;
ls_4 = ls_4 + “User Name =” + gs_zen_84 + ” | “;
ls_4 = ls_4 + “Account Number =” + gi_76 + ls_20;
ls_4 = ls_4 + “Broker =” + gs_92 + ls_20;
ls_4 = ls_4 + ls_12;
}
if (ai_0 == 12) {
ls_4 = ls_4 + ls_76 + ” | “;
ls_4 = ls_4 + “Valid Before D/M/Y= ” + li_104 + “/” + li_96 + “/” + li_100 + ls_20;
ls_4 = ls_4 + ls_84 + ls_20;
ls_4 = ls_4 + ls_12;
ls_4 = ls_4 + “User Name =” + gs_zen_84 + ” | “;
ls_4 = ls_4 + “Account Number =” + gi_76 + ls_20;
ls_4 = ls_4 + “Broker =” + gs_92 + ls_20;
ls_4 = ls_4 + ls_12;
}
ls_4 = ls_4 + “MM= ” + subBoolToStr(MM) + ” | “;
ls_4 = ls_4 + “Agresip_MM= ” + subBoolToStr(Agresip_MM) + ” | “;
ls_4 = ls_4 + “RiskFactor= ” + DoubleToStr(RiskFactor, 1) + ” | “;
ls_4 = ls_4 + “Lots= ” + DoubleToStr(Lots, 2) + ls_20;
ls_4 = ls_4 + ls_12;
if (IsTesting() && OrdersTotal() == 0) {
ls_4 = ls_4 + “Balance= ” + DoubleToStr(AccountBalance(), 0) + ” | “;
ls_4 = ls_4 + “Equity = ” + DoubleToStr(AccountEquity(), 0) + ” | “;
ls_4 = ls_4 + “Free Margin = ” + DoubleToStr(AccountFreeMargin(), 0) + ls_20;
}
if (IsTesting() && OrdersTotal() > 0) {
ls_4 = ls_4 + “Balance= ” + DoubleToStr(AccountBalance(), 0) + ” | “;
ls_4 = ls_4 + “Equity = ” + DoubleToStr(AccountEquity(), 0) + ” | “;
ls_4 = ls_4 + “Margin = ” + DoubleToStr(AccountMargin(), 0) + ” | “;
ls_4 = ls_4 + “Free Margin = ” + DoubleToStr(AccountFreeMargin(), 0) + ” | “;
ls_4 = ls_4 + “Margin Level= ” + DoubleToStr(gd_580, 2) + “%” + ls_20;
}
Comment(ls_4);
}string subBoolToStr(bool ai_0) {
if (ai_0) return (“True”);
else return (“False”);
}void subOpenBuy(int a_price_0, int ai_4, int a_magic_8) {
int l_ticket_16;
int l_error_20;
for (int l_count_12 = 0; l_count_12 < gi_240; l_count_12++) {
l_ticket_16 = OrderSend(Symbol(), OP_BUY, Lots, g_price_596, g_slippage_232, a_price_0, g_price_596 + ai_4 * gd_216, “Buy”, a_magic_8, 0, Green);
l_error_20 = GetLastError();
if (l_error_20 == 0/* NO_ERROR */) {
if (l_ticket_16 <= 0) break;
if (!(OrderSelect(l_ticket_16, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_456++;
if (g_price_596 > g_price_508) g_price_508 = g_price_596;
Print(“BUY order opened : “, OrderOpenPrice());
return;
}
if (l_error_20 == 0/* NO_ERROR */ || l_error_20 == 4/* SERVER_BUSY */ || l_error_20 == 136/* OFF_QUOTES */ || l_error_20 == 137/* BROKER_BUSY */ || l_error_20 == 138/* REQUOTE */ ||
l_error_20 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_ticket_16 > 0) {
g_count_456++;
return;
}
}
}
}void subOpenSell(int a_price_0, int ai_4, int a_magic_8) {
int l_ticket_16;
int l_error_20;
for (int l_count_12 = 0; l_count_12 < gi_240; l_count_12++) {
l_ticket_16 = OrderSend(Symbol(), OP_SELL, Lots, g_price_588, g_slippage_232, a_price_0, g_price_588 – ai_4 * gd_216, “Sell”, a_magic_8, 0, Green);
l_error_20 = GetLastError();
if (l_error_20 == 0/* NO_ERROR */) {
if (l_ticket_16 <= 0) break;
if (!(OrderSelect(l_ticket_16, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_460++;
if (g_price_588 < g_price_516) g_price_516 = g_price_588;
Print(“SELL order opened : “, OrderOpenPrice());
return;
}
if (l_error_20 == 0/* NO_ERROR */ || l_error_20 == 4/* SERVER_BUSY */ || l_error_20 == 136/* OFF_QUOTES */ || l_error_20 == 137/* BROKER_BUSY */ || l_error_20 == 138/* REQUOTE */ ||
l_error_20 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_ticket_16 > 0) {
g_count_460++;
return;
}
}
}
}void subCloseBuy() {
int l_ord_close_4;
int l_error_8;
for (int l_count_0 = 0; l_count_0 < gi_244; l_count_0++) {
l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), g_price_588, g_slippage_236, Violet);
l_error_8 = GetLastError();
if (l_error_8 == 0/* NO_ERROR */) {
if (l_ord_close_4 <= 0) break;
if (!(OrderSelect(l_ord_close_4, SELECT_BY_TICKET, MODE_TRADES))) break;
Print(“BUY order closed : “, OrderClosePrice());
return;
}
if (l_error_8 == 0/* NO_ERROR */ || l_error_8 == 4/* SERVER_BUSY */ || l_error_8 == 136/* OFF_QUOTES */ || l_error_8 == 137/* BROKER_BUSY */ || l_error_8 == 138/* REQUOTE */ ||
l_error_8 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else
if (l_ord_close_4 > 0 || l_error_8 == 130/* INVALID_STOPS */) break;
}
}void subCloseSell() {
int l_ord_close_4;
int li_8;
for (int l_count_0 = 0; l_count_0 < gi_244; l_count_0++) {
l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), g_price_596, g_slippage_236, Violet);
return;
if (li_8 == 0 || li_8 == 4 || li_8 == 136 || li_8 == 137 || li_8 == 138 || li_8 == 146) Sleep(gi_248);
else
if (l_ord_close_4 > 0 || li_8 == 130) break;
}
}void subOpenBuy2(int ai_0, int ai_4, int a_magic_8) {
int l_ticket_16;
int l_error_20;
for (int l_count_12 = 0; l_count_12 < gi_240; l_count_12++) {
l_ticket_16 = OrderSend(Symbol(), OP_BUY, Lots, g_price_596, g_slippage_232, g_price_596 – ai_0 * gd_216, g_price_596 + ai_4 * gd_216, “Buy”, a_magic_8, 0, Green);
l_error_20 = GetLastError();
if (l_error_20 == 0/* NO_ERROR */) {
if (l_ticket_16 <= 0) break;
if (!(OrderSelect(l_ticket_16, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_492++;
gi_500 = TRUE;
Print(“BUY order opened : “, OrderOpenPrice());
return;
}
if (l_error_20 == 0/* NO_ERROR */ || l_error_20 == 4/* SERVER_BUSY */ || l_error_20 == 136/* OFF_QUOTES */ || l_error_20 == 137/* BROKER_BUSY */ || l_error_20 == 138/* REQUOTE */ ||
l_error_20 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_ticket_16 > 0) {
g_count_456++;
return;
}
}
}
}void subOpenSell2(int ai_0, int ai_4, int a_magic_8) {
int l_ticket_16;
int l_error_20;
for (int l_count_12 = 0; l_count_12 < gi_240; l_count_12++) {
l_ticket_16 = OrderSend(Symbol(), OP_SELL, Lots, g_price_588, g_slippage_232, g_price_588 + ai_0 * gd_216, g_price_588 – ai_4 * gd_216, “Sell”, a_magic_8, 0, Green);
l_error_20 = GetLastError();
if (l_error_20 == 0/* NO_ERROR */) {
if (l_ticket_16 <= 0) break;
if (!(OrderSelect(l_ticket_16, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_496++;
gi_504 = TRUE;
Print(“SELL order opened : “, OrderOpenPrice());
return;
}
if (l_error_20 == 0/* NO_ERROR */ || l_error_20 == 4/* SERVER_BUSY */ || l_error_20 == 136/* OFF_QUOTES */ || l_error_20 == 137/* BROKER_BUSY */ || l_error_20 == 138/* REQUOTE */ ||
l_error_20 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_ticket_16 > 0) {
g_count_460++;
return;
}
}
}
}void subCloseBuy2() {
int l_ord_close_4;
int l_error_8;
for (int l_count_0 = 0; l_count_0 < gi_244; l_count_0++) {
l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), g_price_588, g_slippage_236, Violet);
l_error_8 = GetLastError();
if (l_error_8 == 0/* NO_ERROR */) {
if (l_ord_close_4 <= 0) break;
if (!(OrderSelect(l_ord_close_4, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_492–;
Print(“BUY order closed : “, OrderClosePrice());
return;
}
if (l_error_8 == 0/* NO_ERROR */ || l_error_8 == 4/* SERVER_BUSY */ || l_error_8 == 136/* OFF_QUOTES */ || l_error_8 == 137/* BROKER_BUSY */ || l_error_8 == 138/* REQUOTE */ ||
l_error_8 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_error_8 == 130/* INVALID_STOPS */) RefreshRates();
else
if (l_ord_close_4 > 0) break;
}
}
}void subCloseSell2() {
int l_ord_close_4;
int l_error_8;
for (int l_count_0 = 0; l_count_0 < gi_244; l_count_0++) {
l_ord_close_4 = OrderClose(OrderTicket(), OrderLots(), g_price_596, g_slippage_236, Violet);
l_error_8 = GetLastError();
if (l_error_8 == 0/* NO_ERROR */) {
if (l_ord_close_4 <= 0) break;
if (!(OrderSelect(l_ord_close_4, SELECT_BY_TICKET, MODE_TRADES))) break;
g_count_496–;
Print(“SELL order closed : “, OrderClosePrice());
return;
}
if (l_error_8 == 0/* NO_ERROR */ || l_error_8 == 4/* SERVER_BUSY */ || l_error_8 == 136/* OFF_QUOTES */ || l_error_8 == 137/* BROKER_BUSY */ || l_error_8 == 138/* REQUOTE */ ||
l_error_8 == 146/* TRADE_CONTEXT_BUSY */) Sleep(gi_248);
else {
if (l_error_8 == 130/* INVALID_STOPS */) RefreshRates();
else
if (l_ord_close_4 > 0) break;
}
}
}
相关资源
暂无评论...