Scripts: Export Positions History

 

Export Positions History:

The script exports history of closed positions to .csv file.

It supports only retail hedging accounts (Forex).

To export the entire trading history, keep Start date and End date at their default values (1970.01.01 00:00:00).

You can see that all the closed positions were reconstructed in the same way as in the History tab of the MetaTrader 5 terminal.

Author: amrali

 
You can see that all the closed positions were reconstructed in the same way as in the History tab of the MetaTrader 5 terminal.
Unfortunately, this presentation is not convenient. Since you can not see how the sequential closing of the trading position
 
fxsaber:
Unfortunately, this presentation is not convenient. Since you can not see how the sequential closing of the trading position

My script tries to stick to the same representation as in the History tab of the MetaTrader 5 terminal. If you prefer a convenient way to display the history of deals ordered by close time, you can use my other script "Export Deals History"

https://www.mql5.com/en/code/24608

Export Deals History
Export Deals History
  • www.mql5.com
Accelerator Oscillator (AC) The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force. MACD Signals Indicator edition for new platform.
 

Added a new option to order closed positions by open time or close time. 


 

Hi guys,

After running my EA in the backtesting, I drag and drop the script into the chart but i'm only getting a csv with empty results. Only have the labels. What am I doing wrong?

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
What are the differences between the three modes of testing in MetaTrader 5, and what should be particularly looked for? How does the testing of an EA, trading simultaneously on multiple instruments, take place? When and how are the indicator values calculated during testing, and how are the events handled? How to synchronize the bars from different instruments during testing in an "open prices only" mode? This article aims to provide answers to these and many other questions.
 
filipe197:

Hi guys,

After running my EA in the backtesting, I drag and drop the script into the chart but i'm only getting a csv with empty results. Only have the labels. What am I doing wrong?

The script should be run on live account 
 
amrali:
The script should be run on live account

Thanks for your reply. I understand that but can't I make use of this script to extract the trades information related to a backtest?

 
filipe197:

Thanks for your reply. I understand that but can't I make use of this script to extract the trades information related to a backtest?

Modify your EA and paste the script code inside  OnTester() function of your EA.

 

Hello.

I ran this script and it passed to XL a mush not structured by columns.


Open Time,Ticket,Type,Volume,Symbol,Open Price,S/L,T/P,Close Time,Close Price,Commission,Swap,Profit,Profit Points,Balance,Magic Number,Duration,Open Reason,Close Reason,Open Comment,Close Comment,Deal In Ticket,Deal Out Tickets
2022.01.04 17:57:39,268558289,buy,0.01,EURUSD,1.13147,,,2022.01.04 17:58:06,1.13110,0.00,0.00,-0.37,-37.0,-0.37,0,00:00:27,client,client,,,222353427,222353591
2022.01.05 10:20:42,268646473,sell,0.01,EURUSD,1.13046,1.13411,1.11571,2022.01.05 10:31:27,1.13106,0.00,0.00,-0.60,-60.0,-0.97,910200201,00:10:45,expert,client,Expert id 910200201,,222420468,222422518
2022.01.05 10:31:28,268648565,sell,0.01,EURUSD,1.13087,1.13450,1.11612,2022.01.05 10:31:40,1.13105,0.00,0.00,-0.18,-18.0,-1.15,910200201,00:00:12,expert,client,Expert id 910200201,,222422519,222422538
2022.01.05 10:15:49,268646116,sell,0.04,EURUSD,1.13048,1.13372,1.11573,2022.01.05 10:31:51,1.13104,0.00,0.00,-2.24,-56.0,-3.39,910200001,00:16:02,expert,client,Expert id 910200001,,222420132,222422609
2022.01.05 10:31:41,268648590,sell,0.01,EURUSD,1.13088,1.13451,1.11613,2022.01.05 11:04:37,1.13050,0.00,0.00,0.38,38.0,-3.01,910200201,00:32:56,expert,client,Expert id 910200201,,222422542,222425801
2022.01.05 10:31:53,268648657,sell,0.02,EURUSD,1.13087,1.13386,1.11613,2022.01.05 14:59:39,1.13083,0.00,0.00,0.08,4.0,-2.93,910200001,04:27:46,expert,client,Expert id 910200001,,222422611,222453837
2022.01.10 08:06:11,269221228,buy,0.02,EURUSD,1.13324,1.12940,1.14391,2022.01.10 16:02:16,1.12938,0.00,0.00,-7.72,-386.0,-10.65,910800101,07:56:05,expert,sl,Expert id 910800101,[sl 1.12940],222926543,223004606
2022.01.10 16:02:17,269306301,sell,0.02,EURUSD,1.12938,1.13322,1.11871,2022.01.10 19:05:19,1.13323,0.00,0.00,-7.70,-385.0,-18.35,910800101,03:03:02,expert,sl,Expert id 910800101,[sl 1.13322],223004623,223050972
2022.01.10 18:47:33,269352794,buy,0.01,EURUSD,1.13219,1.12839,1.14286,2022.01.12 18:42:15,1.14286,0.00,-0.14,10.67,1067.0,-7.82,918002201,1d 23:54:42,expert,tp,Expert id 918002201,[tp 1.14286],223048016,223364473
2022.01.10 19:05:21,269356116,buy,0.02,EURUSD,1.13324,1.12943,1.14391,2022.01.12 19:23:07,1.14391,0.00,-0.28,21.34,1067.0,13.24,910800101,2d 00:17:46,expert,tp,Expert id 910800101,[tp 1.14391],223050998,223372986
2022.01.18 15:05:45,270467218,buy,0.08,EURJPY,130.423,130.057,131.356,2022.01.18 17:04:34,130.056,0.00,0.00,-25.63,-367.0,-12.39,918001202,01:58:49,expert,sl,Expert id 918001202,[sl 130.057],223957533,223990938
2022.01.18 15:14:24,270469968,buy,0.08,EURUSD,1.13694,1.13313,1.14777,2022.01.18 18:24:26,1.13312,0.00,0.00,-30.56,-382.0,-42.95,918003201,03:10:02,expert,sl,Expert id 918003201,[sl 1.13313],223960298,224011365
2022.01.18 15:14:24,270469969,buy,0.16,EURUSD,1.13694,1.13313,1.14777,2022.01.18 18:24:26,1.13312,0.00,0.00,-61.12,-382.0,-104.07,918002201,03:10:02,expert,sl,Expert id 918002201,[sl 1.13313],223960299,224011366
2022.01.18 15:14:24,270469970,buy,0.16,EURUSD,1.13694,1.13313,1.14777,2022.01.18 18:24:26,1.13312,0.00,0.00,-61.12,-382.0,-165.19,918001201,03:10:02,expert,sl,Expert id 918001201,[sl 1.13313],223960300,224011367
2022.01.18 18:24:28,270523706,sell,0.08,EURUSD,1.13313,1.13695,1.12231,2022.01.19 05:21:19,1.13257,0.00,-0.06,4.48,56.0,-160.77,918001201,10:56:51,expert,client,Expert id 918001201,,224011423,224067576
2022.01.19 05:39:48,270601882,sell,0.08,EURUSD,1.13264,1.13649,1.12185,2022.01.20 03:31:12,1.13650,0.00,-0.19,-30.88,-386.0,-191.84,918001201,21:51:24,expert,sl,Expert id 918001201,[sl 1.13649],224068787,224228196
2022.01.18 17:55:05,270515118,buy,0.02,EURUSD,1.13457,1.13074,1.14536,2022.01.20 03:47:54,1.13618,0.00,-0.55,3.22,161.0,-189.17,918004201,1d 09:52:49,expert,client,Expert id 918004201,,224003250,224229770
2022.01.18 18:24:28,270523703,sell,0.04,EURUSD,1.13313,1.13695,1.12231,2022.01.20 05:17:30,1.13543,0.00,-0.13,-9.20,-230.0,-198.50,918003201,1d 10:53:02,expert,client,Expert id 918003201,,224011421,224236469
2022.01.18 18:24:28,270523704,sell,0.08,EURUSD,1.13313,1.13695,1.12231,2022.01.20 05:17:32,1.13543,0.00,-0.25,-18.40,-230.0,-217.15,918002201,1d 10:53:04,expert,client,Expert id 918002201,,224011422,224236472
2022.01.20 03:31:13,270804486,buy,0.08,EURUSD,1.13652,1.13267,1.14731,2022.01.20 05:17:41,1.13526,0.00,0.00,-10.08,-126.0,-227.23,918001201,01:46:28,expert,client,Expert id 918001201,,224228209,224236474
2022.01.18 17:17:36,270506158,sell,0.04,EURJPY,130.206,130.137,129.273,2022.01.20 18:28:00,129.273,0.00,-0.25,32.73,933.0,-194.75,918001202,2d 01:10:24,expert,tp,Expert id 918001202,[tp 129.273],223994747,224343794
2022.01.21 09:16:27,271086908,buy,0.01,EURUSD,1.13344,1.12959,1.14423,2022.01.21 09:17:30,1.13329,0.00,0.00,-0.15,-15.0,-194.90,918001201,00:01:03,expert,client,Expert id 918001201,,224466262,224466404
2022.01.21 09:17:32,271087081,sell,0.02,EURUSD,1.13329,1.13704,1.12250,2022.01.27 02:56:17,1.12361,0.00,-0.11,19.36,968.0,-175.65,918001201,5d 17:38:45,expert,mobile,Expert id 918001201,,224466406,225291747
2022.02.02 13:40:29,273129032,sell,0.01,EURJPY,129.424,129.430,129.414,2022.02.03 07:15:14,129.414,0.00,-0.05,0.09,10.0,-175.61,918001202,17:34:45,expert,tp,Expert id 918001202,[tp 129.414],226220541,226335079
2022.02.03 07:15:14,273268357,sell,0.01,EURJPY,129.391,129.397,129.381,2022.02.03 08:06:51,129.401,0.00,0.00,-0.09,-10.0,-175.70,918001202,00:51:37,expert,sl,Expert id 918001202,[sl 129.397],226335080,226337418
 
This code works great! I was wondering if you had a mq4 version?