FOREX Combo 1.46 EDU

FOREX Combo 1.46 EDU

官方版 无广告 66

更新日期:2022-11-03 分类标签: 语言:中文 平台:没限制

9 人已下载 手机查看

FOREX Combo 1.46 EDU FOREX Combo 1.46 EDU

#property copyright "FXautomater"
#property link "www.fxautomater.com"

#import "Kernel32.dll"
void GetSystemTime(int& a0[]);
#import

int gi_76 = 2010;
int gi_80 = 11;
int gi_84 = 1;
extern bool Use_FXCOMBO_Scalping = TRUE;
extern bool Use_FXCOMBO_Breakout = TRUE;
extern bool Use_FXCOMBO_Reversal = TRUE;
extern bool Use_ECN_Broker = FALSE;
extern string CommentSys1 = "==== 1 ====";
extern string CommentSys2 = "==== 2 ====";
extern string CommentSys3 = "==== 3 ====";
extern int Magic1 = 111;
extern int Magic2 = 222;
extern int Magic3 = 333;
extern double MaxSPREAD = 4.0;
extern int Slippage = 2;
extern bool AutoGMT_Offset = TRUE;
extern int GMT_Offset_TestMode = 2;
extern bool UseAgresiveMM = FALSE;
extern string MMSys1 = "==== FXCOMBO Scalping MM Parameters ====";
extern double LotsSys1 = 0.1;
extern double TradeMMSys1 = 0.0;
extern double LossFactorSys1 = 2.0;
int gi_196 = 0;
int gi_200 = 2;
int gi_204 = 0;
extern string MMSys2 = "==== FXCOMBO Breakout MM Parameters ====";
extern double LotsSys2 = 0.1;
extern double TradeMMSys2 = 0.0;
extern double LossFactorSys2 = 2.0;
int gi_240 = 0;
int gi_244 = 2;
int gi_248 = 0;
extern string MMSys3 = "==== FXCOMBO Reversal MM Parameters ====";
extern double LotsSys3 = 0.1;
extern double TradeMMSys3 = 0.0;
extern double LossFactorSys3 = 2.0;
int gi_284 = 0;
int gi_288 = 2;
int gi_292 = 0;
extern string CommonMM = "==== Main MM Parameters ====";
extern double MMMax = 20.0;
extern double MaximalLots = 50.0;
extern string Scalping = "==== FXCOMBO Scalping System Parameters ====";
extern int StopLoss = 300;
extern int TakeProfit = 21;
int g_period_336 = 60;
extern int TREND_STR = 20;
int g_period_344 = 18;
extern int OSC_open = 10;
extern int OSC_close = 13;
int gi_356 = -5;
int gi_360 = 21;
int gi_unused_364 = 21;
int gi_368 = 6;
extern string Breakout = "==== FXCOMBO Breakout System Parameters ====";
extern int TakeProfit_II = 500;
extern int StopLoss_II = 30;
extern int MaxPipsTrailing2 = 180;
extern int MinPipsTrailing2 = 10;
extern int Break = 13;
int g_period_400 = 1;
int g_period_404 = 19;
double gd_408 = 1.4;
extern double ATRTrailingFactor2 = 4.7;
int gi_424 = 300;
int gi_428 = 270;
int gi_432 = 20;
int gi_436 = 0;
int gi_440 = 8;
int gi_444 = 7;
int gi_448 = 18;
int gi_452 = 17;
int gi_456 = 13;
int gi_460 = 14;
int gi_464 = 6;
int gi_468 = 9;
int gi_472 = 2;
int gi_476 = 3;
extern string Reversal = "==== FXCOMBO Reversal System Parameters ====";
extern int BegHourSys_III = 22;
extern int EndHourSys_III = 0;
extern double TakeProfit_III = 160.0;
extern int StopLoss_III = 70;
int gi_508 = 300;
extern int MaxPipsTrailing3 = 60;
extern int MinPipsTrailing3 = 20;
int g_period_520 = 60;
double gd_524 = 13.0;
int g_period_532 = 26;
int gi_536 = -3;
int gi_540 = 30;
bool gi_544 = TRUE;
string gs_548 = "";
double g_minlot_556 = 0.0;
double g_maxlot_564 = 0.0;
int g_leverage_572 = 0;
int g_lotsize_576 = 0;
int g_stoplevel_580 = 0;
int g_datetime_584 = 0;
int g_datetime_588 = 0;

int init() {
gi_544 = TRUE;
Comment("");
return (0);
}

int deinit() {
Comment("");
return (0);
}

