I want check that exist order pending for GBPJPY

 
I want check that exist order pending for GBPJPY
Thank you
 
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 !.
 
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
Reason: