Download MetaTrader 5

I want check that exist order pending for GBPJPY

To add comments, please log in or register
Log in to MQL5.community using OpenID. It is convenient!
Tiago Cetto Pietralonga
458
Tiago Cetto Pietralonga 2016.07.12 22:10 
I want check that exist order pending for GBPJPY
Thank you
Osama Shaban
1448
Osama Shaban 2016.07.12 23:13  
bool ExistGBPJPYPosition() {
        for (int i=0; i<OrdersTotal(); i++) {
                if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
                        if (OrderSymbol()=="GBPJPY" && OrderMagicNumber()==MagicNo) {
                                return(True);
                        }
                } 
        } 
        return(false);
}
This is the main code you need. You have to do minor changes to fit your code/need !.
Tiago Cetto Pietralonga
458
Tiago Cetto Pietralonga 2016.07.12 23:39  
Osama Shaban:
This is the main code you need. You have to do minor changes to fit your code/need !.
Thank you, it's working
To add comments, please log in or register