int start() {
double l_price_0;
double l_price_8;
double l_price_16;
color l_color_24;
bool l_bool_32;
bool l_bool_36;
double ld_40;
int li_48;
int l_ticket_296;
int l_ticket_300;
int l_ticket_304;
double l_price_312;
double l_price_320;
double l_price_328;
double l_price_336;
double ld_344;
double l_price_352;
double l_price_360;
double l_price_368;
double ld_376;
double l_price_384;
double l_lots_392;
string ls_400;
double l_lots_408;
double l_lots_416;
if (gi_544) {
gi_544 = FALSE;
g_minlot_556 = MarketInfo(Symbol(), MODE_MINLOT);
g_maxlot_564 = MarketInfo(Symbol(), MODE_MAXLOT);
g_leverage_572 = AccountLeverage();
g_lotsize_576 = MarketInfo(Symbol(), MODE_LOTSIZE);
g_stoplevel_580 = MarketInfo(Symbol(), MODE_STOPLEVEL);
}
/* if (Year() > gi_76 || (Month() > gi_80 && Year() == gi_76) || (Day() > gi_84 && Month() >= gi_80 && Year() == gi_76)) {
Comment("\n This version is out of date. Visit www.fxautomater.com and get your updated version!");
Alert("This version is out of date. Visit www.fxautomater.com and get your updated version!");
Sleep(30000);
return (0);
} */
if (!IsTesting() && IsDllsAllowed() == FALSE) {
Comment("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors.");
Print("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors.");
Alert("Warning: Set Parameter **AllowDLL Imports** ON in menu Tools -> Options -> ExpertAdvisors.");
Sleep(30000);
return (0);
}
if (Digits <= 3) ld_40 = 0.01;
else ld_40 = 0.0001;
if (Ask - Bid > MaxSPREAD * ld_40) {
Comment("\n SPREAD IS TOO HIGH ...");
Print("SPREAD IS TOO HIGH ...");
return (0);
}
if (!IsTesting() && AutoGMT_Offset == TRUE) li_48 = GMTOffset();
else li_48 = GMT_Offset_TestMode;
string ls_52 = "FX COMBO is running on your account.";
string ls_60 = "FX COMBO is set up for time zone GMT " + li_48;
string ls_68 = "Spread= " + DoubleToStr((Ask - Bid) / ld_40, 1) + " pips [in norm]";
string ls_76 = "Account Balance= " + DoubleToStr(AccountBalance(), 2);
string ls_84 = " ";
Comment("\n\n\n\n " + ls_52 + " \n " + ls_60 + " \n " + ls_68 + " \n " + ls_76 + " \n " + ls_84 + " " + gs_548);
ObjectCreate("klc", OBJ_LABEL, 0, 0, 0);
ObjectSetText("klc", " FOREX COMBO SYSTEM ", 9, "System", Red);
ObjectSet("klc", OBJPROP_CORNER, 0);
ObjectSet("klc", OBJPROP_XDISTANCE, 0);
ObjectSet("klc", OBJPROP_YDISTANCE, 22);
ObjectCreate("klc2", OBJ_LABEL, 0, 0, 0);
ObjectSetText("klc2", " by FXautomater ", 9, "System", Gray);
ObjectSet("klc2", OBJPROP_CORNER, 0);
ObjectSet("klc2", OBJPROP_XDISTANCE, 165);
ObjectSet("klc2", OBJPROP_YDISTANCE, 22);
ObjectCreate("klc3", OBJ_LABEL, 0, 0, 0);
ObjectSetText("klc3", " Copyright ?www.fxautomater.com ", 9, "System", Gray);
ObjectSet("klc3", OBJPROP_CORNER, 0);
ObjectSet("klc3", OBJPROP_XDISTANCE, 0);
ObjectSet("klc3", OBJPROP_YDISTANCE, 38);
if (gi_544) {
gi_544 = FALSE;
g_minlot_556 = MarketInfo(Symbol(), MODE_MINLOT);
g_maxlot_564 = MarketInfo(Symbol(), MODE_MAXLOT);
g_leverage_572 = AccountLeverage();
g_lotsize_576 = MarketInfo(Symbol(), MODE_LOTSIZE);
g_stoplevel_580 = MarketInfo(Symbol(), MODE_STOPLEVEL);
}
if (UseAgresiveMM != TRUE) {
LossFactorSys1 = 1;
LossFactorSys2 = 1;
LossFactorSys3 = 1;
}
HideTestIndicators(FALSE);
double l_iclose_92 = iClose(NULL, PERIOD_M15, 1);
double l_ima_100 = iMA(NULL, PERIOD_M15, g_period_336, 0, MODE_SMMA, PRICE_CLOSE, 1);
double l_iwpr_108 = iWPR(NULL, PERIOD_M15, g_period_344, 1);
double l_iatr_116 = iATR(NULL, PERIOD_H1, g_period_404, 1);
double l_ima_124 = iMA(NULL, PERIOD_H1, g_period_400, 0, MODE_EMA, PRICE_CLOSE, 1);
double ld_132 = l_ima_124 + l_iatr_116 * gd_408;
double ld_140 = l_ima_124 - l_iatr_116 * gd_408;
double l_iclose_148 = iClose(NULL, PERIOD_M5, 1);
double l_iatr_156 = iATR(NULL, PERIOD_M5, g_period_520, 1);
double l_ihigh_164 = iHigh(NULL, PERIOD_H1, 1);
double l_ilow_172 = iLow(NULL, PERIOD_H1, 1);
double l_ibands_180 = iBands(NULL, PERIOD_H1, g_period_532, 2, 0, PRICE_CLOSE, MODE_UPPER, 1);
double l_ibands_188 = iBands(NULL, PERIOD_H1, g_period_532, 2, 0, PRICE_CLOSE, MODE_LOWER, 1);
HideTestIndicators(FALSE);
if (TakeProfit < g_stoplevel_580 * ld_40) TakeProfit = g_stoplevel_580 * ld_40;
if (TakeProfit_II < g_stoplevel_580 * ld_40) TakeProfit_II = g_stoplevel_580 * ld_40;
if (StopLoss < g_stoplevel_580 * ld_40) StopLoss = g_stoplevel_580 * ld_40;
if (StopLoss_II < g_stoplevel_580 * ld_40) StopLoss_II = g_stoplevel_580 * ld_40;
if (TakeProfit_III < g_stoplevel_580 * ld_40) TakeProfit_III = g_stoplevel_580 * ld_40;
if (StopLoss_III < g_stoplevel_580 * ld_40) StopLoss_III = g_stoplevel_580 * ld_40;
int li_196 = gi_360 + li_48;
int li_200 = gi_360 + li_48;
int li_204 = BegHourSys_III + li_48;
int li_208 = EndHourSys_III + li_48;
if (li_196 > 23) li_196 -= 24;
if (li_196 < 0) li_196 += 24;
if (li_204 > 23) li_204 -= 24;
if (li_204 < 0) li_204 += 24;
if (li_200 > 23) li_200 -= 24;
if (li_200 < 0) li_200 += 24;
if (li_208 > 23) li_208 -= 24;
if (li_208 < 0) li_208 += 24;
int li_212 = gi_436 + li_48;
int li_216 = gi_440 + li_48;
int li_220 = gi_444 + li_48;
int li_224 = gi_448 + li_48;
int li_228 = gi_452 + li_48;
int li_232 = gi_456 + li_48;
int li_236 = gi_460 + li_48;
int li_240 = gi_464 + li_48;
int li_244 = gi_468 + li_48;
int li_248 = gi_472 + li_48;
int li_252 = gi_476 + li_48;
if (li_212 > 23) li_212 -= 24;
if (li_212 < 0) li_212 += 24;
if (li_216 > 23) li_216 -= 24;
if (li_216 < 0) li_216 += 24;
if (li_220 > 23) li_220 -= 24;
if (li_220 < 0) li_220 += 24;
if (li_224 > 23) li_224 -= 24;
if (li_224 < 0) li_224 += 24;
if (li_228 > 23) li_228 -= 24;
if (li_228 < 0) li_228 += 24;
if (li_232 > 23) li_232 -= 24;
if (li_232 < 0) li_232 += 24;
if (li_236 > 23) li_236 -= 24;
if (li_236 < 0) li_236 += 24;
if (li_240 > 23) li_240 -= 24;
if (li_240 < 0) li_240 += 24;
if (li_244 > 23) li_244 -= 24;
if (li_244 < 0) li_244 += 24;
if (li_248 > 23) li_248 -= 24;
if (li_248 < 0) li_248 += 24;
if (li_252 > 23) li_252 -= 24;
if (li_252 < 0) li_252 += 24;
Slippage = Slippage * ld_40;
int l_count_256 = 0;
int l_count_260 = 0;
int l_count_264 = 0;
int l_count_268 = 0;
int l_count_272 = 0;
int l_count_276 = 0;
int l_datetime_280 = g_datetime_584;
int li_284 = g_datetime_584 + gi_424;
int l_datetime_288 = g_datetime_588;
int li_292 = g_datetime_588 + gi_508;
for (int l_pos_308 = OrdersTotal() - 1; l_pos_308 >= 0; l_pos_308--) {
if (!OrderSelect(l_pos_308, SELECT_BY_POS, MODE_TRADES)) Print("Error in OrderSelect! Position:", l_pos_308);
else {
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol()) {
if (OrderMagicNumber() == Magic1) {
if (OrderType() == OP_BUY) {
if (OrderStopLoss() == 0.0) {
l_price_312 = NormalizeDouble(Ask - StopLoss * ld_40, Digits);
l_price_320 = NormalizeDouble(Ask + TakeProfit * ld_40, Digits);
if (CheckStop(OrderType(), l_price_312) && CheckTarget(OrderType(), l_price_320)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_312, l_price_320, 0, Green);
}
if (l_iwpr_108 > (-OSC_close) && Bid > l_iclose_92 + gi_356 * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Slippage, Violet);
} else l_count_256++;
} else {
if (OrderStopLoss() == 0.0) {
l_price_312 = NormalizeDouble(Bid + StopLoss * ld_40, Digits);
l_price_320 = NormalizeDouble(Bid - TakeProfit * ld_40, Digits);
if (CheckStop(OrderType(), l_price_312) && CheckTarget(OrderType(), l_price_320)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_312, l_price_320, 0, Green);
}
if (l_iwpr_108 < OSC_close + (-100) && Bid < l_iclose_92 - gi_356 * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), Slippage, Violet);
} else l_count_260++;
}
}
if (OrderMagicNumber() == Magic2) {
if (OrderType() == OP_BUY) {
if (OrderStopLoss() == 0.0) {
l_price_328 = NormalizeDouble(Ask - StopLoss_II * ld_40, Digits);
l_price_336 = NormalizeDouble(Ask + TakeProfit_II * ld_40, Digits);
if (CheckStop(OrderType(), l_price_328) && CheckTarget(OrderType(), l_price_336)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_328, l_price_336, 0, Green);
}
if (l_iclose_148 <= ld_140 - Break * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Slippage, Violet);
} else l_count_264++;
if (TimeCurrent() >= li_284) {
ld_344 = l_iatr_116 * ATRTrailingFactor2;
if (ld_344 > MaxPipsTrailing2 * ld_40) ld_344 = MaxPipsTrailing2 * ld_40;
if (ld_344 < MinPipsTrailing2 * ld_40) ld_344 = MinPipsTrailing2 * ld_40;
if (Bid - OrderOpenPrice() > gi_428 * ld_40) ld_344 = gi_432 * ld_40;
l_price_352 = NormalizeDouble(Bid - ld_344, Digits);
if (Bid - OrderOpenPrice() > ld_344) {
if (OrderStopLoss() < l_price_352 && CheckStop(OrderType(), l_price_352)) {
l_bool_32 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_352, OrderTakeProfit(), 0, Blue);
if (l_bool_32) {
l_datetime_280 = TimeCurrent();
g_datetime_584 = l_datetime_280;
}
}
}
}
} else {
if (OrderStopLoss() == 0.0) {
l_price_328 = NormalizeDouble(Bid + StopLoss_II * ld_40, Digits);
l_price_336 = NormalizeDouble(Bid - TakeProfit_II * ld_40, Digits);
if (CheckStop(OrderType(), l_price_328) && CheckTarget(OrderType(), l_price_336)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_328, l_price_336, 0, Green);
}
if (l_iclose_148 >= ld_132 + Break * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), Slippage, Violet);
} else l_count_268++;
if (TimeCurrent() >= li_284) {
ld_344 = l_iatr_116 * ATRTrailingFactor2;
if (ld_344 > MaxPipsTrailing2 * ld_40) ld_344 = MaxPipsTrailing2 * ld_40;
if (ld_344 < MinPipsTrailing2 * ld_40) ld_344 = MinPipsTrailing2 * ld_40;
if (OrderOpenPrice() - Ask > gi_428 * ld_40) ld_344 = gi_432 * ld_40;
l_price_352 = NormalizeDouble(Ask + ld_344, Digits);
if (OrderOpenPrice() - Ask > ld_344) {
if (OrderStopLoss() > l_price_352 && CheckStop(OrderType(), l_price_352)) {
l_bool_32 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_352, OrderTakeProfit(), 0, Red);
if (l_bool_32) {
l_datetime_280 = TimeCurrent();
g_datetime_584 = l_datetime_280;
}
}
}
}
}
}
if (OrderMagicNumber() == Magic3) {
if (OrderType() == OP_BUY) {
if (OrderStopLoss() == 0.0) {
l_price_360 = NormalizeDouble(Ask - StopLoss_III * ld_40, Digits);
l_price_368 = NormalizeDouble(Ask + TakeProfit_III * ld_40, Digits);
if (CheckStop(OrderType(), l_price_360) && CheckTarget(OrderType(), l_price_368)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_360, l_price_368, 0, Green);
}
if ((li_204 <= li_208 && TimeHour(TimeCurrent()) >= li_204 && TimeHour(TimeCurrent()) <= li_208) || (li_204 > li_208 && TimeHour(TimeCurrent()) >= li_204 || TimeHour(TimeCurrent()) <= li_208) &&
l_ibands_180 - l_ibands_188 >= gi_540 * ld_40 && l_ihigh_164 > l_ibands_180 + gi_536 * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Bid, Digits), Slippage, Violet);
} else l_count_272++;
if (TimeCurrent() >= li_292) {
ld_376 = l_iatr_156 * gd_524;
if (ld_376 > MaxPipsTrailing3 * ld_40) ld_376 = MaxPipsTrailing3 * ld_40;
if (ld_376 < MinPipsTrailing3 * ld_40) ld_376 = MinPipsTrailing3 * ld_40;
l_price_384 = NormalizeDouble(Bid - ld_376, Digits);
if (Bid - OrderOpenPrice() > ld_376) {
if (OrderStopLoss() < l_price_384 && CheckStop(OrderType(), l_price_384)) {
l_bool_36 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_384, OrderTakeProfit(), 0, Blue);
if (l_bool_36) {
l_datetime_288 = TimeCurrent();
g_datetime_588 = l_datetime_288;
}
}
}
}
} else {
if (OrderStopLoss() == 0.0) {
l_price_360 = NormalizeDouble(Bid + StopLoss_III * ld_40, Digits);
l_price_368 = NormalizeDouble(Bid - TakeProfit_III * ld_40, Digits);
if (CheckStop(OrderType(), l_price_360) && CheckTarget(OrderType(), l_price_368)) OrderModify(OrderTicket(), OrderOpenPrice(), l_price_360, l_price_368, 0, Green);
}
if ((li_204 <= li_208 && TimeHour(TimeCurrent()) >= li_204 && TimeHour(TimeCurrent()) <= li_208) || (li_204 > li_208 && TimeHour(TimeCurrent()) >= li_204 || TimeHour(TimeCurrent()) <= li_208) &&
l_ibands_180 - l_ibands_188 >= gi_540 * ld_40 && l_ilow_172 < l_ibands_188 - gi_536 * ld_40) {
RefreshRates();
OrderClose(OrderTicket(), OrderLots(), NormalizeDouble(Ask, Digits), Slippage, Violet);
} else l_count_276++;
if (TimeCurrent() >= li_292) {
ld_376 = l_iatr_156 * gd_524;
if (ld_376 > MaxPipsTrailing3 * ld_40) ld_376 = MaxPipsTrailing3 * ld_40;
if (ld_376 < MinPipsTrailing3 * ld_40) ld_376 = MinPipsTrailing3 * ld_40;
l_price_384 = NormalizeDouble(Ask + ld_376, Digits);
if (OrderOpenPrice() - Ask > ld_376) {
if (OrderStopLoss() > l_price_384 && CheckStop(OrderType(), l_price_384)) {
l_bool_36 = OrderModify(OrderTicket(), OrderOpenPrice(), l_price_384, OrderTakeProfit(), 0, Red);
if (l_bool_36) {
l_datetime_288 = TimeCurrent();
g_datetime_588 = l_datetime_288;
}
}
}
}
}
}
}
}
}
int l_cmd_28 = -1;
if (Use_FXCOMBO_Scalping != FALSE) {
if (LotsSys1 != 0.0) {
l_lots_392 = MathMin(g_maxlot_564, MathMax(g_minlot_556, LotsSys1));
if (TradeMMSys1 > 0.0) l_lots_392 = MathMax(g_minlot_556, MathMin(g_maxlot_564, NormalizeDouble(CalcTradeMMSys1() / 100.0 * AccountFreeMargin() / g_minlot_556 / (g_lotsize_576 / 100), 0) * g_minlot_556));
if (l_lots_392 > MaximalLots) l_lots_392 = MaximalLots;
if (AccountFreeMargin() < Ask * l_lots_392 * g_lotsize_576 / g_leverage_572) {
Print("We have no money. Lots = ", l_lots_392, " , Free Margin = ", AccountFreeMargin());
Comment("We have no money. Lots = ", l_lots_392, " , Free Margin = ", AccountFreeMargin());
return (0);
}
if (l_count_256 < 1 && (l_iclose_92 > l_ima_100 + TREND_STR * ld_40 && l_iwpr_108 < OSC_open + (-100) && Bid < l_iclose_92 - gi_356 * ld_40) || (l_iwpr_108 < gi_368 +
(-100) && Bid < l_iclose_92 - gi_356 * ld_40 && Hour() == li_196 || Hour() == li_200)) {
ls_400 = "BUY";
l_cmd_28 = 0;
l_color_24 = Aqua;
RefreshRates();
l_price_0 = NormalizeDouble(Ask, Digits);
l_price_8 = l_price_0 - StopLoss * ld_40;
l_price_16 = l_price_0 + TakeProfit * ld_40;
}
if (l_count_260 < 1 && (l_iclose_92 < l_ima_100 - TREND_STR * ld_40 && l_iwpr_108 > (-OSC_open) && Bid > l_iclose_92 + gi_356 * ld_40) || (l_iwpr_108 > (-gi_368) &&
Bid > l_iclose_92 + gi_356 * ld_40 && Hour() == li_196 || Hour() == li_200)) {
ls_400 = "SELL";
l_cmd_28 = 1;
l_color_24 = Red;
RefreshRates();
l_price_0 = NormalizeDouble(Bid, Digits);
l_price_8 = l_price_0 + StopLoss * ld_40;
l_price_16 = l_price_0 - TakeProfit * ld_40;
}
}
}
if (l_cmd_28 >= OP_BUY && g_stoplevel_580 == 0 || (CheckStop(l_cmd_28, l_price_8) && CheckTarget(l_cmd_28, l_price_16))) {
if (g_stoplevel_580 == 0 || Use_ECN_Broker == TRUE) l_ticket_296 = OrderSend(Symbol(), l_cmd_28, l_lots_392, l_price_0, Slippage, 0, 0, CommentSys1, Magic1, 0, l_color_24);
else l_ticket_296 = OrderSend(Symbol(), l_cmd_28, l_lots_392, l_price_0, Slippage, l_price_8, l_price_16, CommentSys1, Magic1, 0, l_color_24);
Sleep(5000);
if (l_ticket_296 > 0) {
if (OrderSelect(l_ticket_296, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_400 + " opened!: ", OrderOpenPrice());
} else Print("Error opening " + ls_400 + " order!: ", GetLastError());
}
l_cmd_28 = -1;
if (!(TimeHour(TimeCurrent()) != li_212 && TimeHour(TimeCurrent()) != li_216 && TimeHour(TimeCurrent()) != li_220 && TimeHour(TimeCurrent()) != li_224 && TimeHour(TimeCurrent()) != li_228 &&
TimeHour(TimeCurrent()) != li_232 && TimeHour(TimeCurrent()) != li_236 && TimeHour(TimeCurrent()) != li_240 && TimeHour(TimeCurrent()) != li_244 && TimeHour(TimeCurrent()) != li_248) ||
!(TimeHour(TimeCurrent()) != li_252)) {
if (Use_FXCOMBO_Breakout != FALSE) {
if (LotsSys2 != 0.0) {
l_lots_408 = MathMin(g_maxlot_564, MathMax(g_minlot_556, LotsSys2));
if (TradeMMSys2 > 0.0) l_lots_408 = MathMax(g_minlot_556, MathMin(g_maxlot_564, NormalizeDouble(CalcTradeMMSys2() / 100.0 * AccountFreeMargin() / g_minlot_556 / (g_lotsize_576 / 100), 0) * g_minlot_556));
if (l_lots_408 > MaximalLots) l_lots_408 = MaximalLots;
if (AccountFreeMargin() < Ask * l_lots_408 * g_lotsize_576 / g_leverage_572) {
Print("We have no money. Lots = ", l_lots_408, " , Free Margin = ", AccountFreeMargin());
Comment("We have no money. Lots = ", l_lots_408, " , Free Margin = ", AccountFreeMargin());
return (0);
}
if (l_count_268 < 1 && l_iclose_148 <= ld_140 - Break * ld_40) {
ls_400 = "SELL";
l_cmd_28 = 1;
l_color_24 = Yellow;
l_price_0 = NormalizeDouble(Bid, Digits);
l_price_8 = l_price_0 + StopLoss_II * ld_40;
l_price_16 = l_price_0 - TakeProfit_II * ld_40;
}
if (l_count_264 < 1 && l_iclose_148 >= ld_132 + Break * ld_40) {
ls_400 = "BUY";
l_cmd_28 = 0;
l_color_24 = DodgerBlue;
l_price_0 = NormalizeDouble(Ask, Digits);
l_price_8 = l_price_0 - StopLoss_II * ld_40;
l_price_16 = l_price_0 + TakeProfit_II * ld_40;
}
}
}
}
if (l_cmd_28 >= OP_BUY && g_stoplevel_580 == 0 || (CheckStop(l_cmd_28, l_price_8) && CheckTarget(l_cmd_28, l_price_16))) {
if (g_stoplevel_580 == 0 || Use_ECN_Broker == TRUE) l_ticket_300 = OrderSend(Symbol(), l_cmd_28, l_lots_408, l_price_0, Slippage, 0, 0, CommentSys2, Magic2, 0, l_color_24);
else l_ticket_300 = OrderSend(Symbol(), l_cmd_28, l_lots_408, l_price_0, Slippage, l_price_8, l_price_16, CommentSys2, Magic2, 0, l_color_24);
Sleep(5000);
if (l_ticket_300 > 0) {
if (OrderSelect(l_ticket_300, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_400 + " opened!: ", OrderOpenPrice());
} else Print("Error opening " + ls_400 + " order!: ", GetLastError());
}
l_cmd_28 = -1;
if (Use_FXCOMBO_Reversal != FALSE) {
if (LotsSys3 != 0.0) {
l_lots_416 = MathMin(g_maxlot_564, MathMax(g_minlot_556, LotsSys3));
if (TradeMMSys3 > 0.0) l_lots_416 = MathMax(g_minlot_556, MathMin(g_maxlot_564, NormalizeDouble(CalcTradeMMSys3() / 100.0 * AccountFreeMargin() / g_minlot_556 / (g_lotsize_576 / 100), 0) * g_minlot_556));
if (l_lots_416 > MaximalLots) l_lots_416 = MaximalLots;
if (AccountFreeMargin() < Ask * l_lots_416 * g_lotsize_576 / g_leverage_572) {
Print("We have no money. Lots = ", l_lots_416, " , Free Margin = ", AccountFreeMargin());
Comment("We have no money. Lots = ", l_lots_416, " , Free Margin = ", AccountFreeMargin());
return (0);
}
if (l_count_272 < 1 && (li_204 <= li_208 && TimeHour(TimeCurrent()) >= li_204 && TimeHour(TimeCurrent()) <= li_208) || (li_204 > li_208 && TimeHour(TimeCurrent()) >= li_204 ||
TimeHour(TimeCurrent()) <= li_208) && l_ibands_180 - l_ibands_188 >= gi_540 * ld_40 && l_ilow_172 < l_ibands_188 - gi_536 * ld_40) {
ls_400 = "BUY";
l_cmd_28 = 0;
l_color_24 = Aqua;
RefreshRates();
l_price_0 = NormalizeDouble(Ask, Digits);
l_price_8 = l_price_0 - StopLoss_III * ld_40;
l_price_16 = l_price_0 + TakeProfit_III * ld_40;
}
if (l_count_276 < 1 && (li_204 <= li_208 && TimeHour(TimeCurrent()) >= li_204 && TimeHour(TimeCurrent()) <= li_208) || (li_204 > li_208 && TimeHour(TimeCurrent()) >= li_204 ||
TimeHour(TimeCurrent()) <= li_208) && l_ibands_180 - l_ibands_188 >= gi_540 * ld_40 && l_ihigh_164 > l_ibands_180 + gi_536 * ld_40) {
ls_400 = "SELL";
l_cmd_28 = 1;
l_color_24 = DeepPink;
RefreshRates();
l_price_0 = NormalizeDouble(Bid, Digits);
l_price_8 = l_price_0 + StopLoss_III * ld_40;
l_price_16 = l_price_0 - TakeProfit_III * ld_40;
}
}
}
if (l_cmd_28 >= OP_BUY && g_stoplevel_580 == 0 || (CheckStop(l_cmd_28, l_price_8) && CheckTarget(l_cmd_28, l_price_16))) {
if (g_stoplevel_580 == 0 || Use_ECN_Broker == TRUE) l_ticket_304 = OrderSend(Symbol(), l_cmd_28, l_lots_416, l_price_0, Slippage, 0, 0, CommentSys3, Magic3, 0, l_color_24);
else l_ticket_304 = OrderSend(Symbol(), l_cmd_28, l_lots_416, l_price_0, Slippage, l_price_8, l_price_16, CommentSys3, Magic3, 0, l_color_24);
Sleep(5000);
if (l_ticket_304 > 0) {
if (OrderSelect(l_ticket_304, SELECT_BY_TICKET, MODE_TRADES)) Print("Order " + ls_400 + " opened!: ", OrderOpenPrice());
} else Print("Error opening " + ls_400 + " order!: ", GetLastError());
}
return (0);
}

double CalcTradeMMSys1() {
int li_8;
double ld_16;
double ld_ret_0 = TradeMMSys1;
int li_12 = 0;
if (Digits <= 3) ld_16 = 0.01;
else ld_16 = 0.0001;
for (int l_hist_total_24 = OrdersHistoryTotal(); l_hist_total_24 >= 0; l_hist_total_24--) {
if (OrderSelect(l_hist_total_24, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic1) {
if (OrderProfit() > 0.0) {
if (gi_204 == 0) break;
if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_204) break;
} else li_12++;
}
}
}
if (li_12 > gi_196 && gi_200 > 1) {
li_8 = MathMod(li_12, gi_200);
ld_ret_0 *= MathPow(LossFactorSys1, li_8);
}
if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax;
return (ld_ret_0);
}

double CalcTradeMMSys2() {
int li_8;
double ld_16;
double ld_ret_0 = TradeMMSys2;
int li_12 = 0;
if (Digits <= 3) ld_16 = 0.01;
else ld_16 = 0.0001;
for (int l_hist_total_24 = OrdersHistoryTotal(); l_hist_total_24 >= 0; l_hist_total_24--) {
if (OrderSelect(l_hist_total_24, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic2) {
if (OrderProfit() > 0.0) {
if (gi_248 == 0) break;
if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_248) break;
} else li_12++;
}
}
}
if (li_12 > gi_240 && gi_244 > 1) {
li_8 = MathMod(li_12, gi_244);
ld_ret_0 *= MathPow(LossFactorSys2, li_8);
}
if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax;
return (ld_ret_0);
}

double CalcTradeMMSys3() {
int li_8;
double ld_16;
double ld_ret_0 = TradeMMSys3;
int li_12 = 0;
if (Digits <= 3) ld_16 = 0.01;
else ld_16 = 0.0001;
for (int l_hist_total_24 = OrdersHistoryTotal(); l_hist_total_24 >= 0; l_hist_total_24--) {
if (OrderSelect(l_hist_total_24, SELECT_BY_POS, MODE_HISTORY)) {
if (OrderType() <= OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == Magic3) {
if (OrderProfit() > 0.0) {
if (gi_292 == 0) break;
if (MathAbs(OrderClosePrice() - OrderOpenPrice()) / ld_16 > gi_292) break;
} else li_12++;
}
}
}
if (li_12 > gi_284 && gi_288 > 1) {
li_8 = MathMod(li_12, gi_288);
ld_ret_0 *= MathPow(LossFactorSys3, li_8);
}
if (MMMax > 0.0 && ld_ret_0 > MMMax) ld_ret_0 = MMMax;
return (ld_ret_0);
}

