Did you see "MQL4: OrderType" ?
Hi Rosh
Thanks for your response, yes I have tried using OrderType, but it does not seem to work, it's just returning 0 for a filled market order and 2 for an either filled or pending limit order.
Thanks
Scouseman
Thanks for your response, yes I have tried using OrderType, but it does not seem to work, it's just returning 0 for a filled market order and 2 for an either filled or pending limit order.
Thanks
Scouseman
int OrderType( )
Returns order operation type for the currently selected order. It can be any of the following values:
OP_BUY - buying position,
OP_SELL - selling position,
OP_BUYLIMIT - buy limit pending position,
OP_BUYSTOP - buy stop pending position,
OP_SELLLIMIT - sell limit pending position,
OP_SELLSTOP - sell stop pending position.
Note: order must be selected by OrderSelect() function.
===
Did You select some order before use OrderType?
Returns order operation type for the currently selected order. It can be any of the following values:
OP_BUY - buying position,
OP_SELL - selling position,
OP_BUYLIMIT - buy limit pending position,
OP_BUYSTOP - buy stop pending position,
OP_SELLLIMIT - sell limit pending position,
OP_SELLSTOP - sell stop pending position.
Note: order must be selected by OrderSelect() function.
===
Did You select some order before use OrderType?
Hi Slawa
Order 1 whose ticket is assigned to tick1 is a market order is always assigned 0 which I take is correct.
Order 2 whose ticket is assigned to tick2 is a limit order ans is assigned 2, when it is filled the value remains at 2 which cannot be right. Please see my code below.
Am I doing something wrong?
Thanks
Scouseman
Order 1 whose ticket is assigned to tick1 is a market order is always assigned 0 which I take is correct.
Order 2 whose ticket is assigned to tick2 is a limit order ans is assigned 2, when it is filled the value remains at 2 which cannot be right. Please see my code below.
Am I doing something wrong?
Thanks
Scouseman
OrderSelect(tick1,SELECT_BY_TICKET,MODE_TRADES); order_type=OrderType(); Print ("Order Type 1 :",order_type); OrderSelect(tick2,SELECT_BY_TICKET,MODE_TRADES); order_type=OrderType(); Print ("Order Type 2 :",order_type); OrderSelect(tick3,SELECT_BY_TICKET,MODE_TRADES); order_type=OrderType(); Print ("Order Type 3 :",order_type);
Why without a loop ?!!!
for (int i=OrdersTotal()-1;i>=0;i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { Print ("Order ticket #",OrderTicket()," is "OrderType()," type"); } }
Why without a loop ?!!!
for (int i=OrdersTotal()-1;i>=0;i--) { if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) { Print ("Order ticket #",OrderTicket()," is "OrderType()," type"); } }
Hi Rosh
Thanks for your continued help.
The reason my code is not in a loop is because, within the loop I need to refer to the order ticket numbers using there varables tick1,tick2,tick3 etc and as far as I know there is no way to increment a varable from with a loop. If this was possible it would allow me to cut the size of my code in half. Am I right in believing it is not possible?
Thanks again
scouse
I don't understand why you need refer to order ticket. I never doing it and don't know when it nedeed.
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
I wonder if somebody can help me, I am trying to determine the status of the open orders on my account in for me to know which orders are currently active and which orders need deleting.
I cannot use OrderProfit as some of my orders are filled with 0 profit, I tried using Order type but it is just returning 0 for a filled market order and 2 for an either filled or pending limit order, so that does not work either.
Can anybody please tell me the best way to determine order status in order for me to select then delete pending orders.
Any help would be most appreciated.
Mark