#property copyright "indrafx_scalping™ THE BEST EGEC" #property link "http://mediacakrawala.com" extern int TakeProfit = 5; extern int StopLoss = 29; extern int Distan = 2; extern int Cls = 2; extern int period_MA = 16; extern int Prots = 30; int g_ticket_100; int g_ticket_104; int g_ord_total_108; int gi_112 = 0; int gi_116 = 0; int gi_120 = 0; int gi_124 = 0; double g_price_128; double gd_136; double gd_144; double gd_152; double gd_160; double gd_168; double gd_176; double gd_184; double g_ima_192; double gd_200; double g_minlot_208; void init() { gd_160 = MarketInfo(Symbol(), MODE_STOPLEVEL); gd_160 = (gd_160 + 1.0) * Point; gd_136 = StopLoss * Point; gd_144 = TakeProfit * Point; gd_152 = Distan * Point; gd_184 = Cls * Point; gd_200 = Ask - Bid; } int start() { bool l_bool_0 = IsDemo(); if (!l_bool_0) { Alert("You cannot use this program with real account!"); return (0); } g_ord_total_108 = OrdersTotal(); gi_112 = FALSE; gi_116 = FALSE; gi_120 = FALSE; gi_124 = FALSE; for (int l_ord_total_4 = g_ord_total_108; l_ord_total_4 >= 0; l_ord_total_4--) { if (OrderSelect(l_ord_total_4, SELECT_BY_POS) == TRUE && OrderSymbol() == Symbol()) { if (OrderType() == OP_BUY) { gi_120 = TRUE; Close_B(OrderTicket(), OrderLots()); } if (OrderType() == OP_SELL) { gi_124 = TRUE; Close_S(OrderTicket(), OrderLots()); } if (OrderType() == OP_BUYLIMIT) { gd_168 = NormalizeDouble(OrderOpenPrice(), Digits); g_ticket_100 = OrderTicket(); gi_112 = TRUE; } if (OrderType() == OP_SELLLIMIT) { gd_176 = NormalizeDouble(OrderOpenPrice(), Digits); g_ticket_104 = OrderTicket(); gi_116 = TRUE; } } } g_ima_192 = iMA(NULL, 0, period_MA, 0, MODE_LWMA, PRICE_TYPICAL, 0); Modify_order(); Open_order(); return/*(WARN)*/; } void Close_B(int a_ticket_0, double a_lots_4) { if (NormalizeDouble(Bid - OrderOpenPrice(), Digits) >= gd_184) { OrderClose(a_ticket_0, a_lots_4, Bid, 1, Yellow); gi_120 = FALSE; } } void Close_S(int a_ticket_0, double a_lots_4) { if (NormalizeDouble(OrderOpenPrice() - Ask, Digits) >= gd_184) { OrderClose(a_ticket_0, a_lots_4, Ask, 1, Yellow); gi_124 = FALSE; } } void Modify_order() { if (gi_112 == TRUE) { g_price_128 = g_ima_192 - gd_152; if (MathAbs(gd_168 - g_price_128) > Point / 2.0) OrderModify(g_ticket_100, g_price_128, g_price_128 - gd_136, g_price_128 + gd_144, 0, DeepSkyBlue); } if (gi_116 == TRUE) { g_price_128 = g_ima_192 + gd_200 + gd_152; if (MathAbs(gd_176 - g_price_128) > Point / 2.0) OrderModify(g_ticket_104, g_price_128, g_price_128 + gd_136, g_price_128 - gd_144, 0, Pink); } } void Open_order() { if (gi_120 == FALSE && gi_112 == FALSE) { g_price_128 = g_ima_192 - gd_152; if (g_price_128 > Ask - gd_160) g_price_128 = Ask - gd_160; g_price_128 = NormalizeDouble(g_price_128, Digits); OrderSend(Symbol(), OP_BUYLIMIT, Lots(), g_price_128, 3, g_price_128 - gd_136, g_price_128 + gd_144, "indrafxs", 0, 0, Blue); gi_112 = TRUE; } if (gi_124 == FALSE && gi_116 == FALSE) { g_price_128 = g_ima_192 + gd_200 + gd_152; if (g_price_128 < Bid + gd_160) g_price_128 = Bid + gd_160; g_price_128 = NormalizeDouble(g_price_128, Digits); OrderSend(Symbol(), OP_SELLLIMIT, Lots(), g_price_128, 3, g_price_128 + gd_136, g_price_128 - gd_144, "indrafxs", 0, 0, Red); gi_116 = TRUE; } } double Lots() { g_minlot_208 = NormalizeDouble(AccountEquity() * Prots / 100.0 / 1000.0, 1); double l_minlot_0 = MarketInfo(Symbol(), MODE_MINLOT); if (g_minlot_208 == 0.0) g_minlot_208 = l_minlot_0; return (g_minlot_208); }