6601205058083:
If no open market orders, close all pending orders.
[...]
What should the script look like for: If no open orders, close all pending orders.
[...]
Yes, I want to make sure when any take profits or stop losses closed market orders, the pending orders get closed.
No problem, you asked: "What should the script look like for: If no open orders, close all pending orders." & i answered yes, only with a small change i add "market"
int openCount=0; for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderType() <= OP_SELL // Only open orders && OrderMagicNumber() == Magic.Number // my magic number && OrderSymbol() == Symbol() ){ // and period and symbol openCount++; } if (openCount == 0) for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if ( OrderSelect(pos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == Magic.Number // my magic number && OrderSymbol() == Symbol() ){ // and period and symbol OrderDelete(OrderTicket()); }
6601205058083:
Thanks a stack, nice of you to point me in the right direction.
Thanks a stack, nice of you to point me in the right direction.
point you in the right direction?
he wrote the whole code for you
You are right, thank you again for the help.
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
I am still working through the book, and try small tasks at a time. I would like to find out what the best way is to approach this.
What should the script look like for: If no open orders, close all pending orders.
Any help would be appreciated.
Marius