OrderSelect()

To add comments, please log in or register
paul selvan
629
paul selvan  

hello,

ticket = OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)

I know if among open or pending orders at position pos if there is an order then ticket = TRUE.

But in which case   ticket = FALSE ?

William Roeder
20207
William Roeder  
Perhaps you should read the manual. OrderSelect does not return a ticket.
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
          Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
paul selvan
629
paul selvan  

In MQL4 manual it's said that OrderSelect return a boolean value.So what do you mean ?May be you're confused by variable ticket and pos


bool  OrderSelect( 
   int     index,            // index or order ticket 
   int     select,           // flag 
   int     pool=MODE_TRADES  // mode 
   );

Parameters

ticket

[in]  Order index or order ticket depending on the second parameter.

select

[in]  Selecting flags. It can be any of the following values:

SELECT_BY_POS - index in the order pool,
SELECT_BY_TICKET - index is order ticket.

pool=MODE_TRADES

[in]  Optional order pool index. Used when the selected parameter is SELECT_BY_POS. It can be any of the following values:

MODE_TRADES (default)- order selected from trading pool(opened and pending orders),
MODE_HISTORY - order selected from history pool (closed and canceled order).

Returned value

It returns true if the function succeeds, otherwise falses. To get the error information, one has to call the GetLastError() function.

William Roeder
20207
William Roeder  
paulselvan: In MQL4 manual it's said that OrderSelect return a boolean value.So what do you mean ?May be you're confused by variable ticket and pos
  1. ticket = OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)
    I'm not confused, you are. It returns a bool. So why did you assign it to ticket. True or False is not a ticket, ever.
  2. You asked "But in which case   ticket = FALSE ?." Read the link previously provided.
paul selvan
629
paul selvan  

In this case the word ticket is a variable that contains the booelan return value of the instruction OrderSelct()

I can also call it  by the word bill or anything else...that will not affect this instruction

I suppose when you add a comment your aim is  to extol your knowledge..rather then to answer clearly 

Alain Verleyen
38647
Alain Verleyen  
paulselvan:

In this case the word ticket is a variable that contains the booelan return value of the instruction OrderSelct()

I can also call it  by the word bill or anything else...that will not affect this instruction

I suppose when you add a comment your aim is  to extol your knowledge..rather then to answer clearly 

If you want answers on this forum I suggest to change your way to answer.

When you receive an answer you should say thank you.  When you don't understand the answer, you should ask more explanation. You should not start to offend the one who tried to help you.

GrumpyDuckMan
882
GrumpyDuckMan  
paulselvan:

In MQL4 manual it's said that OrderSelect return a boolean value.So what do you mean ?May be you're confused by variable ticket and pos


Parameters

ticket

[in]  Order index or order ticket depending on the second parameter.

select

[in]  Selecting flags. It can be any of the following values:

SELECT_BY_POS - index in the order pool,
SELECT_BY_TICKET - index is order ticket.

pool=MODE_TRADES

[in]  Optional order pool index. Used when the selected parameter is SELECT_BY_POS. It can be any of the following values:

MODE_TRADES (default)- order selected from trading pool(opened and pending orders),
MODE_HISTORY - order selected from history pool (closed and canceled order).

Returned value

It returns true if the function succeeds, otherwise falses. To get the error information, one has to call the GetLastError() function.

Hello,

You have supported the answer given to you in 1# and 3#

BTW ticket should be "int ticket"

GrumpyDuckMan
882
GrumpyDuckMan  
paulselvan:

hello,

ticket = OrderSelect(pos,SELECT_BY_POS,MODE_TRADES)

I know if among open or pending orders at position pos if there is an order then ticket = TRUE.

But in which case   ticket = FALSE ?

You should used <code>(Alt+s)  to show your code issues.

GrumpyDuckMan
882
GrumpyDuckMan  
paulselvan:

In this case the word ticket is a variable that contains the booelan return value of the instruction OrderSelct()

I can also call it  by the word bill or anything else...that will not affect this instruction

I suppose when you add a comment your aim is  to extol your knowledge..rather then to answer clearly 

Dear friend,

use (Alt+s)

Please reframe from insulting members trying to guide you.

To add comments, please log in or register