0
thanks
- forestmyopia:
If I have only one order open and no pending orders, what should the value of n be in order for me to determine the ticket_number of the open order?for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if ( OrderSelect(iPos, SELECT_BY_POS) // Only my orders w/ && OrderMagicNumber() == magic.number // my magic number && OrderSymbol() == Symbol() // and my pair. ){ ticket_number = OrderTicket(); :
- qjol:Wong. That assume that the EA is only on one chart and that there are no other EAs or manual trading.
0
- forestmyopia:
If I have only one order open and no pending orders, what should the value of n be in order for me to determine the ticket_number of the open order? - qjol:Wong. That assume that the EA is only on one chart and that there are no other EAs or manual trading.
0
c for your self
If I have only one order open and no pending orders, what should the value of n be in order for me to determine the ticket_number of the open order?
Thanks.
You are missing something badly. First you need to check if EVER there is such an order. Otherwise, even if you fill in n=0, or n=whatever, will not help in the selection. My recommendation is before you start, at least do a simple checks along this line. For eg:
if(OrdersTotal()>0){ //then only, perform selection
I have seen and assisted with codes which gives prbs, you just search the threads in this forum, and you will find dozens of them. The reason is bec. of this orderselect(), not done correctly.
forestmiopia had that covered in his original code
if (OrderSelect(n, SELECT_BY_POS)==true)
forestmiopia had that covered in his original code
if (OrderSelect(n, SELECT_BY_POS)==true)
I was referring to the some of the above codes that iterate this way:
for(iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if (
Covered or not, just be safe.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
If I have only one order open and no pending orders, what should the value of n be in order for me to determine the ticket_number of the open order?
Thanks.