Function to continually close positions per ticket per conditions New comment Vantages 2015.01.16 10:34 Hello. With my multi currency EA, 15 symbols and 100s of open positions all the time,which is better to use to continually closes position/s per ticket per 1-2 conditions:1. Should I use > " while " ;2. Or just simply use the code below ( But, it is not properly working when positions are more than 50 deals ?Thanks.//-------------------------------------------------------------------+// Close at profit Function |//-------------------------------------------------------------------+ void CloseatProfit( string Symb ) { total = OrdersTotal(); int ticket = 0; if(OrdersTotal() < 1) return; for( int cnt = total-1; cnt >= 0; cnt-- ) { if ( OrderSelect( cnt, SELECT_BY_POS, MODE_TRADES )) { if ( OrderSymbol() == Symb && OrderProfit() > 1 ) { if ( OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), 10, clrNONE ) ) Print("Close order success"); else Print( "Close order failed"); } } } } EA function not working properly Opinion,suggestions _EA function Limiting one entry per pair New comment
Hello.
With my multi currency EA, 15 symbols and 100s of open positions all the time,
which is better to use to continually closes position/s per ticket per 1-2 conditions:
1. Should I use > " while " ;
2. Or just simply use the code below ( But, it is not properly working
when positions are more than 50 deals ?
Thanks.
//-------------------------------------------------------------------+
// Close at profit Function |//-------------------------------------------------------------------+
void CloseatProfit( string Symb )
{
total = OrdersTotal();
int ticket = 0;
if(OrdersTotal() < 1) return;
for( int cnt = total-1; cnt >= 0; cnt-- )
{
if ( OrderSelect( cnt, SELECT_BY_POS, MODE_TRADES ))
{
if ( OrderSymbol() == Symb && OrderProfit() > 1 )
{
if ( OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(), 10, clrNONE ) ) Print("Close order success");
else Print( "Close order failed");
}
}
}
}