Did you search before posting ?
The site is full of examples and questions about that.

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
How do I get the close price and close time of a trade after it has hit SL/TP? At entry I do something like this to log the open time information
I guess I could monitor on every tick whether the last open position is not active (using ticket number? or PositionSelect(_Symbol)==false), but is there an easier way to do this?