О… Умный, но не разумный.
Русский человек — это человек, знающий русский, его носитель.
Тут форум где все топики исключительно на русском, следовательно форум русский.
Для тех кто не знает русский, пусть изучают русский.
void Trall()
{
for(int i=OrdersTotal()-1; i>=0; i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)
{
if(OrderType()==OP_BUY )
{
if(TrailingStop>0)
{
if(Bid-FindLastBuyPrice()>Point*TrailingStop)
{
if(OrderStopLoss()<Bid-Point*TrailingStop)
{
//--- modify order and exit
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green))
Print("OrderModify error ",GetLastError());
return;
}
}
}
}
if(OrderType()==OP_SELL )
{
if(TrailingStop>0)
{
if((FindLastSellPrice()-Ask)>(Point*TrailingStop))
{
if((OrderStopLoss()>(Ask+Point*TrailingStop)) || (OrderStopLoss()==0))
{
//--- modify order and exit
if(!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point*TrailingStop,OrderTakeProfit(),0,Red))
Print("OrderModify error ",GetLastError());
return;
}
}
}
}
}
}
}
}
double FindLastBuyPrice()
{
int oticket=0;double buy=0;
double oprice=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType()==OP_BUY)
{
oticket++;
buy+=OrderOpenPrice();
}
}
}
if(oticket!=0)oprice = buy/oticket;
return(oprice);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
double FindLastSellPrice()
{
int oticket=0;double sell=0;
double oprice=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic && OrderType()==OP_SELL)
{
oticket++;
sell+=OrderOpenPrice();
}
}
}
if(oticket!=0) oprice = sell/oticket;
return(oprice);
}
if((FindLastSellPrice()-Ask)/Point*CountTrades()>=Take || (FindLastSellPrice()-Ask)/Point*CountTrades()<-Stop) CloseAll();//{CloseOpenPos(0);CloseOpenPos(1);}
if((Bid-FindLastBuyPrice())/Point*CountTrades()>=Take || (Bid-FindLastBuyPrice())/Point*CountTrades()<-Stop) CloseAll();//{CloseOpenPos(0);CloseOpenPos(1);}
axe44