<code> int OnInit() { //--- if(Digits==3 || Digits==5) { TakeProfit*=10; StopLoss*=10; TrailingStop*=10; Step*=10; TrailingMStop*=10; BUPoint*=10; BULevel*=10; Slip*=10; Spred*=10; //OneStep*=10; }return(INIT_SUCCEEDED); } </code>
void Trailing()
{
tikB=Bid;
tikA=Ask;
for( i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY)
{
if(OrderOpenPrice()<(tikB-TrailingStop*Point-BUPoint*Point)&&OrderStopLoss()<(tikB-TrailingStop*Point-BUPoint*Point))
{
mod=OrderModify(OrderTicket(),OrderOpenPrice(),tikB-TrailingStop*Point,OrderTakeProfit(),0,Green);
}}
if(OrderType()==OP_SELL)
{
if(OrderStopLoss()>(tikA+TrailingStop*Point+BUPoint*Point)&&OrderOpenPrice()>(tikA+TrailingStop*Point+BUPoint*Point))//
{
mod=OrderModify(OrderTicket(),OrderOpenPrice(),tikA+TrailingStop*Point,OrderTakeProfit(),0,Green);
}
}
}
}
}
return; }
axe44