stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Individual trade analyzer Excel
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=4164
Page 2 of 2
Author:  renexxxx [ Thu Mar 12, 2015 2:41 am ]
Post subject:  Individual trade analyzer Excel

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,
Author:  Spectre [ Thu Mar 26, 2015 6:56 pm ]
Post subject:  Individual trade analyzer Excel

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.
Author:  renexxxx [ Mon Oct 19, 2015 1:46 am ]
Post subject:  Individual trade analyzer Excel

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.
Author:  milanese [ Mon Oct 19, 2015 6:27 am ]
Post subject:  Individual trade analyzer Excel

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
Author:  luke [ Thu Oct 22, 2015 9:14 pm ]
Post subject:  Individual trade analyzer Excel

This is awesome :yahoo:

Thank you for this. Seriously cool and helpful. :good:
All times are UTC Page 2 of 2