Questions from Beginners MQL5 MT5 MetaTrader 5 - page 617

 
Alexander Kharlamov:

Hello!

MT4 has a command if (IsTesting()

Is there an analogue in MT5?

I would like to ask you a couple of questions, thank you.

P.S. And another thing - in normal mode my Expert Advisor writes a log file, but if I run it in tester in MT5, I don't see it in the usual Tester folder, as it was in M4.

Choose what you need:

ENUM_MQL_INFO_INTEGER

Identifier

Description

Property type

MQL_MEMORY_LIMIT

Maximum possible size of dynamic memory for an MQL5 program in MB

int

MQL_MEMORY_USED

How much memory an MQL5 program uses in MB

int

MQL_PROGRAM_TYPE

Type of mql5-program

ENUM_PROGRAM_TYPE

MQL_DLLS_ALLOWED

Permission to use the DLL forthis running program.

bool

MQL_TRADE_ALLOWED

Permissionto trade forthis running program

bool

MQL_SIGNALS_ALLOWED

Allowto work with signals ofthis program

bool

MQL_DEBUG

Sign of a running program in debug mode

bool

MQL_PROFILER

Sign of running a program in the code profiling mode

bool

MQL_TESTER

Sign of running a program in the tester

bool

MQL_OPTIMIZATION

Sign of a running program during optimization

bool

MQL_VISUAL_MODE

A sign that a running program is in visual testing mode

bool

MQL_FRAME_MODE

Sign of running the Expert Advisor on a chart in theframe mode of collecting optimization results

bool

MQL_LICENSE_TYPE

The license type of the EX5 module. The license refers to the EX5 module, from which the request is made using MQLInfoInteger(MQL_LICENSE_TYPE).

ENUM_LICENSE_TYPE

About the files:FileOpen help

The file is opened in the client terminal folder in subfolder MQL5\Files (or in case of testing, in folder_agent_testing\MQL5\Files). If FILE_COMMON is specified among the flags, the file is opened in the common folder of all the client terminals \Terminal\Common\Files.

For example data directory

C:\Users\KVN\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Files,

then the directories of the test agents (using agent #1 as an example) will be here:

C:\Users\KVN\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Files

 
Karputov Vladimir:

Choose what you need:

ENUM_MQL_INFO_INTEGER

Identifier

Description

Property type

MQL_MEMORY_LIMIT

Maximum possible size of dynamic memory for an MQL5 program in MB

int

MQL_MEMORY_USED

How much memory an MQL5 program uses in MB

int

MQL_PROGRAM_TYPE

Type of mql5-program

ENUM_PROGRAM_TYPE

MQL_DLLS_ALLOWED

Permission to use the DLL forthis running program.

bool

MQL_TRADE_ALLOWED

Permissionto trade forthis running program

bool

MQL_SIGNALS_ALLOWED

Allowto work with signals ofthis program

bool

MQL_DEBUG

Sign of a running program in debug mode

bool

MQL_PROFILER

Sign of running a program in the code profiling mode

bool

MQL_TESTER

Sign of running a program in the tester

bool

MQL_OPTIMIZATION

Sign of a running program during optimization

bool

MQL_VISUAL_MODE

A sign that a running program is in visual testing mode

bool

MQL_FRAME_MODE

Sign of running the Expert Advisor on a chart in theframe mode of collecting optimization results

bool

MQL_LICENSE_TYPE

The license type of the EX5 module. The license refers to the EX5 module, from which the request is made using MQLInfoInteger(MQL_LICENSE_TYPE).

ENUM_LICENSE_TYPE

About the files:FileOpen help

The file is opened in the client terminal folder in subfolder MQL5\Files (or in case of testing, in folder_agent_testing\MQL5\Files). If FILE_COMMON is specified among the flags, the file is opened in the common folder of all the client terminals \Terminal\Common\Files.

For example data directory

C:\Users\KVN\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Files,

then the directories of the test agents (using agent #1 as an example) will be here:

C:\Users\KVN\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Files

Thank you, with the replacement of IsTesting immediately understandable, and the log file to sort out, in trade mode, I write the file, but in the test is not. (
 
Alexander Kharlamov:
Thank you, I understand everything at once with replacement of IsTesting, and I'll deal with the log file, in trade mode my file is written, but in the test it is not. (
In the Strategy Tester, just click on the "Log" tab, then right-click and select the topmost item on the context menu: "Open". This will launch the Explorer, which will immediately open the folder with the logs of the Strategy Tester.
 
Can you please tell me if I put one EA on 10 different charts or on 10 identical charts, but with different TFs, do I have to go to the properties of the EA on each chart and change the Magic number?

Thank you
 
Ivan Butko:
Can you please tell me if I put one EA on 10 different charts or on 10 identical charts, but with different TFs, do I need to go to the properties of the EA on each chart and change the Magic number?

Thank you
If you put it on different charts, most likely it will be ok. If you put it on the same chart with different TF, most likely it will not work correctly, but to get an exact answer to your question, you have to look at the code.
 
BlackTomcat:
To avoid the hassle of finding the logs folder, simply switch to the "Log" tab in the Strategy Tester, click there and select "Open" from the context menu that opens. This will launch the Explorer, which will immediately open the folder with the logs of the Strategy Tester.
I wrote not about the standard log that you're talking about. I create my own log and write in it what I need. in trade works in the tester does not create the file.
 
Alexander Kharlamov:
I didn't write the standard log you're talking about. I create my own log and write in it what I need. in trade works in the tester does not create the file.

However you try to create the file - the files will be created inside the sandbox. How to find files:

Forum on trading, automated trading systems and trading strategy testing

Questions from Beginners

Karputov Vladimir, 2016.09.06 10:19

...

About the files:FileOpenhelp

The file is opened in the client terminal folder in subfolder MQL5\Files (or in case of testing, in the_agent_testing_directory\MQL5\Files). If FILE_COMMON is specified among the flags, the file is opened in the common folder of all the client terminals \Terminal\Common\Files.

For example data directory

C:\Users\KVN\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Files,

then the directories of the test agents (using agent #1 as an example) will be here:

C:\Users\KVN\AppData\Roaming\MetaQuotes\Tester\D0E8209F77C8CF37AD8BF550E51FF075\Agent-127.0.0.1-3000\MQL5\Files


TERMINAL_DATA_PATH will also help.
 
Karputov Vladimir:

However you try to create the file - the files will be created inside the sandbox. How to search for files:


TERMINAL_DATA_PATH would also help!

Here it is like in MT5!!! )) found it! )) THANK YOU!

Was looking in the terminal folder and it's in the Tester folder ... but not the one in the Terminal folder!

 

Tell me, did I write the closing price indicator correctly or are there pitfalls I haven't considered?

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
#property  indicator_color1  clrRed
#property  indicator_type1   DRAW_LINE 

double Buffer[];

void OnInit()
{
  SetIndexBuffer(0, Buffer, INDICATOR_DATA); 
}

int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[] )
{
  return(rates_total - prev_calculated + ::ArrayCopy(Buffer, close, prev_calculated, prev_calculated));
}
 
Can you tell me why this might be the case? :
//--- По отдельности

Fun_1();     // Работает
//----------------------
Fun_2();     // Работает

//--- Совместно

Fun_1();     // Работает
Fun_2();     // не Работает
//----------------------
Fun_2();     // Работает
Fun_1();     // не Работает
Fun_1() and Fun_2() are similar.
Reason: