Is it possible to Export trades from MT5 to Excel in real time

Dean-Trades  
Hi,

How would I go about connecting MT5 to Excel and exporting trades in real time to Excel automatically?

Thanks
Fernando Carreiro  
Dean-Trades: How would I go about connecting MT5 to Excel and exporting trades in real time to Excel automatically?

You will have to write MQL code (a program) to export the data.

Usually you would export it to a file in a form that will be readable by Excel, for example a CSV file.

If you want real-time communications, then you will have to use DLL calls to communicate with Excel directly.

EDIT: Another alternative is use the Python integration.

Dean-Trades  
Fernando Carreiro #:

You will have to write MQL code (a program) to export the data.

Usually you would export it to a file in a form that will be readable by Excel, for example a CSV file.

If you want real-time communications, then you will have to use DLL calls to communicate with Excel directly.

Okay. So it's possible to do then? It surprised me that I struggled finding anyone talking about it before. I search loads of places and could only find people talking about exporting real time data in the form of prices etc but not trade history
Fernando Carreiro  
Dean-Trades #: Okay. So it's possible to do then? It surprised me that I struggled finding anyone talking about it before. I search loads of places and could only find people talking about exporting real time data in the form of prices etc but not trade history.

That is strange! It has been asked many times on the forum, and if you search the CodeBase there are several publications of example code for exporting trade history, most of them to CSV which Excel can read, but also in real-time via the use of DDE.

Dean-Trades  
Fernando Carreiro #:

That is strange! It has been asked many times on the forum, and if you search the CodeBase there are several publications of example code for exporting trade history, most of them to CSV which Excel can read, but also in real-time via the use of DDE.

I did have a look there earlier but the only ones I could find were outdated or commenters said they had issues getting it to work
Fernando Carreiro  
Dean-Trades #: I did have a look there earlier but the only ones I could find were outdated or commenters said they had issues getting it to work

Is that sufficient reason to ignore them?

You asked — "Is it possible to Export trades from MT5 to Excel in real time?" — then the answer is obviously yes, based on those examples.

You also asked — "How would I go about connecting MT5 to Excel and exporting trades in real time to Excel automatically?"

Even if outdated, they are still references to "how" to do it. By studying them, you may discover that some are still fully functional or only need minor corrections.

If however, you don't want to waste your time studying them, learning, correcting or implementing your own version, then consider using the Freelance section and hire someone to do it for you.

EDIT: You also stated "struggled finding anyone talking about it before" and "people talking about exporting real time data in the form of prices etc but not trade history", yet by your own admission, you did find several examples of what you are looking for. They may not be exactly what you want, but the information is there to start you off.

Trading applications for MetaTrader 5 to order
Trading applications for MetaTrader 5 to order
  • 2022.06.26
  • www.mql5.com
The largest freelance service with MQL5 application developers
Dean-Trades  
Fernando Carreiro #:

Is that sufficient reason to ignore them?

You asked — "Is it possible to Export trades from MT5 to Excel in real time?" — then the answer is obviously yes, based on those examples.

You also asked — "How would I go about connecting MT5 to Excel and exporting trades in real time to Excel automatically?"

Even if outdated, they are still references to "how" to do it. By studying them, you may discover that some are still fully functional or only need minor corrections.

If however, you don't want to waste your time studying them, learning, correcting or implementing your own version, then consider using the Freelance section and hire someone to do it for you.

EDIT: You also stated "struggled finding anyone talking about it before" and "people talking about exporting real time data in the form of prices etc but not trade history", yet by your own admission, you did find several examples of what you are looking for. They may not be exactly what you want, but the information is there to start you off.

I meant, I didn't find any working solutions. I found a few outdated solutions that no longer work because either, MT5 no longer supported it or it was flawed to begin with, as users in the comment section mentioned they never got it working.

So, I created a post to see if there was something obvious I was missing. Perhaps a current working version or perhaps someone may have responded and said "you cannot do that" or "it used to work with older versions but no longer with newer versions".

I had been searching for ages and hoped that by creating a post here, it would save some time.

Instead it sounds like it annoyed you.
Fernando Carreiro  
Dean-Trades #: I meant, I didn't find any working solutions. I found a few outdated solutions that no longer work because either, MT5 no longer supported it or it was flawed to begin with, as users in the comment section mentioned they never got it working. So, I created a post to see if there was something obvious I was missing. Perhaps a current working version or perhaps someone may have responded and said "you cannot do that" or "it used to work with older versions but no longer with newer versions". I had been searching for ages and hoped that by creating a post here, it would save some time. Instead it sounds like it annoyed you.

It did not annoy me and I was not being rude! I was simply pointing out that sometimes things can be so obvious, that our minds don't recognise it because we are overwhelmed by the prospect of a daunting project.

But once we calm down and start looking at things more pragmatically, we find that there is actually a lot of information at our disposal and we just need to take it one step at a time in an organised way.

Reason: