<code> if(OrderType()==OP_BUY && b==1 && tp==0)
{
//--- Выставляем стопы и тейки одиночным ордерам на покупку ---------
if(b==1 && tp==0)
{
sl=0; tp=0;
if(StopLoss>0)
sl=NormalizeDouble(Ask-StopLoss*Point(),Digits());
if(TakeProfit>0)
tp=NormalizeDouble(Ask+TakeProfit*Point(),Digits());
if(!OrderModify(tk,op,sl,tp,0,clrBlue))
Print("OrderModify error №1 #",GetLastError());
}
//--- Выставляем ТР крайних ордеров на покупку в безубыток + ---------
if(b>=CountAverage && (tk==BuyPriceMaxTic || tk==BuyPriceMinTic))
if(Bid<AverageBuyPrice && tp!=AverageBuyPrice)
if(!OrderModify(tk,op,OrderStopLoss(),AverageBuyPrice,0,clrBlue))
Print("OrderModify error №3 #",GetLastError());
//--------- Восстановление ТР не крайним ордерам OP_BUY --------------
if(tk != BuyPriceMinTic && tk != BuyPriceMaxTic)
if(tp!= NormalizeDouble (op + TakeProfit * Point(), Digits()))
if(!OrderModify(tk, op, OrderStopLoss(), NormalizeDouble (op + TakeProfit * Point(), Digits()), 0, clrBlue))
Print("OrderModify error №5 #", GetLastError());
}
//---------------------------------------------------------------------
</code><code>string txt,symbol ;
int slippage, StopLevel, digits;
double pnt, sl$, tp$;
//+----------------------------------------------------------------------------+
int init()
{
symbol = Symbol();
pnt = SymbolInfoDouble(symbol,SYMBOL_POINT);
StopLevel = (int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL);
digits = (int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);
sl$ = SL*Point;
tp$ = TP*Point;
OpenOrder (OP_BUY, Ask);
OpenOrder (OP_SELL, Bid);
return(0);
}
//+----------------------------------------------------------------------------+
int start()
{
=Ask;
=Bid;
return(0);
}
//+------------------------------------------------------------------+
</code>
Да. И что за кем здесь тогда тянется? Тянучка же.
kvashnin007