In Strategy Tester, how to know which "Out" order correspond to which "In" order ?

 

Hello,



See the results of a Strategy testing below:



If we consider Order number 2 for instance (of type "sell", and direction "in", executed at 14:00:00), how do I know to which "Out" order it is attached ?I mean, this "In" order is at some point closed by a sell position with a direction "out", right ? but how do I know which one ?


Thank you

 
AYMERIC75:

Hello,



See the results of a Strategy testing below:



If we consider Order number 2 for instance (of type "sell", and direction "in", executed at 14:00:00), how do I know to which "Out" order it is attached ?I mean, this "In" order is at some point closed by a sell position with a direction "out", right ? but how do I know which one ?


Thank you

There is a property called ORDER_POSITION_ID

That's what you need to match deals and orders and positions.
 
Dominik Christian Egert #:
There is a property called ORDER_POSITION_ID

That's what you need to match deals and orders and positions.

Thanks Dominik,


After checking I cannot see a column which would be the equivalent of ORDER_POSITION_ID , the problem is that I don't have access to the code of the EA



 
AYMERIC75 #:

Cảm ơn Dominik,


Sau khi kiểm tra, tôi không thể thấy cột tương đương với ORDER_POSITION_ID, vấn đề là tôi không có quyền truy cập vào mã của EA



You choose Order & Deal

 
Dao Thi Thanh Nguyet #:

You choose Order & Deal



Sorry but as you can see above, it does not show the relation between the In's and Out's 

 
AYMERIC75 #:


Sorry but as you can see above, it does not show the relation between the In's and Out's 


You don't need access to the EA, but you can use a script, some code from code base or a product from market to analyze the history.

If you cannot find what you need, you could get it coded for you in freelance section.

 

As one open position can be closed by TP, SL or several orders (partial close) or by another position (close_by) you have to analyse:
DEAL_TICKET, DEAL_ORDER, DEAL_TYPE, DEAL_ENTRY, DEAL_REASON, DEAL_POSITION_ID, ... (try not to drive yourself crazy).

Or you use for each new trade an individual magic number. Of course this is not the intention of the magic number but it can be misused that way.

 
Carl Schreiber #:

As one open position can be closed by TP, SL or several orders (partial close) or by another position (close_by) you have to analyse:
DEAL_TICKET, DEAL_ORDER, DEAL_TYPE, DEAL_ENTRY, DEAL_REASON, DEAL_POSITION_ID, ... (try not to drive yourself crazy).

Or you use for each new trade an individual magic number. Of course this is not the intention of the magic number but it can be misused that way.

How is he supposed to do that, if he has no access to the source code, as he mentioned?

Anyways, when using Magic Number like you suggest, it's use would be the same as Position ID.


 
Dominik Christian Egert #:
How is he supposed to do that, if he has no access to the source code, as he mentioned?

Anyways, when using Magic Number like you suggest, it's use would be the same as Position ID.


Then he has to analyse the history the way I said: analyse DEAL_TICKET, DEAL_ORDER, DEAL_TYPE, DEAL_ENTRY, DEAL_REASON, DEAL_POSITION_ID, ...

Wrong. If one position is closed by another position both have different Position IDs but then maybe the same Magic Number.

The IDs of order, deal and position are set by the system. They can be the same or they can differ. The magic number ist the reference of the trader and it's not changed - so why not use it for ones own trading beyond one for each EA?

Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
Documentation on MQL5: Constants, Enumerations and Structures / Trade Constants / Deal Properties
  • www.mql5.com
Deal Properties - Trade Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Carl Schreiber #:

Then he has to analyse the history the way I said: analyse DEAL_TICKET, DEAL_ORDER, DEAL_TYPE, DEAL_ENTRY, DEAL_REASON, DEAL_POSITION_ID, ...

Wrong. If one position is closed by another position both have different Position IDs but then maybe the same Magic Number.

The IDs of order, deal and position are set by the system. They can be the same or they can differ. The magic number ist the reference of the trader and it's not changed - so why not use it for ones own trading beyond one for each EA?

True, but the terminal provides a special position ID for the case of close by.

Why not use magic for that, because it will take away a different, very important information consistency, if you keep changing the magic.

And, yes you could now argue,you could build magic number groups and so on, but that's not what magic numbers are made for in the first place.

Besides, he has no access to the source. So it is irrelevant to suggest such an approach in the first place.


 
The OP does not have the code (he is asking for help based on a product from the Market).

He just wants to know how to interpret the trades in the history. Don't go crazy with ID's, magic numbers, etc.

Note the icons and the direction of the arrows.

  • Red = Sell
  • Blue = Buy
  • Right arrow = Open
  • Left arrow = Close