int GMTOffset() {
int lia_0[4];
int lia_4[43];
string ls_unused_16;
GetSystemTime(lia_0);
int li_36 = lia_0[0] & 65535;
int li_40 = lia_0[0] >> 16;
int li_44 = lia_0[1] >> 16;
int li_48 = lia_0[2] & 65535;
int li_52 = lia_0[2] >> 16;
int li_56 = lia_0[3] & 65535;
string ls_8 = FormatDateTime(li_36, li_40, li_44, li_48, li_52, li_56);
double ld_28 = TimeCurrent() - StrToTime(ls_8);
gs_548 = "\n Greenwich Mean Time : " + TimeToStr(StrToTime(ls_8), TIME_DATE|TIME_MINUTES|TIME_SECONDS)
+ "\n Broker Time : " + TimeToStr(TimeCurrent(), TIME_DATE|TIME_MINUTES|TIME_SECONDS)
+ "\n Local Time : " + TimeToStr(TimeLocal(), TIME_DATE|TIME_MINUTES|TIME_SECONDS);
return (MathRound(ld_28 / 3600.0));
}

string FormatDateTime(int ai_0, int ai_4, int ai_8, int ai_12, int ai_16, int ai_20) {
string ls_24 = ai_4 + 100;
ls_24 = StringSubstr(ls_24, 1);
string ls_32 = ai_8 + 100;
ls_32 = StringSubstr(ls_32, 1);
string ls_40 = ai_12 + 100;
ls_40 = StringSubstr(ls_40, 1);
string ls_48 = ai_16 + 100;
ls_48 = StringSubstr(ls_48, 1);
string ls_56 = ai_20 + 100;
ls_56 = StringSubstr(ls_56, 1);
return (StringConcatenate(ai_0, ".", ls_24, ".", ls_32, " ", ls_40, ":", ls_48, ":", ls_56));
}

int CheckStop(int ai_0, double ad_4) {
bool li_ret_12 = TRUE;
int l_stoplevel_16 = MarketInfo(Symbol(), MODE_STOPLEVEL);
if (l_stoplevel_16 > 0 && ad_4 > 0.0 && ai_0 == 0 && ad_4 > Bid - l_stoplevel_16 * Point) li_ret_12 = FALSE;
else
if (l_stoplevel_16 > 0 && ad_4 > 0.0 && ai_0 == 1 && ad_4 < Ask + l_stoplevel_16 * Point) li_ret_12 = FALSE;
return (li_ret_12);
}

int CheckTarget(int ai_0, double ad_4) {
bool li_ret_12 = TRUE;
int l_stoplevel_16 = MarketInfo(Symbol(), MODE_STOPLEVEL);
if (l_stoplevel_16 > 0 && ad_4 > 0.0 && ai_0 == 0 && ad_4 < Bid + l_stoplevel_16 * Point) li_ret_12 = FALSE;
else
if (l_stoplevel_16 > 0 && ad_4 > 0.0 && ai_0 == 1 && ad_4 > Ask - l_stoplevel_16 * Point) li_ret_12 = FALSE;
return (li_ret_12);
}

相关资源

暂无评论

暂无评论...