#property copyright "Copyright 2009" #property link "www.miifx-ea.com" int gi_76 = 6678408; string gs_80 = "2009.10.30"; string gs_88 = "唯盛電子商務提醒您 系統即將到期 到期日:"; string gs_96 = "很抱歉 您的帳戶與此系統序號不符 請盡速與我們聯絡"; string gs_104 = "唯盛電子商務提醒您 您的自動交易系統已過期 請盡速與我們聯絡"; int g_magic_112 = 1010; extern double Lots = 0.1; extern bool Auto_Bet = TRUE; extern int Step_Percent = 20; int gi_132 = 49; double gd_136 = 0.1; extern double Stop_Loss = 95.0; extern double Take_Profit = 13.0; extern int S_Hour = 23; extern int E_Hour = 2; double g_period_168 = 11.0; double g_timeframe_176 = 5.0; double gd_184 = 30.5; double gd_192 = 69.5; double gd_200 = 35.0; double gd_208 = 65.0; bool gi_216 = TRUE; bool gi_220 = TRUE; int gi_224 = 5; int gi_228 = 25; int gi_232 = 2; bool g_bool_236 = FALSE; int isMgNum(int a_magic_0) { int l_ord_total_4 = OrdersTotal(); for (int l_pos_8 = 0; l_pos_8 < l_ord_total_4; l_pos_8++) { OrderSelect(l_pos_8, SELECT_BY_POS, MODE_TRADES); if (OrderMagicNumber() == a_magic_0 && OrderSymbol() == Symbol()) return (1); } return (0); } int init() { return (0); } int deinit() { return (0); } void NDrawLabel(string a_name_0, string a_text_8, int a_x_16, int a_y_20, string a_fontname_24 = "Arial", int a_fontsize_32 = 10, color a_color_36 = 16777215, int a_corner_40 = 2) { if (ObjectFind(a_name_0) < 0) { ObjectCreate(a_name_0, OBJ_LABEL, 0, 0, 0); ObjectSetText(a_name_0, a_text_8, a_fontsize_32, a_fontname_24, a_color_36); ObjectSet(a_name_0, OBJPROP_CORNER, a_corner_40); ObjectSet(a_name_0, OBJPROP_XDISTANCE, a_x_16); ObjectSet(a_name_0, OBJPROP_YDISTANCE, a_y_20); return; } ObjectSetText(a_name_0, a_text_8, a_fontsize_32, a_fontname_24, a_color_36); } int start() { double ld_0; if (StrToTime(gs_80) > TimeCurrent() && StrToTime(gs_80) - TimeCurrent() <= 604800) NDrawLabel("e.info", gs_88 + gs_80, 10, 20, "Arial", 20, White, 1); if (AccountNumber() != gi_76) { NDrawLabel("e.info", gs_96 + gi_76, 10, 20, "Arial", 20, White, 1); Comment(""); return (0); } if (TimeCurrent() >= StrToTime(gs_80)) { NDrawLabel("e.info", gs_104, 10, 20, "Arial", 20, White, 1); Comment(""); return (0); } if (AccountFreeMargin() < 1500.0 * ld_0) return (0); if (Auto_Bet) { if (Step_Percent > 0) Lots = NormalizeDouble(MathCeil(AccountFreeMargin() / 10000.0 * Step_Percent) / 10.0, 1); else Lots = Lots; } if (Lots < gd_136) Lots = gd_136; if (Lots > gi_132) Lots = gi_132; double l_irsi_16 = iRSI(NULL, g_timeframe_176, g_period_168, PRICE_CLOSE, 0); if (TimeHour(TimeCurrent()) == gi_224 && g_bool_236 == FALSE) CTP(); if (TimeHour(TimeCurrent()) != gi_224) g_bool_236 = FALSE; if (TimeHour(TimeCurrent()) <= S_Hour && TimeHour(TimeCurrent()) >= E_Hour) return (0); double ld_8 = NormalizeDouble(AccountFreeMargin() / 2500.0, 2); if (isMgNum(g_magic_112) == 0 && l_irsi_16 < gd_184) { if (gi_216) OrderSend(Symbol(), OP_BUY, Lots, Ask, 4, Ask - Stop_Loss * Point, Ask + Take_Profit * Point, 0, g_magic_112, 0, Green); gi_216 = FALSE; gi_220 = TRUE; } if (isMgNum(g_magic_112) == 0 && l_irsi_16 > gd_192) { if (gi_220) OrderSend(Symbol(), OP_SELL, Lots, Bid, 4, Bid + Stop_Loss * Point, Bid - Take_Profit * Point, 0, g_magic_112, 0, Red); gi_220 = FALSE; gi_216 = TRUE; } if (l_irsi_16 < gd_208 && l_irsi_16 > gd_200) { gi_220 = TRUE; gi_216 = TRUE; } return (0); } void CTP() { for (int l_pos_0 = 0; l_pos_0 < OrdersTotal(); l_pos_0++) { if (OrderSelect(l_pos_0, SELECT_BY_POS, MODE_TRADES) == FALSE) break; if (OrderType() == OP_BUY && OrderSymbol() == Symbol()) g_bool_236 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() - gi_228 * Point, OrderOpenPrice() + gi_232 * Point, 0, Green); if (OrderType() == OP_SELL && OrderSymbol() == Symbol()) g_bool_236 = OrderModify(OrderTicket(), OrderOpenPrice(), OrderOpenPrice() + gi_228 * Point, OrderOpenPrice() - gi_232 * Point, 0, Tan); } }