Download MetaTrader 5
To add comments, please log in or register
Do you know that MQL5 can create custom graphical tools?
PhilipH
11
PhilipH 2011.03.07 09:28 

Hello,

 I have written an EA which uses a few technical indicators to give signals.

I want to print certain important figures, such as account balance at certain points or the number which represents the conviction of the indicators at a time when a trade is put on  

The problem I encounter is that the Print or printf function work irradically, i.e. when I Print the conviction for example, it does not show the execution details for all the trades anymore.

For example I might have 250 trades in a year, but when I let MT Print the conviction of every hour, it only shows the details of the 51st, 85th etc. trade. The other trades are simply ommitted. In the performance and on the graph I can see all the trades though.

Is there some setting or something I did wrong? Should I post my code? (This is my first time in a forum, so please let me know if this is not the way it's supposed to be done.)

Thanks,

Philip 

Documentation on MQL5: Standard Constants, Enumerations and Structures / Environment State / Account Properties
  • www.mql5.com
Standard Constants, Enumerations and Structures / Environment State / Account Properties - Documentation on MQL5
Rashid Umarov
Admin
11727
Rashid Umarov 2011.03.07 10:01  
You can see full log using Viewer - http://www.metatrader5.com/en/terminal/help/interface/toolbox/toolbox_journal#viewer

Viewing Logs

The client terminal includes a special program for viewing log files. The program can be viewed by selecting the "Viewer" command of the context menu in "Journal" and "Experts" tabs.

Journal viewer

The upper part of the window contains a search line (search is performed by exact words, the search is case sensitive) and the filter of entries (Full, Without logins, Errors only). Here time limits for search can also be set. After all necessary search data are specified, the "Request" button should be pressed.

The context menu of the viewer contains the same commands as that of the "Journal" tab.



PhilipH
11
PhilipH 2011.03.08 00:50  

Hi Rosh,

 I'm sorry, I didn't describe the problem properly.

I know about the journal. Also about the location of the full journal ( %AppData%\MetaQuotes\Terminal\...\Tester\Logs). Let me just send you the code.

I have attached the working EA. ("EA.txt")

I have also attached a few journal extracts (at least what I get):

"journal1.log" is the journal result of the code as it is. Note the missing trade printout for trades #2-16, as well as the fact that the Account Balance only shows up now and again, even though the code clearly states for the balance to come up on EVERY closing deal. (function ClosePosition(), lines 246 and 249)

"journal2.log" is now the journal result of the same code, except for the Print() at line 266 uncommented. Now note that only a couple of trades are shown, i.e. trades #6,13,23,31 etc. the rest seems to be simply ommitted, while the graph and the results take into account of ALL trades.

And I could show plenty more weird cases, where only partial journals are written.

Am I looking in the wrong place? Are there more extensive journals stored somewhere else than the above location?

Thanks for the help,

Philip 

Files:
EA.txt 13 kb
Rashid Umarov
Admin
11727
Rashid Umarov 2011.03.08 11:13  

Look for agents logs. According to jornal1.log it places at  file "C:\Users\Philip Heurich\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20110307.log"

See in your attached files similar lines

KF      0       Core 1  21:36:57        OnTester result 0
NO      0       Core 1  21:36:57        EURUSD,H1: 255454 ticks (1077 bars) generated within 1108 ms (total bars in history 7281, total time 1170 ms)
CO      0       Core 1  21:36:57        log file "C:\Users\Philip Heurich\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20110307.log" written
RD      0       Core 1  21:36:57        connect closed

You also should read http://www.metatrader5.com/en/terminal/help/startworking/structure#agent_logs

The Tester directory contains files and folders used by the Strategy Tester:

Files and Folders

Description

Subfolders

Description

Agent-IP-address-port

These folders are created for each agent of the tester. The folder name contains the IP address and port number the agent runs on.

MQL5

The file of the Expert Advisor that was tested last is stored in this folder. Expert Advisors are not saved in folders of remote agents.

logs

The entries of the agent operation journal are stored in this folder.

bases

History data used by the agent are stored in this folder.

logs

The entries of the Strategy Tester journal are stored in this folder (yyyymmdd.log). Such files are created for each Expert Advisor working day separately, their names correspond ti their creation date: yyyy year, mm month, dd day.

/Manager

This directory contains journal entries of the MetaTester component.

/Cache

This folder contains the XML-file of cache of last optimization of an Expert Advisor.

*.set

The root directory stores files with the last used sets of input parameters for each expert Advisor that was ever tested.


PhilipH
11
PhilipH 2011.03.08 14:04  
Rosh:

Look for agents logs. According to jornal1.log it places at  file "C:\Users\Philip Heurich\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\logs\20110307.log"

See in your attached files similar lines

You also should read http://www.metatrader5.com/en/terminal/help/startworking/structure#agent_logs


Hi Rosh,

 This is exactly the location that I got the two previously attached journal files from, I just renamed them to make it easier to reference them. If you look at those, you can immediately see that there are some things printed and some ommitted. Is that normal that these files do not contain every line of the EA output?

Thanks,

Philip 

Rashid Umarov
Admin
11727
Rashid Umarov 2011.03.08 14:52  
PhilipH:

Hi Rosh,

 This is exactly the location that I got the two previously attached journal files from, I just renamed them to make it easier to reference them. If you look at those, you can immediately see that there are some things printed and some ommitted. Is that normal that these files do not contain every line of the EA output?

You are wrong because I see in the attached file lines with 'Core' like this

DG      0       Core 1  21:36:56        2011.02.01 04:00:00   Stoploss price: 1.36924, entryprice: 1.3717, sl_pips: 30
PJ      0       Core 1  21:36:56        2011.02.01 04:00:00   instant buy 0.67 EURUSD at 1.37170 sl: 1.36924 (1.37156 / 1.37170 / 1.37156)
NE      0       Core 1  21:36:56        2011.02.01 04:00:00   deal #26 buy 0.67 EURUSD at 1.37170 done (based on order #26)
DL      0       Core 1  21:36:56        2011.02.01 04:00:00   deal performed [#26 buy 0.67 EURUSD at 1.37170]
ES      0       Core 1  21:36:56        2011.02.01 04:00:00   order performed buy 0.67 at 1.37170 [#26 buy 0.67 EURUSD at 1.37170]
QD      0       Core 1  21:36:56        2011.02.01 04:00:00   CTrade::PositionOpen: instant buy 0.67 EURUSD at 1.37170 sl: 1.36924 [done at 0.00000]

It means this is a tester log not agent one.

Agent log looks like this

IQ      0       Network 14:48:23        16 bytes of tester parameters received
HD      0       Tester  14:48:23        optimization pass 741 started
CJ      0       Tester  14:48:23        initial deposit 1000000.00 USD, leverage 1:100
MO      0       Tester  14:48:23        EURUSD,M15 (MetaQuotes-Demo): every tick generating
EN      0       Tester  14:48:23        EURUSD,M15: testing of Experts\Examples\Moving Average\Moving Average.ex5 from 2011.01.11 00:00 to 2011.01.12 00:00 started with inputs:
NL      0       Tester  14:48:23          MovingPeriod=49
FG      0       Tester  14:48:23          MovingShift=22
EH      0       Tester  14:48:23          MaximumRisk=0.02
NQ      0       Tester  14:48:23          DecreaseFactor=3
OG      0       Tester  14:48:23        output to log disabled
RG      0       Tester  14:48:23        OnTester result 0
/
To add comments, please log in or register