Any idea why OrderSelect fails to detect that the BuyTicket no longer exists?
It does exist. As deleted order in trading history.
You miss understood the BUG.
The order *IS* no longer there. YET orderselect failed to detect that its there/no longer there.
ie, Its still telling me that it is TRUE. (orderselect telling me its still there).
Editing the OrderSelect, I think this is the problem:
BUG:
OrderSelect(BuyTicket,SELECT_BY_TICKET,MODE_TRADES) == true
WORKS:
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true
BUG:
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true && OrderType() == OP_BUYSTOP
It told me FALSE (correctly telling me its no longer there).
THen a while later, its telling me its true.
The order *IS* no longer there. YET orderselect failed to detect that its there/no longer there.
ie, Its still telling me that it is TRUE. (orderselect telling me its still there).
Editing the OrderSelect, I think this is the problem:
BUG:
OrderSelect(BuyTicket,SELECT_BY_TICKET,MODE_TRADES) == true
WORKS:
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true
BUG:
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true && OrderType() == OP_BUYSTOP
It told me FALSE (correctly telling me its no longer there).
THen a while later, its telling me its true.
Something Odd:
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true && OrderType() == OP_BUYSTOP
This one inconsistently telling me TRUE and sometimes FALSE
OrderSelect(BuyTicket,SELECT_BY_TICKET) == true && OrderType() == OP_BUYSTOP
This one inconsistently telling me TRUE and sometimes FALSE
The order *IS* no longer there.
The order *IS* there. Among other deleted, expired and closed orders in trading history. Why not to have a look? Account History tab in Terminal window.
It appears to me that MT4 has a bug when it comes to chaining expressions together using "&&"
works:
works:
If (OrderSelect(....) == true) { if (OrderType() == OP_BUYSTOP) { } }
Dont Work:
If (OrderSelect(....) == true && OrderType() == OP_BUYSTOP) { }
Something tells me that MT4 evaluates False && False = True?
The order *IS* no longer there.
The order *IS* there. Among other deleted, expired and closed orders in trading history. Why not to have a look? Account History tab in Terminal window.
The code was suppose to tell me that its no longer in the Trade (Pending/Open) not in the history as written in the document:
MODE_TRADES (default)- order selected from trading pool(opened and pending orders), MODE_HISTORY - order selected from history pool (closed and canceled order).
So why it is telling me that its TRUE is beyond the logic of the documentation.
The code was suppose to tell me that its no longer in the Trade (Pending/Open) not in the history as written in the document:
MODE_TRADES (default)- order selected from trading pool(opened and pending orders), MODE_HISTORY - order selected from history pool (closed and canceled order).
You misunderstood the documentation. The quote is incomplete:
pool - 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).
You're trying to select the order by ticket, aren't you?
Apparently, OrderType forces OrderSelect to become true when OrderSelect is false.
ie, If OrderSelect is false, then (OrderSelect(...) && OrderType) will be true!
I recoded the above to something like this:
ie, If OrderSelect is false, then (OrderSelect(...) && OrderType) will be true!
I recoded the above to something like this:
int start() { //---- RefreshRates(); int BuyTicket = OrderSend(Symbol(), OP_BUYSTOP, 1, Ask + 15*Point, 10, 0, 0, "", 0, 0, CLR_NONE); int NOW = LocalTime(); string INFO; while (LocalTime() < NOW + 15) { RefreshRates(); INFO = ""; if ( OrderSelect(BuyTicket,SELECT_BY_TICKET) == true ) { INFO = StringConcatenate(INFO, "\nOrderSelect:true"); Print("OrderSelect:true"); } if (OrderType() == OP_BUYSTOP) { INFO = StringConcatenate(INFO,"\nOrderType:true"); Print("OrderType:true"); } if ( (OrderSelect(BuyTicket,SELECT_BY_TICKET) == true) && (OrderType() == OP_BUYSTOP) ) { INFO = StringConcatenate(INFO,"\nCombined:True"); Print("Combine:true"); } Comment("Local Time: ", TimeToStr(LocalTime(), TIME_SECONDS), INFO); Sleep(100); } return(0); }
Initially everything is TRUE.
When I deleted the order manually, nothing is displayed indicating that everything is false.
When the loop comes around, all becomes TRUE again.
IF this is not a bug, then anyone explain the logic behind the above behavior?
The code was suppose to tell me that its no longer in the Trade (Pending/Open) not in the history as written in the document:
MODE_TRADES (default)- order selected from trading pool(opened and pending orders), MODE_HISTORY - order selected from history pool (closed and canceled order).
You misunderstood the documentation. The quote is incomplete:
pool - 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).
You're trying to select the order by ticket, aren't you?
OrderSelect(BuyTicket,SELECT_BY_TICKET,MODE_TRADES)
SELECT_BY_TICKET
OrderSelect(BuyTicket,SELECT_BY_TICKET,MODE_TRADES)
SELECT_BY_TICKET
Yet again.SELECT_BY_TICKET
pool - Optional order pool index. Used when the selected parameter is SELECT_BY_POS.
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
It will place a BUY STOP and monitor if such an order exists or not.
Upon placing the order, it will enter into a 30 seconds loop to check if the BuyTicket still exists.
Initially it is True as it should be. But manually delete the order and this loop still gives out "True".
Any idea why OrderSelect fails to detect that the BuyTicket no longer exists?