Find out which closed orders were initially opened as limit/stop orders and which as market orders

 

Hi,

I a need to be able to calculate some stats on the account's closed positions but I need to know their initial 'type' (limit, stop, market)

Is there a way for me to find out from the pool of closed orders which positions have initially been opened as limit, stop or market orders so I can 'categorize' them? 

Yannis

 
Yannis:

I a need to be able to calculate some stats on the account's closed positions but I need to know their initial 'type' (limit, stop, market)

Is there a way for me to find out from the pool of closed orders which positions have initially been opened as limit, stop or market orders so I can 'categorize' them? 

Are you sure you're posting to right forum? This is for MT5, where orders are executed with deals and result in opening or closing of positions. "Closed orders" sounds like you imply MT4 (other forum).

In both cases, short answer is yes - you can lookup trading history in any terms: orders, deals, positions - all are marked by unique IDs/tickets.

 
Stanislav Korotky:

Are you sure you're posting to right forum? This is for MT5, where orders are executed with deals and result in opening or closing of positions. "Closed orders" sounds like you imply MT4 (other forum).

In both cases, short answer is yes - you can lookup trading history in any terms: orders, deals, positions - all are marked by unique IDs/tickets.


Thank you for getting back to me Stanislav, I am in the right forum, it is simply because I am in my very early steps with MT5 and my 'expressions' are still linked to MT4 programming...

I am starting to get aware of the differences now, but still fail to handle them with ease, despite the endless hours reading the knowledge base and the articles. I haven't found yet the way to tie everything up together, because I haven't found the relationship between IDs and tickets in the history pool yet, hence the trial to get some pointers and help here.

 
Yannis:

Thank you for getting back to me Stanislav, I am in the right forum, it is simply because I am in my very early steps with MT5 and my 'expressions' are still linked to MT4 programming...

I am starting to get aware of the differences now, but still fail to handle them with ease, despite the endless hours reading the knowledge base and the articles. I haven't found yet the way to tie everything up together, because I haven't found the relationship between IDs and tickets in the history pool yet, hence the trial to get some pointers and help here.

Ok, if it's MT5 you can start with calling HistorySelect, which will internally build lists of orders for specified time range (see example in the doc page). Then interate over the list from 0 to HistoryOrdersTotal() - 1. For every i-th item in the loop you can call HistoryOrderGetInteger(HistoryOrderGetTicket(i), ORDER_TYPE), which will give you one of ENUM_ORDER_TYPE.

 
Stanislav Korotky:

Ok, if it's MT5 you can start with calling HistorySelect, which will internally build lists of orders for specified time range (see example in the doc page). Then interate over the list from 0 to HistoryOrdersTotal() - 1. For every i-th item in the loop you can call HistoryOrderGetInteger(HistoryOrderGetTicket(i), ORDER_TYPE), which will give you one of ENUM_ORDER_TYPE.


Thank you, very helpful head start.

Reason: