Download MetaTrader 5
To add comments, please log in or register
Learning MQL5? Start with documentation!
LouK
143
LouK 2014.03.24 17:34 

My EA places only market orders. The text "SELLSTOP" and "BUYSTOP" don't appear anywhere in it. The trade window shows only "buy" and "sell" orders since I never sent anything else.

Yet OrderType() in MQL4 returns them as being types 4 and 5, BUYSTOP and SELLSTOP. OrderTicket() returns the same ticket number as in the trade window, so I know there's no mistake about which ticket I'm looking at.

I guess I can work around it by testing for OP_BUYSTOP in addition to OP_BUY, but that seems awfully sloppy.

My test for OP_BUY and OP_SELL used to work - what changed?.

Is this happening to anyone else?

------------------------------------------

This is strange: I'm going to post the above anyway.

I restarted the terminal and now OrderType() is returning 0 which is OP_BUY which is correct. I'm trying to understand how the client would mess up this information. I mean, I assumed the OrderType() to be retuned directly from the server each time.

Any thoughts?

Simon Gniadkowski
Moderator
17963
Simon Gniadkowski 2014.03.24 18:36  
LouK:

My EA places only market orders. The text "SELLSTOP" and "BUYSTOP" don't appear anywhere in it. The trade window shows only "buy" and "sell" orders since I never sent anything else.

Yet OrderType() in MQL4 returns them as being types 4 and 5, BUYSTOP and SELLSTOP. OrderTicket() returns the same ticket number as in the trade window, so I know there's no mistake about which ticket I'm looking at.

I guess I can work around it by testing for OP_BUYSTOP in addition to OP_BUY, but that seems awfully sloppy.

My test for OP_BUY and OP_SELL used to work - what changed?.

Is this happening to anyone else?

------------------------------------------

This is strange: I'm going to post the above anyway.

I restarted the terminal and now OrderType() is returning 0 which is OP_BUY which is correct. I'm trying to understand how the client would mess up this information. I mean, I assumed the OrderType() to be retuned directly from the server each time.

Any thoughts?

When I first read your post my thought was that you had an "error" with your OrderSelect() calls . . . print all the related variables just before you call OrderType() and after . . . so Print() OrderTicket() to make sure you have the correct order selected.
LouK
143
LouK 2014.03.24 19:45  
RaptorUK:
When I first read your post my thought was that you had an "error" with your OrderSelect() calls . . . print all the related variables just before you call OrderType() and after . . . so Print() OrderTicket() to make sure you have the correct order selected.


As I said in my post, I also returned OrderTicket() with OrderType(), so there was no mistake about which order. It matched the ticket number in the trade window.

It's all working now, I just don't understand what a restart had to do with it.

Thanks for the reply!

Ian Venner
2583
Ian Venner 2014.03.25 02:47  

LouK:

I restarted the terminal and now OrderType() is returning 0 which is OP_BUY which is correct. I'm trying to understand how the client would mess up this information. I mean, I assumed the OrderType() to be retuned directly from the server each time.

Any thoughts?

I believe OrderType() is returned by the terminal.
/
To add comments, please log in or register