![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thankyou so much for the help ,
this is the code i am usingwhat you mean to say is that there is no any function or any method inbuilt in mql5 to get closing time for history deals .
I am using onTrade and OntradeTransaction function onwards but then too I am unable to get the closing time of a single deal also if i am getting by any means of calculation it is ' 1708507218 ' in this format which concludes to 1970.01.01 00:00 on converting to date
As you told I am not using ticket now but I think I didn't got your point exactly can u please explain what changes I have to make in my code it will be really helpful
you can give reference to my previous code or take in account this new code which is returning nothing useful .
here is the previous code
Hi , I got you point for a position in history having one open and one close deal . I have successfully fetched all the history records and now calculating the closing time for a position ,
But for the deal at 0th index (means the trade that executed very first ) I am getting symbol as '' empty string and type = 2 also order as 0
else all other trades information is accurate please resolve how to get 0th deal accurately.
Hi , I got you point for a position in history having one open and one close deal . I have successfully fetched all the history records and now calculating the closing time for a position ,
But for the deal at 0th index (means the trade that executed very first ) I am getting symbol as '' empty string and type = 2 also order as 0
else all other trades information is accurate please resolve how to get 0th deal accurately.
No no you didn't get it , HistoryDealTicket is returning valid tickets for every deal in the history when running inside the loop what i want is
1. the deal at 0th index have a valid ticket , trade time but do not contain *SYMBOL* it shows symbol as empty string and also the type is 2
https://www.mql5.com/en/forum/462605/page2#comment_52533997
this thing is happening only with the 0th index data for every else data i am getting all values
Also ,I want to know that when we fetch deals from history we get one deal for buy and another for sell so what is common between the two deals how we can differentiate between the deals that this is the opening deal for this trade and this is the closing deal .
Means I need a property or any sign that is common in all the deals of a single trade
Means I need a property or any sign that is common in all the deals of a single trade
Perhaps the translation of this post will help you figure it out.
Perhaps the translation of this post will help you figure it out.
thanks I have added it to my Experts tab but it is not working and not getting compiled showing lots of errors
if these errors are resolved then I can achieve what i was looking for I have attached an screenshot for your reference
thanks I have added it to my Experts tab but it is not working and not getting compiled showing lots of errors
if these errors are resolved then I can achieve what i was looking for I have attached an screenshot for your reference
The MetaEditor clearly shows which file is needed with a red picture. There's even a link to this file.
No no you didn't get it , HistoryDealTicket is returning valid tickets for every deal in the history when running inside the loop what i want is
1. the deal at 0th index have a valid ticket , trade time but do not contain *SYMBOL* it shows symbol as empty string and also the type is 2
https://www.mql5.com/en/forum/462605/page2#comment_52533997
this thing is happening only with the 0th index data for every else data i am getting all values
Also ,I want to know that when we fetch deals from history we get one deal for buy and another for sell so what is common between the two deals how we can differentiate between the deals that this is the opening deal for this trade and this is the closing deal .
Means I need a property or any sign that is common in all the deals of a single trade
To your first issue, I am not sure what the issue is. - I dont have your history available.
The question you are asking is maybe answered like this:
One Position is made up of at least two Orders, while an Order can be one or multiple deals. So to figure out what opened your position, and what type it is, you need to figure out the order, because they have this information. - The deals that make up the execution of that order will tell you how your order was executed.
Also notice, some brokers use deals to insert swap or other balance operations on your account.