sammy Posted March 31, 2013 Report Posted March 31, 2013 Enjoy................ http://gfile.ru/aEjC megatron1713006019, energetic, crodzilla and 2 others 5 Quote
Ranesh Posted April 14, 2013 Report Posted April 14, 2013 //#include <stdlib.mqh> #import "stdlib.ex4" string ErrorDescription(int a0); #import extern int OpenOrdersLimit33 = 3; extern double BuyLots45 = 0.1; extern int BuySlippage45 = 2; extern int BuyStoploss45 = 0; extern int BuyTakeprofit45 = 20; extern int PriceOffset45 = 20; extern int Expiration45 = 240; extern int OpenOrdersLimit22 = 3; extern double SellLots46 = 0.1; extern int SellSlippage46 = 2; extern int SellStoploss46 = 0; extern int SellTakeprofit46 = 30; extern int PriceOffset46 = 20; extern int Expiration46 = 240; double gd_140 = 1.0; bool gi_148 = FALSE; string gs_unused_152 = "\n"; int g_digits_160 = 4; int gi_unused_164 = 0; int gi_unused_168 = 0; extern bool Op_Buy = TRUE; extern bool Op_Sell = TRUE; double gd_180 = 0.002; int g_time_188 = 0; int gi_192 = 0; int init() { g_digits_160 = Digits; Comment(""); return (0); } int start() { if (Bars < 10) { Comment("Not enough bars"); return (0); } if (gi_148 == TRUE) { Comment("EA Terminated."); return (0); } f0_16(); return (0); } void f0_16() { if (g_digits_160 == 3 || g_digits_160 == 5 && 1) gd_140 = 10; f0_2(); f0_21(); f0_12(); f0_1(); } void f0_2() { f0_19(); } void f0_19() { if (g_time_188 < Time[0]) { g_time_188 = Time[0]; f0_6(); f0_8(); } } void f0_6() { if (iMA(NULL, 0, 20, 0, MODE_LWMA, PRICE_CLOSE, 0) < iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0) && Close[0] < Close[1]) f0_22(); } void f0_22() { if (iCustom(NULL, 0, "Support & Resistance", 0, 1) - iCustom(NULL, 0, "Support & Resistance", 1, 1) < gd_180) { f0_5(); f0_9(); } } void f0_5() { if (Op_Buy == TRUE) f0_0(); } void f0_0() { int count_0 = 0; for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) { if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) if (OrderMagicNumber() == 1) count_0++; } else Print("OrderSend() error - ", ErrorDescription(GetLastError())); } if (count_0 < OpenOrdersLimit33) f0_17(); } void f0_17() { int is_deleted_4; for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) { if (OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUYSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == 2) { is_deleted_4 = OrderDelete(OrderTicket(), Yellow); if (is_deleted_4 == 0) Print("OrderDelete() error - ", ErrorDescription(GetLastError())); } } } f0_13(); } void f0_13() { int datetime_0 = TimeCurrent() + 60 * Expiration45; double price_4 = NormalizeDouble(Ask, g_digits_160) + PriceOffset45 * gd_140 * Point; double price_12 = price_4 - BuyStoploss45 * gd_140 * Point; if (BuyStoploss45 == 0) price_12 = 0; double price_20 = price_4 + BuyTakeprofit45 * gd_140 * Point; if (BuyTakeprofit45 == 0) price_20 = 0; if (Expiration45 == 0) datetime_0 = 0; int ticket_28 = OrderSend(Symbol(), OP_BUYSTOP, BuyLots45, price_4, BuySlippage45, price_12, price_20, "vol_pips", 2, datetime_0, Blue); if (ticket_28 == -1) Print("OrderSend() error - ", ErrorDescription(GetLastError())); } void f0_9() { if (Op_Sell == TRUE) f0_14(); } void f0_14() { int count_0 = 0; for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) { if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderSymbol() == Symbol()) if (OrderMagicNumber() == 2) count_0++; } else Print("OrderSend() error - ", ErrorDescription(GetLastError())); } if (count_0 < OpenOrdersLimit22) f0_11(); } void f0_11() { int is_deleted_4; for (int pos_0 = OrdersTotal() - 1; pos_0 >= 0; pos_0--) { if (OrderSelect(pos_0, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELLSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { is_deleted_4 = OrderDelete(OrderTicket(), White); if (is_deleted_4 == 0) Print("OrderDelete() error - ", ErrorDescription(GetLastError())); } } } f0_18(); } void f0_18() { int datetime_0 = TimeCurrent() + 60 * Expiration46; double price_4 = NormalizeDouble(Bid, g_digits_160) - PriceOffset46 * gd_140 * Point; double price_12 = price_4 + SellStoploss46 * gd_140 * Point; if (SellStoploss46 == 0) price_12 = 0; double price_20 = price_4 - SellTakeprofit46 * gd_140 * Point; if (SellTakeprofit46 == 0) price_20 = 0; if (Expiration46 == 0) datetime_0 = 0; int ticket_28 = OrderSend(Symbol(), OP_SELLSTOP, SellLots46, price_4, SellSlippage46, price_12, price_20, "vol_pips", 1, datetime_0, Red); if (ticket_28 == -1) Print("OrderSend() error - ", ErrorDescription(GetLastError())); } void f0_8() { if (iMA(NULL, 0, 20, 0, MODE_LWMA, PRICE_CLOSE, 0) > iMA(NULL, 0, 20, 0, MODE_EMA, PRICE_CLOSE, 0) && Close[0] > Close[1]) f0_22(); } void f0_21() { string ls_0 = "\nExecuted : " + gi_192 + "\n" + "Spread: " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD) / gd_140, 2) + "\n" + "------------------------------------------------\n" + "ACCOUNT INFORMATION:\n" + "\n" + "Account Name: " + AccountName() + "\n" + "Account Leverage: 1:" + DoubleToStr(AccountLeverage(), 0) + "\n" + "Account Balance: " + DoubleToStr(AccountBalance(), 2) + "\n" + "Account Equity: " + DoubleToStr(AccountEquity(), 2) + "\n" + "Free Margin: " + DoubleToStr(AccountFreeMargin(), 2) + "\n" + "Used Margin: " + DoubleToStr(AccountMargin(), 2) + "\n" + "------------------------------------------------\n"; Comment(ls_0); gi_192++; } void f0_12() { if (Open[1] > Close[1]) f0_7(); } void f0_7() { bool li_0 = FALSE; for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) { if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2) li_0 = TRUE; } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (li_0) f0_10(); } void f0_10() { double ld_0 = 0; for (int pos_8 = OrdersTotal() - 1; pos_8 >= 0; pos_8--) { if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) { if ((OrderType() == OP_BUY && OrderSymbol() == Symbol() && OrderMagicNumber() == 2) || 0) ld_0 += OrderProfit(); } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (ld_0 > 0.0) f0_4(); } void f0_4() { int lia_8[30][2]; int is_closed_16; int order_total_0 = OrdersTotal(); int li_4 = 0; for (int pos_12 = 0; pos_12 < order_total_0; pos_12++) { OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_BUY || OrderSymbol() != Symbol() || OrderMagicNumber() != 2) continue; lia_8[li_4][0] = OrderOpenTime(); lia_8[li_4][1] = OrderTicket(); li_4++; } if (li_4 > 1) { ArrayResize(lia_8, li_4); ArraySort(lia_8); } for (pos_12 = 0; pos_12 < li_4; pos_12++) { if (OrderSelect(lia_8[pos_12][1], SELECT_BY_TICKET) == TRUE) { is_closed_16 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 1, Green); if (is_closed_16 == 0) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } void f0_1() { if (Open[1] < Close[1]) f0_15(); } void f0_15() { bool li_0 = FALSE; for (int pos_4 = OrdersTotal() - 1; pos_4 >= 0; pos_4--) { if (OrderSelect(pos_4, SELECT_BY_POS, MODE_TRADES)) { if (OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) li_0 = TRUE; } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (li_0) f0_20(); } void f0_20() { double ld_0 = 0; for (int pos_8 = OrdersTotal() - 1; pos_8 >= 0; pos_8--) { if (OrderSelect(pos_8, SELECT_BY_POS, MODE_TRADES)) { if ((OrderType() == OP_SELL && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) || 0) ld_0 += OrderProfit(); } else Print("OrderSelect() error - ", ErrorDescription(GetLastError())); } if (ld_0 > 0.0) f0_3(); } void f0_3() { int lia_8[30][2]; int is_closed_16; int order_total_0 = OrdersTotal(); int li_4 = 0; for (int pos_12 = 0; pos_12 < order_total_0; pos_12++) { OrderSelect(pos_12, SELECT_BY_POS, MODE_TRADES); if (OrderType() != OP_SELL || OrderSymbol() != Symbol() || OrderMagicNumber() != 1) continue; lia_8[li_4][0] = OrderOpenTime(); lia_8[li_4][1] = OrderTicket(); li_4++; } if (li_4 > 1) { ArrayResize(lia_8, li_4); ArraySort(lia_8); } for (pos_12 = 0; pos_12 < li_4; pos_12++) { if (OrderSelect(lia_8[pos_12][1], SELECT_BY_TICKET) == TRUE) { is_closed_16 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 1, Green); if (is_closed_16 == 0) Print("OrderClose() error - ", ErrorDescription(GetLastError())); } } } int deinit() { return (0); } Quote
Ranesh Posted April 14, 2013 Report Posted April 14, 2013 Moving average and S/R indicator. good luck Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.