Position Identifier

 

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.

 
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.
 
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?
 
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().
 
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.

 

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.

 
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?

 
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)
 
angevoyageur:
What do you think this is ?

:))


Thank you so much.

 
Alain Verleyen #:
Non proprio. Una posizione può essere il risultato di molti ordini (e offerte), l'identificatore di posizione è il biglietto del PRIMO ordine.

Cosa pensi che sia questo?

Good evening alain, I apologize in advance for my English but I am using a translator. since I have been looking for an answer to my doubt for more than a week and maybe I found it right now here, I would like if possible only a confirmation. from your answer to ozanq “the location identifier is the ticket of the FIRST order.” I use mqlttraderequest and mqltraderesult to place orders, I retrieve my ticket with result.order and then I use this number and look for it when I need it with position_identifier ! It seems to understand that it is correct as a procedure. because I can't write a clean code to derive the position_identifier as soon as the order is placed, it always gives me the number of the previous order
Reason: