void closeallprofitable()
{
//---
Print("profit alert ea closed at "+DoubleToStr(profit,0)+" $");
if(!enablecloseall) {Alert("please enable close all");}
if(enablecloseall)
{
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if(OrderSelect(i, SELECT_BY_POS) == true)
if(OrderProfit() < minimumprofit) continue;
bool result = false;
if((OrderProfit() > minimumprofit) && OrderType() == OP_BUY)
{
OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
}
if((OrderProfit() > minimumprofit) && OrderType() == OP_SELL)
{
OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
}
}
}
}
//------
//------
void closeallprofitable()
{
//---
Print("profit alert ea closed at "+DoubleToStr(profit,0)+" $");
if(!enablecloseall) {Alert("please enable close all");}
if(enablecloseall)
{
int total = OrdersTotal();
for(int i=total-1;i>=0;i--)
{
if(OrderSelect(i, SELECT_BY_POS) == true)
if(OrderProfit() < minimumprofit) continue;
bool result = false;
if((OrderProfit() > minimumprofit) && OrderType() == OP_BUY)
{
result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_BID), 5, Red );
}
if((OrderProfit() > minimumprofit) && OrderType() == OP_SELL)
{
result = OrderClose( OrderTicket(), OrderLots(), MarketInfo(OrderSymbol(), MODE_ASK), 5, Red );
}
}
}
}
//------
//------