pek4christ / Profil
![pek4christ](https://c.mql5.com/avatar/2014/9/542ACDBD-E0C6.jpg)
pek4christ
Please can any one help me out... I made a fuction in an EA that is surpose to close only all profit trades at a certain profit, But its closing both profit and loss trade Here is the Function:
void CloseOrderBuy() {
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumberSeries)
{
if (OrderType() == OP_BUY)
{
bool CloseOrder=(OrderClose(OrderTicket(),OrderLots(),Bid,3,0));
}
}
}
}
}
I will really appreciate your responds... Thanks in advace.
void CloseOrderBuy() {
for (int i = OrdersTotal() - 1; i >= 0; i--) {
if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumberSeries)
{
if (OrderType() == OP_BUY)
{
bool CloseOrder=(OrderClose(OrderTicket(),OrderLots(),Bid,3,0));
}
}
}
}
}
I will really appreciate your responds... Thanks in advace.
![Oksana Berenko Oksana Berenko](https://c.mql5.com/avatar/2016/10/57FFA103-4FB8.jpg)
Oksana Berenko
2018.02.22
if(OrderProfit()>0) {close}
: