If there is an order meeting these conditions:
if((OrderSelect(k,SELECT_BY_POS,MODE_TRADES))&& OrderMagicNumber()==MagicNumber21 && OrderProfit() >= 38)
it will close the order selected here:
OrderSelect(i, SELECT_BY_POS);
Yes, phy is right, and you have to define exactly what is "k" and what is "i". If you want to close the order with magic MagicNumber21 and profit - OrderProfit, omit "OrderSelect(i, SELECT_BY_POS);"

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
}
IN THE CODE ABOVE, WILL THIS SELECT ONLY THE ORDER CORRESPONDING TO MAGICNUMBER21 OR WILL IT CLOSE ANY AND ALL BUYS/SELLS? COULD SOMEONE PLEASE CONFIRM THIS FOR ME!?? COULD SOMEONE EXPLAIN EXACTLY HOW THIS SEQUENCE WORKS?? I AM LOOKING TO TRY AND CLOSE THE ORDER WITH MAGICNUMBER 21 AND ANOTHER ORDER WITH A DIFFERENT MAGICNUMBER...ANY HAVE ANY GOOD IDEAS HERE? BASICALLY, WHEN THIS SECOND ORDER IS AT THIS PROFIT LEVEL, I AM BREAK EVEN ON BOTH OPEN ORDERS--YOU CAN SEE WHAT I AM TRYING TO ACCOMPLISH HERE RIGHT? ANY HELP WOULD BE GREATLY APPRECIATED!!! DANIEL