Libraries: Report

 

Report:

The MetaTrader 4/5 library allows generating reports based on the trading history.

Author: fxsaber

 

Добавление этих двух строк так же сохранит отчеты каждого прохода оптимизатора.

This allows, without waiting for the end of the optimisation, to immediately see in detail any already calculated pass of interest. After the end of optimisation, there is no need to repeatedly run and wait for the corresponding single runs. Allows you to quickly and clearly view all the results calculated by the optimiser. Display balance graphs (PNG files) of multiple single runs on one screen as thumbnails, etc.

Only now I realised that the same could be done for MT4.

 
fxsaber:

Hello.

The report in the form of a graph as you have on the screen is not available for 4 ?


 
Sergey Kolemanov:

The report in the form of a graph as you have on the screen is not available for 4?

Not available by default, but you can do it this way

// Report with chart under MT4
#property strict

// https://www.mql5.com/en/docs/standardlibrary/graphics/cgraphic
#include <Graphics\Graphic.mqh> // MQL5\Include\Graphics\Graphic.mqh
#include <Report.mqh> // comment out lines 295, 350, 382, 404, 434, 455.

void OnStart()
{
// REPORT::ToChart(); // outputs the chart to chart
  REPORT::ToFile("Report.htm"); // saves the report together with the graph
}
 

Standard MT4 tester reports do not contain data on comments.

And all reports (MT4/5 regular and tester) do not contain data on majicks.


This library always shows both majicks and comments.

The library is written in such a way that embedding of other indicators is done simply

const string REPORT:: Shablon = FIELD(N) + FIELD(Ticket) + FIELD(OpenTime) + FIELD(Type) + FIELD(Lots) + FIELD(Symbol) +
                                FIELD(OpenPrice) + FIELD(StopLoss) + FIELD(TakeProfit) + FIELD(CloseTime) + FIELD(ClosePrice) +
                                FIELD(Commission) + FIELD(Swap) + FIELD(Profit) + FIELD(Comment) + FIELD(MagicNumber);

  static string OrderToString( const int Num )
  {
//...
    ADD(Ticket, OrderTicket());
    ADD(OpenTime, OrderOpenTime());
//...

For example, it is possible to add fields of slippage values of each position (available in MT5) or additional comments.

Forum on trading, automated trading systems and testing trading strategies

Script for commenting MT4 or MT5 trades

Alexander Bykov, 2017.07.24 11:49 AM.

Hi, the issue of commenting trades in MT has become relevant. Imagine a situation - a trade requires coverage of the situation at some time point, for example, let's say you have an investor request as a manager. A count is provided, everything is cool, but there is no commentary. And the report for the month, here is the work, sit and remember. It will be convenient to make a script "Hot commenting" in MT4 or MT5. If there is such a posted, where, attach a link, it may be called as.
 

As it turned out, the library can be useful when dealing with "Single run does not match Optimisation result" situations.

Currently, the only thing missing is the Agent's build data in the report on which the calculation was made.

 
fxsaber:

As it turned out, the library can be useful when dealing with "Single run does not match Optimisation result" situations.

Currently, the only thing missing is the Agent build data in the report on which the calculation was made.

What does TERMINAL_BUILD return on the agent?

 
Stanislav Korotky:

What does TERMINAL_BUILD return on the agent?

Your build.

 
fxsaber:

Your build.

There is no confusion with __MQL5BUILD__? TERMINAL_BUILD should be taken from the rantime (and the agent does not have "its own build", but its own build).

 
Stanislav Korotky:

There is no confusion with __MQL5BUILD__? By idea, TERMINAL_BUILD should be taken from rantime (and the agent does not have "its own build", but its own build).

Well, these are quite different indicators.

 
fxsaber:

Well, that's a very different metric.

Of course they are. I just wonder why a programme running on the agent should return the TERMINAL_BUILD of the local terminal? [Of course it should be requested in event handlers running on the agent.] If it is so (though I doubt it), it looks like a bug.