iType = OP_SELL; sType = "SELL"; dPrice = Ask;
бла-бла-бла
if(OrderProfit() < 0 && OrderType() == iType)
{
iProfit = OrderProfit()/(dRx*OrderLots()*MarketInfo(_Symbol, MODE_TICKVALUE));
if(iProfit + Stop*dATR/Point < 0 && dProfit*dRx + OrderProfit() > 0)
{
fClose = OrderClose(OrderTicket(), OrderLots(), dPrice, iPips, clrNONE);
if(fClose)
{
Comment("Epic Fail: ", OrderComment(), "\nwith ", _Symbol, "/", sType, "\nLoss: ", OrderProfit(),
"$ R", DoubleToStr(dATR/Point, 0), "\n", TimeToStr(TimeLocal(),TIME_MINUTES));
return(fClose);
} else {
int err = GetLastError();
Print("error(",err,"): ", ErrorDescription(err), " #", OrderTicket(), " ", OrderComment());
}
}
}