//|----------------------------------- //| Copyright © 2013 smart_man (www.forum.mql4.com) //|----------------------------------- double VOLUME = 0.01; double STEP = 0.00100; int MAGIC = 397106634; //int CMD = OP_SELL; double SPREAD = 0.00005; //|----------------------------------- //| expert initialization function //|----------------------------------- int init() { return(0); } //|----------------------------------- //| expert deinitialization function //|----------------------------------- int deinit() { return(0); } //|----------------------------------- //| expert start function //|----------------------------------- int start() { int fg = 1; // флаг string command = ""; // команда на открытие ордера (SELL или BUY) double lots = 0; // объем открываемого ордера (например, 0.01) string comment = ""; //|----------------------------------- //| Определение существования начатого цикла //|----------------------------------- int i; for (i=0; i max) { max = StrToInteger(OrderComment()); ot = OrderType(); lo = OrderLots(); op = OrderOpenPrice(); tp = OrderTakeProfit(); co = OrderComment(); } } else if (OrderType() == OP_BUYLIMIT || OrderType() == OP_SELLLIMIT) { // если отложенный fg2 = 0; } } } } if (fg2 == 1) { // если отложенного нет, то создать его и модифицировать TP всех предыдущих if (ot == OP_BUY) { OrderSend( Symbol(), OP_BUYLIMIT, lo*2, op - NormalizeDouble(STEP, Digits) - NormalizeDouble(SPREAD, Digits), 3, 0, //Bid - NormalizeDouble(STEP - 0.00020, Digits), tp - NormalizeDouble(STEP, Digits), DoubleToStr(StrToInteger(co)+1, 0), MAGIC ); } else if (ot == OP_SELL) { OrderSend( Symbol(), OP_SELLLIMIT, lo*2, op + NormalizeDouble(STEP, Digits) + NormalizeDouble(SPREAD, Digits), 3, 0, //Bid - NormalizeDouble(STEP - 0.00020, Digits), tp + NormalizeDouble(STEP, Digits), DoubleToStr(StrToInteger(co)+1, 0), MAGIC ); } if (OrdersTotal() > 2) { for (i=0; i