Hi there,
There are a couple of glaring errors, so I will point out the easy ones and leave it to the others to find the harder ones.
FindFirstticketnumber=OrderSelect(count-count,SELECT_BY_POS,MODE_TRADES);
count-count is always going to give you zero, which is why it always returns the first order.
I should also point out that OrderSelect is a boolean function, which you have defined as an int. Given that true or false are integers anyway(0 & 1) I don't think this matters, but it is worth being aware of.
Why count the tickets.....why not just OrderSelect in the first loop when you are counting?
Also, you don't need to separate the closing of the buy orders and the sell orders. You can use OrderClosePrice() to close determine the Bid or Ask price for closing and save yourself a bunch of code.(Thanks Gordon:-)
Hi there,
There are a couple of glaring errors, so I will point out the easy ones and leave it to the others to find the harder ones.
count-count is always going to give you zero, which is why it always returns the first order.
I should also point out that OrderSelect is a boolean function, which you have defined as an int. Given that true or false are integers anyway(0 & 1) I don't think this matters, but it is worth being aware of.
Why count the tickets.....why not just OrderSelect in the first loop when you are counting?
Also, you don't need to separate the closing of the buy orders and the sell orders. You can use OrderClosePrice() to close determine the Bid or Ask price for closing and save yourself a bunch of code.(Thanks Gordon:-)
Thanks Gordon,
I use the counter to ensure for each pair EUR and GBP 6 trades are opened. If I use (count-count), I ensure that the first trade's ticket number will be selected. What I'm trying to do with the seperation of code (Buy and Sell) is that I want to check the (ordertakeprofit()-Orderopenprice()), however used Orderprofit() for testing purposes in the mean time. The Tickets to be selected thus is to ensure that if a trade which has a negative (Orderprofit()-Openprice() of $50 and more, gets selecte and thus will be closed. Having said that, a new buy order should be opened simultaneously.
While I appreciate the Errors you have noted, I still require an answer to the selection of the symbol().
Thank you anyway, I'll give attention to the errors you noted in the mean time. ;)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How can you select a ticket for a specific symbol irrespective whether there are other symbols opened ie. both GBP and EUR in the terminal window? What I'm finding is that irrespective of the code below, it selects the first trade opened ie. Eur and reflects the EUR Ticket?