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.
chk_buy=0; chk_sell=0;
int totalorders = OrdersTotal();
for(int i=0;i<totalorders;i++)
{
OrderSelect(i, SELECT_BY_POS);
if ( OrderSymbol()==Symbol())
{ if ( (OrderType()==OP_BUY ||OrderType()==OP_BUYLIMIT) && OrderOpenPrice()==buy_order) chk_buy=1;
if ( (OrderType()==OP_SELL||OrderType()==OP_SELLLIMIT)&& OrderOpenPrice()==sell_order) chk_sell=1;
}
}
/////////////////////////////////////////////////////////
What's wrong with my script? I don't want the expert to buy or sell at levels which already have open position, and it doesn't seem to work. Anyone?