Created
July 7, 2012 04:39
-
-
Save currencysecrets/3064731 to your computer and use it in GitHub Desktop.
MQL4: Check Manually Entered Pending Orders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this procedure checks all manually placed orders | |
void checkManualOrders() { | |
for ( int i = 0; i < OrdersTotal(); i++ ) { | |
if ( OrderSelect(i, SELECT_BY_POS, MODE_TRADES) ) { | |
// the assumption will be that new manually placed pending orders have a MagicNumber of 0 | |
// check with your MT4 broker that they allow MagicNumbers, some brokers do NOT! | |
// if your broker doesn't then you'll have to remove "OrderMagicNumer() == 0 &&" | |
if ( OrderMagicNumber() == 0 && OrderCloseTime() == 0 ) { | |
if ( OP_BUYLIMIT || OP_BUYSTOP || OP_SELLLIMIT || OP_SELLSTOP ) { | |
// okay you're now here on an active PENDING order, what do you want to do? | |
} else if ( OP_BUY || OP_SELL ) { | |
// okay you're now here on active OPEN orders | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment