Individual trade analyzer Excel

User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Individual trade analyzer Excel

Post by renexxxx »

Hereby the requested indicator.

You can filter trades to be monitored via the MagicNumber input variable. The default value of -1, means that it will monitor all trades.

To see it in action: Add this TradeReporter indicator to a chart (any chart will do, it doesn't depend on incoming ticks, instead it uses the Timer event to get started). The indi will instantly start recording and updating the High and Low water marks of all the open trades. These values can be observed in the Global Variables panel (Tools -> Global Variables or F3).

If and when a trade is closed (you can do this manually for instance to test the indi), a line is added to a file in the MQL4\Files area. The file name defaults to allTrades.csv.

The line will have the following information:

Code: Select all

Ticket;Symbol;OrderLots;OpenPrice;OpenTime;HighWater;LowWater;ClosePrice;CloseTime;Magic;Comment;PipFactor
I have chosen the ';' (semi-colon) as the field separator character, instead of the comma, as some countries use comma's as a thousands-separator in numbers. So, make sure when opening the .csv file in Excel that you select the ';' (semi-colon) as the field separator.

The PipFactor is important to convert price differences to PIPs. Just multiply the price difference by the PipFactor to get PIPs. I am sure you know all about that.

As mentioned it is important to keep this indi running at all times -- otherwise it will miss price movements outside the already recorded High and Low water marks.

Have fun,
You do not have the required permissions to view the files attached to this post.
Spectre
Trader
Posts: 39
Joined: Mon Nov 05, 2012 6:18 am
Location: Norway, the most taxed place on earth(maybe)

Individual trade analyzer Excel

Post by Spectre »

Sorry for not replying sooner.

The logger worked really good. There will always be something the can be changed, but overall this is very good. :clap:

Thank you.

Enclosed is a sample of the data the logger will print in Excel format.
Trades were just a simple open every bar EA, just to get some data.

And again, a huge thanks to Steve for bringing this group together. You are a star, i will raise my glass to you and this forum.
You do not have the required permissions to view the files attached to this post.
" I'm not an alcoholic, i'm australian " - Lance
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

Individual trade analyzer Excel

Post by renexxxx »

I got an PM with a request to modify this TradeReporter, such that it would in real time update the open trade records (including closeTime, closePrice, highWater, lowWater etc). This information needs to be viewable in Excel.

The problem with flat files (such as CSV-files) is that they have no indexed access. So, if you want to update the n-th line in such file, you will have to delete the file first and then re-create a new file from the information in your program. This becomes a little inefficient if you do this every 5 seconds or so. Databases do have indexed access to tables, so I thought I'd store the information in a (mySQL) database.

This stuff is not for newbies, or those who are 'computer unfriendly'. If you are one of those, move on to the next post. I will not answer questions on how to setup mySQL, or how to connect mySQL to Excel/OpenOffice/LibreCalc. In fact, there are not a lot questions that I will answer. Take the code as is, if it works for you as it does for me, great, if not throw it in the bin -- I don't care. But, and this is the reason for sharing, there are people on this forum who would benefit from this code, and will be able to use it to their advantage.

Edit 20.10.2015t: There was a little problem in Trade2MySQL.mq4, to do with the memory management. This has now been resolved. Please re-download.
You do not have the required permissions to view the files attached to this post.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Individual trade analyzer Excel

Post by milanese »

renexxxx » Mon Oct 19, 2015 1:46 am wrote:I got an PM with a request to modify this TradeReporter, such that it would in real time update the open trade records (including closeTime, closePrice, highWater, lowWater etc). This information needs to be viewable in Excel.

The problem with flat files (such as CSV-files) is that they have no indexed access. So, if you want to update the n-th line in such file, you will have to delete the file first and then re-create a new file from the information in your program. This becomes a little inefficient if you do this every 5 seconds or so. Databases do have indexed access to tables, so I thought I'd store the information in a (mySQL) database.

This stuff is not for newbies, or those who are 'computer unfriendly'. If you are one of those, move on to the next post. I will not answer questions on how to setup mySQL, or how to connect mySQL to Excel/OpenOffice/LibreCalc. In fact, there are not a lot questions that I will answer. Take the code as is, if it works for you as it does for me, great, if not throw it in the bin -- I don't care. But, and this is the reason for sharing, there are people on this forum who would benefit from this code, and will be able to use it to their advantage.
thanks for this !

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
luke
Trader
Posts: 17
Joined: Fri Aug 14, 2015 7:03 am

Individual trade analyzer Excel

Post by luke »

This is awesome :yahoo:

Thank you for this. Seriously cool and helpful. :good:
Post Reply

Return to “Coders Hangout”