- CTrade
- Pending orders execution
- Close pending order when there's no open order
You set exists=true when you find it, but then you keep selecting other orders. Once you exit the loop, you don't know which order is selected.
Drop the exists variable and put the code in the loop.
What WHRoeder is saying is that you continue looping through orders after finding the order that you are looking for. So you are printing details of the last order selected, not necessarily the one that you want.
if (OrderType() == OP_SELLSTOP && OrderSymbol() == Symbol() && OrderMagicNumber() == 1) { exists = true; break; }
You could exit the loop after finding the trade.
What WHRoeder is saying is that you continue looping through orders after finding the order that you are looking for. So you are printing details of the last order selected, not necessarily the one that you want.
You could exit the loop after finding the trade.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use