Exporting Opened/Closed Trades in .CSV Format?

 
Hello,

I am wondering if it is possible to create a code which could export a single .csv file that would create a row everytime a position is opened and closed for any type of trade taken i.e. with EA or manual exection in real time? If so could someone please provide me with an example to perform this. It would basically look like the Trade tab of the MT4 Terminal.

EXAMPLE OF FORMAT HERE:

Ticket Number, (Buy, Buy Limit, Buy Stop, Sell, Sell Limit, Sell Stop), Lot Symbol, Price, SL, TP, Close Price

Thanks
 
You can try to look at "MQL4: Summary Report In Points"
Reason: