Already asked and answered, please search before posting.
Would you kindly link me , i googled for solution atleast 10 times and was not able to find that solution.
Would you kindly link me , i googled for solution atleast 10 times and was not able to find that solution.
No need for google, there is search tool on this site.
Sorry I don't have the link and I will not search in your place. It's on the forum, believe me. So do your home work.
No need for google, there is search tool on this site.
Sorry I don't have the link and I will not search in your place. It's on the forum, believe me. So do your home work.
Search tool only finds one irrelevant search ,
When we execute a trade we get a ticket , i want to check that trade from history and gets its results.
Search tool only finds one irrelevant search ,
When we execute a trade we get a ticket , i want to check that trade from history and gets its results.
(HistorySelectByPosition(HistoryDealGetInteger(ticket,DEAL_POSITION_ID))) but it selects only ticket of deposit history. one ticket only selected and its not the deal out.
ok found it , no help from search
here is code may be it helps anyone else also , thanks alain very helpful and fast tips. :Z
ulong openticket=9629350; for (int i = HistoryDealsTotal(); i >= 0; i--){ ulong deal_ticket=HistoryDealGetTicket(i); int entry_type=(ENUM_DEAL_ENTRY)HistoryDealGetInteger(deal_ticket,DEAL_ENTRY); int pos_id = HistoryDealGetInteger(deal_ticket,DEAL_POSITION_ID); if (pos_id==openticket && entry_type==DEAL_ENTRY_OUT){ Alert(DoubleToString(HistoryDealGetDouble(deal_ticket,DEAL_PROFIT),8)); } }
You have ticket get the profit no , i dont know if it could be done without loop.
I think without loop is not possible in mt5.
mt4>mt5.
ok found it , no help from search
here is code may be it helps anyone else also , thanks alain very helpful and fast tips. :Z
You have ticket get the profit no , i dont know if it could be done without loop.
I think without loop is not possible in mt5.
mt4>mt5.
Good.
Yes I gave you the right tips, not my fault if you can't search, is it ?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am converting my code for mql4 to mql5.
In mql4 i had a ticket of trade i selected it from history and was able to get pips gained.
In mql5 i am able to select that order using ticket
HistoryDealGetDouble(ticket,DEAL_PROFIT);
but profit is 0 because ticket of deal out is different , how to get that profit of that specific trade.
Is there a way to determine
DEAL_ENTRY_OUT
of the specified trade
DEAL_ENTRY_IN
, i don't want to loop full history if possible.
Hedging enabled account