View Full Version : Metatrader to Excel and back
Hi: Thank you for posting these tools. Very helpful thus far. Got them installed and functioning on Windows 10. The EA writes the information to the excel file just fine provided that the datafile remains untouched. When I mention the cells which are receiving the put values from another tab at the worksheet, the upgrades ceased with the following listed to the log file: Error on PutDouble_Cell: System.Runtime.InteropServices.COMException (0x800AC472): Exception from HRESULT: 0x800AC472 in System.RuntimeType.ForwardCallToInvokeMember(Strin g memberName,... Let me answer the questions first
1. This occurs since, technically, when the DLL is calling excel, it is utilizing the UI thread of excel (except when opening the workbook; there is just 1 thread for excel you'll have when opening the work book). Once I created this, I didn't construct a dll to be used. I had been'in a hurry'. So I left the multi threaded facet out along with error checking.
2. No. I left it out due time constraints.
If you're interested in the source code, then have a look at it here: https://github.com/Nondisclosure/MT4toExcel
Thank you for answering my query and also for the response. I thought it might be something like this but I am not a coder and would not know. I managed to generate a few modifications to the code from the test document so that it loops through each one the MT4 symbols and pulls down the emblem, bid, ask, and spread and write it into the document. I separated the document from the rest of my analysis so it could run/update without throwing the error. When it opens, it always does it read-only mode without any data is actually written to the document (it is all stored in the temp file), until it is manually saved. When it is saved, then it can be queried by me from a different workbook without causing it to throw the error and stop upgrading. I've worked around it for the time being.
I did have a look at the code on github simply to see if I could understand what is going on in your dll. It was easy to follow. A couple minor modifications could make it useful. . .as you mentioned, the multithreading, conserving it automatically from the temp file into the written document so that the values having it not open duplicate copies of this document if it is already opened, and are accessible/referenceable. I would love being able to do them myself but I am not a developer and would not know where to start.
I am happy it is functioning at all and that I can pull those values directly into glow from my broker. Thank you for posting it.
Thank you for the timely response and also for answering my question. I thought it may be something like this but I'm not a coder and would not know. I managed to generate a few modifications to the code in the test file so that it loops through all of the MT4 symbols and pulls down the emblem, bid, ask, and spread and write it to the excel file. I separated the file in the rest of my analysis so it can run/update without throwing the error. If it opens, it always does it in read-only mode without any data is actually written to the file (it's... I've been really busy recently. But I'll attempt to get to work on it.
1 Attachment(s) Hi,
I have been looking for a way to export the information in my chart, and the indicator values to excel for information analysis to construct an EA. A buddy sent me to this connection, and I am using Mt4
1. Place MetatraderToExcel.mqh on your include folder [ I don't find an Include folder] see attachment
2. Put test dll.mq4 on your experts folder
3. Put the dll contained in the zip file on your own libraries folder (the libraries folder under your MQL4 directory). [ I don't find an Include folder] see attachment
4. Review the evaluation dll.mq4 file.
PLEASE ADVISE
https://www.forexforum.co.za/general-forex-discussion/312-disappointed.html
Hi, I have been looking for a way to export the information on my chart, and the indicator values to excel for information analysis to construct an EA. A friend sent me to this connection, and I am utilizing Mt4 1. Put MetatraderToExcel.mqh on your include folder [ I don't see an Include folder] see attachment two. Put test dll.mq4 on your specialists folder 3. Put the dll within the zip file on your own libraries folder (the libraries folder beneath your MQL4 directory). [ I don't see an Include folder] see attachment 4. Review the test dll.mq4 file. PLEASE ADVISE file within your MQL4 folder.
MetareaderToExcel Folder just has
MetatraderToExcel.dll
is this right
Cesnesctt41
29-03-2025 17:42,
Interesting work. Thanks and
Regards
Interesting work. Thank you and Regards Thanks.
Interesting function. Thank you and Regards Read the instructions again.
It's easy actually.
1. Put MetatraderToExcel.mqh on your include folder
2. Put test dll.mq4 on your experts folder
3. Put the dll contained in the zip file on your own libraries folder (the libraries folder under your MQL4 directory).
4. Review the test dll.mq4 file.
There are 3 put functions and 3 get works. Each with 3 overloads. The overloads are on how you need to address each cell.
The 2 inputs that are used is:
1. Where's the excel file you are going to be writing to
2. Where do you wish to compose any errors the DLL generates to
Some notes:
1. You will need the full version of the .Net framework 4.6 installed (https://www.microsoft.com/en-us/download/details.aspx?id=48137)
2. When you operate the Start function, it will open a new instance of Excel and a new instance of your file when it isn't already open.
Source code for the DLL can be found here: https://github.com/Nondisclosure/MT4toExcel
Have fun!
https://www.forexforum.co.za/trading-systems/90-trading-journal-245-a.html
https://www.forexforum.co.za/attachments/1519028158288727088.mq4
https://www.forexforum.co.za/attachments/1519028160732829035.zip
Powered by forexforum.co.za® Version 4.2.5 Copyright © 2026 forexforum.co.za Solutions, Inc. All rights reserved.