Download MetaTrader 5

Position Identifier

To add comments, please log in or register
OzanK
70
OzanK  

My demo terminal is not setting a position identifier for positions ... and naturally it is absent also for deals and orders on the history tab.

What can be the reason?

Thanks.

Alain Verleyen
Moderator
33360
Alain Verleyen  
OzanK:

My demo terminal is not setting a position identifier for positions ... and naturally it is absent also for deals and orders on the history tab.

What can be the reason?

Thanks.

As far as I know this field is not used.
OzanK
70
OzanK  
angevoyageur:
As far as I know this field is not used.
Thank you ... then, HistorySelectByPosition() is a dead function, there is no usage for it?
Alain Verleyen
Moderator
33360
Alain Verleyen  
OzanK:
Thank you ... then, HistorySelectByPosition() is a dead function, there is no usage for it?
I was talking about the ID in the Terminal, there is no problem with HistorySelectByPosition().
OzanK
70
OzanK  
angevoyageur:
I was talking about the ID in the Terminal, there is no problem with HistorySelectByPosition().

I think that the "deal ticket", the "order ticket" and the "position identifier" data are a little bit mixed with each other.

I think that these data are three different concepts, am I wrong?

Let me give you an example ...


The appearance of my history tab:


And the trivial code I'm trying:

   datetime from = D'2015.03.13';
   datetime to = TimeCurrent();
   HistorySelect(from, to);
   Print(HistoryDealsTotal());
   for(int i=0;i<HistoryDealsTotal();i++)
     {
      Print(".");
      Print(HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_POSITION_ID));
      Print(HistoryDealGetInteger(HistoryDealGetTicket(i),DEAL_ORDER));
     }


And the result I'm getting with this code:


First of all ... I'm getting "order tickets" in place of "deal tickets".

And secondly, I'm also getting "order tickets" in place of "position identifier" ... I don't know, maybe, are these same things?

And additionally, in the last image ... some order tickets are written for the next order as well. I could not understand what can cause this in my code fragment.

Alain Verleyen
Moderator
33360
Alain Verleyen  

It's better to post the log rather than a screenshot. With a log I can copy it and add comment, I will not do it with a screenshot.

OzanK:

First of all ... I'm getting "order tickets" in place of "deal tickets".

You don't print the deal ticket, your print the order ticket (DEAL_ORDER).

And secondly, I'm also getting "order tickets" in place of "position identifier" ... I don't know, maybe, are these same things?

You get the position_ID which is the first ticket of the first order used to open a position.

And additionally, in the last image ... some order tickets are written for the next order as well. I could not understand what can cause this in my code fragment.

This is position ID, which remains the same during all the "live" of a position.

I hope it's more clear.

OzanK
70
OzanK  
angevoyageur:

It's better to post the log rather than a screenshot. With a log I can copy it and add comment, I will not do it with a screenshot.

You don't print the deal ticket, your print the order ticket (DEAL_ORDER).
You get the position_ID which is the first ticket of the first order used to open a position.

This is position ID, which remains the same during all the "live" of a position.

I hope it's more clear.

Yes, thanks ... a little bit more clear now.


Then, position identifier is the same thing with the order ticket ... right?


And, one more additional question ... how can I print the deal ticket numbers with the HistoryDeal....() functions?

I could not see any field in the related enumarations for printing deal tickets?

Alain Verleyen
Moderator
33360
Alain Verleyen  
OzanK:

Yes, thanks ... a little bit more clear now.


Then, position identifier is the same thing with the order ticket ... right?

Not really. A position can be the result of a lot of orders (and deals), the position identifier is the ticket of the FIRST order.


And, one more additional question ... how can I print the deal ticket numbers with the HistoryDeal....() functions?

I could not see any field in the related enumarations for printing deal tickets?

What do you think this is ?

HistoryDealGetTicket(i)
OzanK
70
OzanK  
angevoyageur:
What do you think this is ?

:))


Thank you so much.

To add comments, please log in or register