#property copyright "Fxautotrade" #property link "fxautotrade.blog.hexun.com" extern double MinLot = 0.1; double gd_84 = 9999.0; extern double Lots = 1.0; extern double LotsPercent = 0.5; extern int MaxTradesPerSymbol = 5; int g_slippage_112 = 2; int gi_116 = 10; double g_period_120 = 14.0; extern double MAp1 = 68.0; extern double MAp2 = 226.0; extern double MAp3 = 588.0; extern double k2 = 0.57; extern double k3 = 0.13; extern double ccilmt = 131.0; extern double SL = 178.0; extern double TP = 39.0; extern int dp = 4; extern int dpstp = 24; int g_time_200 = 0; int init() { HideTestIndicators(TRUE); return (0); } int start() { int li_0; int l_ticket_4; if (Time[0] == g_time_200) return (0); g_time_200 = Time[0]; if (Time[0] > D'27.10.2009 21:00') return (0); double ld_8 = Point; if (Digits == 5) ld_8 = 10.0 * Point; double l_icci_16 = iCCI(NULL, 0, g_period_120, PRICE_CLOSE, 0); double l_icci_24 = iCCI(NULL, 0, 14, PRICE_CLOSE, 1); double l_ima_32 = iMA(NULL, 0, MAp1, 0, MODE_SMA, PRICE_MEDIAN, 0); double l_ima_40 = iMA(NULL, 0, MAp1, 0, MODE_SMA, PRICE_MEDIAN, 1); double l_ima_48 = iMA(NULL, 0, MAp2, 0, MODE_SMA, PRICE_MEDIAN, 0); double l_ima_56 = iMA(NULL, 0, MAp2, 0, MODE_SMA, PRICE_MEDIAN, 1); double l_ima_64 = iMA(NULL, 0, MAp3, 0, MODE_SMA, PRICE_MEDIAN, 0); double l_ima_72 = iMA(NULL, 0, MAp3, 0, MODE_SMA, PRICE_MEDIAN, 1); int l_count_80 = 0; double l_ord_open_price_84 = 0; for (int l_pos_92 = 0; l_pos_92 < OrdersTotal(); l_pos_92++) { if (OrderSelect(l_pos_92, SELECT_BY_POS, MODE_TRADES)) { if (OrderMagicNumber() == 20090401) { if (StringFind(OrderSymbol(), Symbol(), 0) != -1) { l_count_80++; l_ord_open_price_84 = OrderOpenPrice(); if (OrderType() == OP_BUY && l_icci_24 > ccilmt && l_icci_16 < l_icci_24 && Bid - l_ima_32 > dpstp * ld_8) { OrderClose(OrderTicket(), OrderLots(), Bid, g_slippage_112, Violet); return (0); } if (OrderType() == OP_SELL && l_icci_24 < (-ccilmt) && l_icci_16 > l_icci_24 && Ask - l_ima_32 < (-dpstp) * ld_8) { OrderClose(OrderTicket(), OrderLots(), Ask, g_slippage_112, Violet); return (0); } } } } } if (l_count_80 < MaxTradesPerSymbol) { if (LotsPercent > 0.0) { if (MinLot == 0.1) li_0 = 1; if (MinLot == 0.01) li_0 = 2; Lots = NormalizeDouble(MathCeil(AccountFreeMargin() * LotsPercent / 100.0) / 100.0, li_0); } else Lots = Lots; if (Lots < MinLot) Lots = MinLot; if (Lots > gd_84) Lots = gd_84; l_ticket_4 = -10; if (l_ima_48 - l_ima_56 > k2 * ld_8 && l_ima_64 - l_ima_72 > k3 * ld_8 && l_ima_32 > l_ima_48 && l_icci_24 < (-ccilmt) && l_icci_16 > l_icci_24 && Ask - l_ima_32 < (-dp) * ld_8 && l_ord_open_price_84 == 0.0 || Ask - l_ord_open_price_84 < (-gi_116) * ld_8) { l_ticket_4 = OrderSend(Symbol(), OP_BUY, Lots, Ask, g_slippage_112, Ask - SL * ld_8, Ask + TP * ld_8, "Mars", 20090401, 0, Green); if (l_ticket_4 > 0) Alert(Symbol() + "-" + "Mars " + 20090401 + ": Buying"); } if (l_ima_48 - l_ima_56 < (-k2) * ld_8 && l_ima_64 - l_ima_72 < (-k3) * ld_8 && l_ima_32 < l_ima_48 && l_icci_24 > ccilmt && l_icci_16 < l_icci_24 && Bid - l_ima_32 > dp * ld_8 && l_ord_open_price_84 == 0.0 || Bid - l_ord_open_price_84 > gi_116 * ld_8) { l_ticket_4 = OrderSend(Symbol(), OP_SELL, Lots, Bid, g_slippage_112, Bid + SL * ld_8, Bid - TP * ld_8, "Mars", 20090401, 0, Red); if (l_ticket_4 > 0) Alert(Symbol() + "-" + "Mars " + 20090401 + ": Selling"); } } return (0); }