Forex Hacked是比较老牌和存活比较久远的一款网格外汇EA,它采取对冲、加码及突破加码等策略进行获利。这种外汇EA风险较高,但一般高风险的东西往往就是高利润。如果资金控制得好,长期保持稳定收益 ,这种外汇EA还是值一用的。
Forex hacked 又一改进马丁格尔型加码EA ,是国外的一个商业软件,如今还在热销售中。其作为一个双向对冲型的Martingale EA,与网格ea有好多类同的地方,只不过其加仓距离, 仓位,盈利目标比较清晰,容易方便设置。 作为商业销售Ea ,其添加了交易时间自动选择,可以避开重要新闻和数据发布时段交易。 其对冲功能减轻了资金要求,也可避免了逆势仓位造成的过多浮亏,等待市场回调,可以全部平掉仓位。
Forex Hacked是比较老牌和存活比较久远的一款网格外汇EA,它采取对冲、加码及突破加码等策略进行获利。这种外汇EA风险较高,但一般高风险的东西往往就是高利润。如果资金控制得好,长期保持稳定收益 ,这种外汇EA还是值一用的。
货币对:USD/JPY、GBP/USD、EUR/USD、AUD/USD、USD/CHF时间段:30分钟、1小时
#property copyright "ForexHacked 2.4" #property link "http://www.ForexHacked.com" /* */ // extern string User = "Your ForexHacked.com Username"; extern string _________ = "Magic Number Must be UNIQUE for each chart!"; extern int MagicNumber = 133714; extern double Lots = 0.01; extern double TakeProfit = 132.0; extern double Booster = 2.0; extern int PipStarter = 170; double gd_124 = 0.0; int gi_unused_132 = 0; int gi_136 = 0; extern int MaxBuyOrders = 9; extern int MaxSellOrders = 9; extern bool AllowiStopLoss = FALSE; extern int iStopLoss = 300; extern int StartHour = 0; extern int StartMinute = 0; extern int StopHour = 23; extern int StopMinute = 55; extern int StartingTradeDay = 0; extern int EndingTradeDay = 7; extern int slippage = 3; extern bool allowTrending = TRUE; extern int trendTrigger = 3; extern int trendPips = 5; extern int trendStoploss = 5; int gi_200 = 5000; int gi_204 = 0; int gi_208 = 0; extern double StopLossPct = 100.0; extern double TakeProfitPct = 100.0; extern bool PauseNewTrades = FALSE; extern int StoppedOutPause = 600; double gd_236; bool gi_252; int g_period_256 = 7; int gi_260 = 0; int g_ma_method_264 = MODE_LWMA; int g_applied_price_268 = PRICE_WEIGHTED; double gd_272 = 0.25; double gd_280 = 0.2; extern bool SupportECN = TRUE; extern bool MassHedge = FALSE; extern double MassHedgeBooster = 1.01; extern int TradesDeep = 5; extern string EA_Name = "ForexHacked 2.4"; int g_datetime_316; double g_point_320; int gi_328; bool gi_unused_332 = FALSE; string gs_dummy_336; int gi_344; int gi_348; int gi_352 = 0; int gi_356 = 1; int gi_unused_360 = 3; int gi_364 = 250; string gs_368; bool gi_376; bool gi_380; bool gi_384; bool gi_388; int g_ticket_392; int g_cmd_396; string gs__hedged_400 = " hedged"; int g_file_408; void Log(string as_0) { if (g_file_408 >= 0) FileWrite(g_file_408, TimeToStr(TimeCurrent(), TIME_DATE|TIME_SECONDS) + ": " + as_0); } int GetLotDigits() { double ts_4 = MarketInfo(Symbol(), MODE_MINLOT); for (int count_0 = 0; ts_4 < 1.0; count_0++) ts_4 = 10.0 * ts_4; return (count_0); } double CalcLots(double a_minlot_0) { double minlot_32; double ld_8 = AccountEquity() - gi_200; double ld_16 = gi_204; double ld_24 = gi_208; if (gi_204 == 0 || gi_208 == 0) minlot_32 = a_minlot_0; else { ld_16 = gi_200 * ld_16 / 100.0; Print("tmp=" + ld_8 + ",AccountEquity()=" + AccountEquity() + ",InitEquity=" + gi_200); ld_24 /= 100.0; if (ld_8 > 0.0) ld_8 = MathPow(ld_24 + 1.0, ld_8 / ld_16); else { if (ld_8 < 0.0) ld_8 = MathPow(1 - ld_24, MathAbs(ld_8 / ld_16)); else ld_8 = 1; } minlot_32 = NormalizeDouble(a_minlot_0 * ld_8, GetLotDigits()); if (minlot_32 < MarketInfo(Symbol(), MODE_MINLOT)) minlot_32 = MarketInfo(Symbol(), MODE_MINLOT); } if (minlot_32 < 0.0) Print("ERROR tmp=" + ld_8 + ",a=" + ld_16 + ",b=" + ld_24 + ",AccountEquity()=" + AccountEquity()); Log("Equity=" + AccountEquity() + ",lots=" + minlot_32); return (minlot_32); } /* int f0_3(bool ai_0) { string ls_4; if (gi_344 == 0) { ls_4 = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)"; gi_344 = InternetOpenA(ls_4, gi_352, "0", "0", 0); gi_348 = InternetOpenA(ls_4, gi_356, "0", "0", 0); } if (ai_0) return (gi_348); return (gi_344); } int f0_4(string as_0, string &as_8) { int lia_24[] = {1}; string ls_28 = "x"; int li_16 = InternetOpenUrlA(f0_3(0), as_0, "0", 0, -2080374528, 0); if (li_16 == 0) return (0); int li_20 = InternetReadFile(li_16, ls_28, gi_364, lia_24); if (li_20 == 0) return (0); int li_36 = lia_24[0]; for (as_8 = StringSubstr(ls_28, 0, lia_24[0]); lia_24[0] != 0; as_8 = as_8 + StringSubstr(ls_28, 0, lia_24[0])) { li_20 = InternetReadFile(li_16, ls_28, gi_364, lia_24); if (lia_24[0] == 0) break; li_36 += lia_24[0]; } li_20 = InternetCloseHandle(li_16); if (li_20 == 0) return (0); return (1); } */ int deinit() { FileClose(g_file_408); return (0); } int init() { if (Digits == 3) { gd_124 = 10.0 * TakeProfit; gi_unused_132 = 10.0 * PipStarter; gi_136 = 10.0 * iStopLoss; g_point_320 = 0.01; } else { if (Digits == 5) { gd_124 = 10.0 * TakeProfit; gi_unused_132 = 10.0 * PipStarter; gi_136 = 10.0 * iStopLoss; g_point_320 = 0.0001; } else { gd_124 = TakeProfit; gi_unused_132 = PipStarter; gi_136 = iStopLoss; g_point_320 = Point; } } if (Digits == 3 || Digits == 5) { trendTrigger = 10 * trendTrigger; trendPips = 10 * trendPips; trendStoploss = 10 * trendStoploss; } gi_328 = MathRound((-MathLog(MarketInfo(Symbol(), MODE_LOTSTEP))) / 2.302585093); gi_376 = FALSE; gi_380 = FALSE; gi_384 = FALSE; gi_388 = FALSE; g_ticket_392 = -1; gi_252 = FALSE; g_file_408 = FileOpen(WindowExpertName() + "_" + Time[0] + "_" + Symbol() + "_" + MagicNumber + ".log", FILE_WRITE); g_cmd_396 = -1; /*if (IsDemo() == TRUE) */ gs_368 = "approved"; /* else { f0_4("http://www.forexhacked.com/query.php?accountnumber=" + AccountNumber() + "&login=" + User, gs_368); Print("init is done"); return (0); } */ return (0); } int IsTradeTime() { int li_8; if (DayOfWeek() < StartingTradeDay || DayOfWeek() > EndingTradeDay) return (0); int li_0 = 60 * TimeHour(TimeCurrent()) + TimeMinute(TimeCurrent()); int li_4 = 60 * StartHour + StartMinute; li_8 = 60 * StopHour + li_8; if (li_4 == li_8) return (1); if (li_4 < li_8) { if (!(li_0 >= li_4 && li_0 < li_8)) return (0); return (1); } if (li_4 > li_8) { if (!(li_0 >= li_4 || li_0 < li_8)) return (0); return (1); } return (0); } double GetLastLotSize(int ai_0) { for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) { if (OrderSelect(pos_4, SELECT_BY_POS)) { if (OrderMagicNumber() == MagicNumber) { if (StringFind(OrderComment(), gs__hedged_400) == -1) { Log("GetLastLotSize " + ai_0 + ",OrderLots()=" + OrderLots()); return (OrderLots()); } } } } Log("GetLastLotSize " + ai_0 + " wasnt found"); return (0); } bool OpenBuy(bool ai_0 = FALSE) { int ticket_4; double lots_40; double price_8 = 0; double price_16 = 0; string ls_24 = ""; bool li_ret_32 = TRUE; if (TimeCurrent() - g_datetime_316 < 60) return (0); if (ai_0 && (!gi_384)) return (0); if (!GlobalVariableCheck("PERMISSION")) { GlobalVariableSet("PERMISSION", TimeCurrent()); if (!SupportECN) { if (ai_0) { if (OrderSelect(g_ticket_392, SELECT_BY_TICKET)) price_16 = OrderTakeProfit() - MarketInfo(Symbol(), MODE_SPREAD) * Point; } else price_8 = Ask + gd_124 * Point; } if (ai_0) ls_24 = gs__hedged_400; if (AllowiStopLoss == TRUE) price_16 = Ask - gi_136 * Point; if (ai_0) lots_40 = NormalizeDouble(GetLastLotSize(1) * MassHedgeBooster, 2); else lots_40 = CalcLots(gd_236); if (!SupportECN) ticket_4 = OrderSend(Symbol(), OP_BUY, lots_40, Ask, slippage, price_16, price_8, EA_Name + ls_24, MagicNumber, 0, Green); else { ticket_4 = OrderSend(Symbol(), OP_BUY, lots_40, Ask, slippage, 0, 0, EA_Name + ls_24, MagicNumber, 0, Green); Sleep(1000); OrderModify(ticket_4, OrderOpenPrice(), price_16, price_8, 0, Black); } g_datetime_316 = TimeCurrent(); if (ticket_4 != -1) { if (!ai_0) { g_ticket_392 = ticket_4; Log("BUY hedgedTicket=" + g_ticket_392); } else { Log("BUY Hacked_ticket=" + ticket_4); g_cmd_396 = 0; } } else { Log("failed sell"); li_ret_32 = FALSE; } } GlobalVariableDel("PERMISSION"); return (li_ret_32); } bool OpenSell(bool ai_0 = FALSE) { int ticket_4; double lots_36; double price_8 = 0; double price_16 = 0; string ls_24 = ""; bool li_ret_32 = TRUE; if (TimeCurrent() - g_datetime_316 < 60) return (0); if (ai_0 && (!gi_388)) return (0); if (!GlobalVariableCheck("PERMISSION")) { GlobalVariableSet("PERMISSION", TimeCurrent()); if (!SupportECN) { if (ai_0) { if (OrderSelect(g_ticket_392, SELECT_BY_TICKET)) price_16 = OrderTakeProfit() + MarketInfo(Symbol(), MODE_SPREAD) * Point; } else price_8 = Bid - gd_124 * Point; } if (ai_0) ls_24 = gs__hedged_400; if (AllowiStopLoss == TRUE) price_16 = Bid + gi_136 * Point; if (ai_0) lots_36 = NormalizeDouble(GetLastLotSize(0) * MassHedgeBooster, 2); else lots_36 = CalcLots(gd_236); if (!SupportECN) ticket_4 = OrderSend(Symbol(), OP_SELL, lots_36, Bid, slippage, price_16, price_8, EA_Name + ls_24, MagicNumber, 0, Pink); else { ticket_4 = OrderSend(Symbol(), OP_SELL, lots_36, Bid, slippage, 0, 0, EA_Name + ls_24, MagicNumber, 0, Pink); Sleep(1000); OrderModify(ticket_4, OrderOpenPrice(), price_16, price_8, 0, Black); } g_datetime_316 = TimeCurrent(); if (ticket_4 != -1) { if (!ai_0) { g_ticket_392 = ticket_4; Log("SELL hedgedTicket=" + g_ticket_392); } else { Log("SELL Hacked_ticket=" + ticket_4); g_cmd_396 = 1; } } else { Log("failed sell"); li_ret_32 = FALSE; } } GlobalVariableDel("PERMISSION"); return (li_ret_32); } void ManageBuy() { int datetime_0 = 0; double order_open_price_4 = 0; double order_lots_12 = 0; double order_takeprofit_20 = 0; int cmd_28 = -1; int ticket_32 = 0; int pos_36 = 0; int count_40 = 0; for (pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == MagicNumber && OrderType() == OP_BUY) { count_40++; if (OrderOpenTime() > datetime_0) { datetime_0 = OrderOpenTime(); order_open_price_4 = OrderOpenPrice(); cmd_28 = OrderType(); ticket_32 = OrderTicket(); order_takeprofit_20 = OrderTakeProfit(); } if (OrderLots() > order_lots_12) order_lots_12 = OrderLots(); } } } int li_44 = MathRound(MathLog(order_lots_12 / Lots) / MathLog(Booster)) + 1.0; if (li_44 < 0) li_44 = 0; gd_236 = NormalizeDouble(Lots * MathPow(Booster, li_44), gi_328); if (li_44 == 0 && StrategySignal() == 1 && IsTradeTime()) { if (OpenBuy()) if (MassHedge) gi_376 = TRUE; } else { if (order_open_price_4 - Ask > PipStarter * g_point_320 && order_open_price_4 > 0.0 && count_40 < MaxBuyOrders) { if (!(OpenBuy())) return; if (!(MassHedge)) return; gi_376 = TRUE; return; } } for (pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES); if (OrderMagicNumber() != MagicNumber || OrderType() != OP_BUY || OrderTakeProfit() == order_takeprofit_20 || order_takeprofit_20 == 0.0) continue; OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), order_takeprofit_20, 0, Pink); Sleep(1000); } } int StrategySignal() { double isar_0 = iSAR(NULL, 0, gd_272, gd_280, 0); double ima_8 = iMA(NULL, 0, g_period_256, gi_260, g_ma_method_264, g_applied_price_268, 0); if (isar_0 > ima_8) return (-1); if (isar_0 < ima_8) return (1); return (0); } void ManageSell() { int datetime_0 = 0; double order_open_price_4 = 0; double order_lots_12 = 0; double order_takeprofit_20 = 0; int cmd_28 = -1; int ticket_32 = 0; int pos_36 = 0; int count_40 = 0; for (pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) { count_40++; if (OrderOpenTime() > datetime_0) { datetime_0 = OrderOpenTime(); order_open_price_4 = OrderOpenPrice(); cmd_28 = OrderType(); ticket_32 = OrderTicket(); order_takeprofit_20 = OrderTakeProfit(); } if (OrderLots() > order_lots_12) order_lots_12 = OrderLots(); } } } int li_44 = MathRound(MathLog(order_lots_12 / Lots) / MathLog(Booster)) + 1.0; if (li_44 < 0) li_44 = 0; gd_236 = NormalizeDouble(Lots * MathPow(Booster, li_44), gi_328); if (li_44 == 0 && StrategySignal() == -1 && IsTradeTime()) { if (OpenSell()) if (MassHedge) gi_380 = TRUE; } else { if (Bid - order_open_price_4 > PipStarter * g_point_320 && order_open_price_4 > 0.0 && count_40 < MaxSellOrders) { if (!(OpenSell())) return; if (!(MassHedge)) return; gi_380 = TRUE; return; } } for (pos_36 = 0; pos_36 < OrdersTotal(); pos_36++) { if (OrderSelect(pos_36, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == MagicNumber && OrderType() == OP_SELL) { if (OrderTakeProfit() == order_takeprofit_20 || order_takeprofit_20 == 0.0) continue; OrderModify(OrderTicket(), OrderOpenPrice(), OrderStopLoss(), order_takeprofit_20, 0, Pink); } } } } int start() { double order_takeprofit_20; double price_28; double price_36; /* if (gs_368 != "approved") { Comment("Access denied!", "\nMake you inputed your correct ForexHacked.com username into the EA paramaters", "\nMake sure you login to http://www.ForexHacked.com/membership/login.php and input your forex account number in your profile settings"); return (0); } */ if (allowTrending) { for (int pos_0 = 0; pos_0 < OrdersTotal(); pos_0++) { if (OrderSelect(pos_0, SELECT_BY_POS)) { if (MagicNumber == OrderMagicNumber()) { if (OrderType() == OP_BUY) if (OrderTakeProfit() - Bid <= trendTrigger * Point && Bid < OrderTakeProfit()) OrderModify(OrderTicket(), 0, Bid - trendStoploss * Point, OrderTakeProfit() + trendPips * Point, 0, White); if (OrderType() == OP_SELL) if (Ask - OrderTakeProfit() <= trendTrigger * Point && Ask > OrderTakeProfit()) OrderModify(OrderTicket(), 0, Ask + trendStoploss * Point, OrderTakeProfit() - trendPips * Point, 0, White); } } } } int count_4 = 0; int count_8 = 0; for (int pos_12 = 0; pos_12 < OrdersTotal(); pos_12++) { if (OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == MagicNumber) { if (StringFind(OrderComment(), gs__hedged_400) == -1) { if (OrderType() == OP_BUY) { count_4++; continue; } if (OrderType() == OP_SELL) count_8++; } } } } if (count_4 >= TradesDeep) { if (!gi_388) { Log("Allow long hedge! trades=" + count_4 + ",TradesDeep=" + TradesDeep); gi_388 = TRUE; } } if (count_8 >= TradesDeep) { if (!gi_384) { Log("Allow short hedge! trades=" + count_8 + ",TradesDeep=" + TradesDeep); gi_384 = TRUE; } } bool li_16 = FALSE; if ((100 - StopLossPct) * AccountBalance() / 100.0 >= AccountEquity()) { Log("AccountBalance=" + AccountBalance() + ",AccountEquity=" + AccountEquity()); gi_252 = TRUE; li_16 = TRUE; } if ((TakeProfitPct + 100.0) * AccountBalance() / 100.0 <= AccountEquity()) gi_252 = TRUE; if (gi_252) { for (pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) { if (OrderSelect(pos_0, SELECT_BY_POS)) { if (OrderMagicNumber() == MagicNumber) { Log("close #" + OrderTicket()); if (!OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), MarketInfo(Symbol(), MODE_SPREAD), White)) { Log("error"); return (0); } } } } gi_252 = FALSE; if (li_16) { Sleep(1000 * StoppedOutPause); li_16 = FALSE; } gi_388 = FALSE; gi_384 = FALSE; } if (SupportECN) { order_takeprofit_20 = 0; if (OrderSelect(g_ticket_392, SELECT_BY_TICKET)) order_takeprofit_20 = OrderTakeProfit(); for (pos_0 = 0; pos_0 < OrdersTotal(); pos_0++) { if (OrderSelect(pos_0, SELECT_BY_POS)) { if (OrderMagicNumber() == MagicNumber) { if (OrderTakeProfit() == 0.0 && StringFind(OrderComment(), gs__hedged_400) == -1) { if (OrderType() == OP_BUY) { OrderModify(OrderTicket(), 0, OrderStopLoss(), OrderOpenPrice() + gd_124 * Point, 0, White); continue; } if (OrderType() != OP_SELL) continue; OrderModify(OrderTicket(), 0, OrderStopLoss(), OrderOpenPrice() - gd_124 * Point, 0, White); continue; } if (StringFind(OrderComment(), gs__hedged_400) != -1 && g_cmd_396 == OrderType()) { price_28 = order_takeprofit_20 - MarketInfo(Symbol(), MODE_SPREAD) * Point; price_36 = order_takeprofit_20 + MarketInfo(Symbol(), MODE_SPREAD) * Point; if (OrderStopLoss() == 0.0 || (OrderType() == OP_BUY && OrderStopLoss() != price_28) || (OrderType() == OP_SELL && OrderStopLoss() != price_36)) { if (OrderType() == OP_BUY) { OrderModify(OrderTicket(), 0, price_28, OrderTakeProfit(), 0, White); continue; } if (OrderType() == OP_SELL) OrderModify(OrderTicket(), 0, price_36, OrderTakeProfit(), 0, White); } } } } } } if (Check() != 0) { ManageBuy(); ManageSell(); if ((!PauseNewTrades) && IsTradeTime()) { if (gi_380) if (OpenBuy(1)) gi_380 = FALSE; if (gi_376) if (OpenSell(1)) gi_376 = FALSE; } ChartComment(); return (0); } return (0); } void ChartComment() { string dbl2str_0 = DoubleToStr(balanceDeviation(2), 2); Comment(" \nForexHacked V2.4 Loaded Successfully锟?", "\nAccount Leverage : " + "1 : " + AccountLeverage(), "\nAccount Type : " + AccountServer(), "\nServer Time : " + TimeToStr(TimeCurrent(), TIME_SECONDS), "\nAccount Equity = ", AccountEquity(), "\nFree Margin = ", AccountFreeMargin(), "\nDrawdown : ", dbl2str_0, "%\n"); } int Check() { return (1); } double balanceDeviation(int ai_0) { double ld_ret_4; if (ai_0 == 2) { ld_ret_4 = (AccountEquity() / AccountBalance() - 1.0) / (-0.01); if (ld_ret_4 > 0.0) return (ld_ret_4); return (0); } if (ai_0 == 1) { ld_ret_4 = 100.0 * (AccountEquity() / AccountBalance() - 1.0); if (ld_ret_4 > 0.0) return (ld_ret_4); return (0); } return (0.0); }