for multiple orders and closing (or other charts present,) you MUST COUNT DOWN
for(cnt=OrdersTotal()-1; cnt>=0;cnt++) if(
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES)
&& OrderSymbol() ==Symbol()
&& OrderMagicNumber()==MagicNumber){
if(OrderType()==OP_BUY) // long position is opened
{
// should it be closed?
}
if(OrderType()==OP_SELL) // go to short position
{
// should it be closed?
}
}
You MUST RefreshRates() between any two server calls. Between the OrderSend and each OrderClose
Hedging isn't allowed on US brokers. You MUST close the existing order BEFORE opening the opposite direction. Not to mention you're using twice margin.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
THANKS!!!!!!!!!!!!!!!!!!!
The problem has been solved finally. Thank you both very much really.
Abdull1996:
The problem has been solved finally. Thank you both very much really.