What on earth is going on? - page 8

 
Сергей Таболин:

Dear, just a word, because no one for whom working with files is important, until I printed it out, either, suggested that this might be the problem ;) :) Anyway, that's sorted.

Now a distracted question: what is the difference between the following lines?

   filename = "ERR_dir\\"+filename+(MQLInfoInteger(MQL_OPTIMIZATION) ? ".opt" : ".tst");
   filename = "ERR_dir\\"+filename+(MQLInfoInteger(MQL_TESTER) ? ".tst" : ".opt");

And, if possible, explanations - why?

Mode of optimization

Tester-mode

The tester mode includes the optimization mode, but not vice versa.

Your both lines are wrong.

The first one:

If optimisation mode, the extension is .opt, otherwise the extension is .tst. But in case of "otherwise", it may not be a tester at all.

Second:

If tester mode, the extension is .tst, otherwise the extension is .opt. But in the case of 'otherwise' it may not be a tester at all.

Right:

  • If tester mode.
    • If optimisation mode, the extension .opt
      • otherwise, the extension .tst
 
Artyom Trishkin:

Optimisation mode

Tester mode

Tester mode includes optimisation mode, but not vice versa.

Your two lines are both wrong.

The first one:

If optimisation mode, the extension is .opt, otherwise the extension is .tst. But in case of "otherwise", it may not be a tester at all.

Second:

If tester mode, the extension is .tst, otherwise the extension is .opt. But in the case of 'otherwise' it may not be a tester at all.

Right:

  • If tester mode.
    • If optimisation mode, the extension .opt
      • otherwise, the extension .tst

this is enough.

Unless, of course, you want to check if the EA works in chart or tester mode.

 
Andrey Dik:

that's enough.

And if not a tester at all, what is?

 
Artyom Trishkin:

And if not a tester at all, then what?

it does not have the task of checking in the tester or on a chart run, but only to determine whether it is a simple run on history or as part of an optimization package, if I understand TC correctly

 
Andrey Dik:

it does not have the task of checking in the tester or on the chart run, but only to determine whether it is a simple run on history or as part of an optimization package, if I understand TC correctly

Exactly right. If it's not a tester or optimizer, it doesn't come here at all )))

Artem, if I understood correctly, my such design

if(MQLInfoInteger(MQL_OPTIMIZATION) || MQLInfoInteger(MQL_TESTER))

is superfluous?

It will be enough

if(MQLInfoInteger(MQL_TESTER))

?

 
Maxim Kuznetsov:

if the file is written to COMMON, it is mandatory to have SHARE_READ and a rather tricky write race control. It's kind of decent not to shoot the heel in public.

In general, it's good practice that advisors don't write anything in the common. They can read it, but it is written or copied there by the trader who is personally responsible for this. For all Expert Advisors in all terminals, these are words given from above.

If a file is written to a usual directory without SHARE_XXX, but the optimizer generates errors of shared access, then it is a bug of terminal developers

So, the Expert Advisor does not write anything there, it only reads.


P.S. In addition, it's the only one that reads it (so far).
 
Сергей Таболин:

But the Expert Advisor itself doesn't write anything there, it only reads it.


P.S. Besides it reads only it (the only copy so far).

If in COMMON, SHARE_READ is obligatory.

as in the joke - "you can't understand it, you have to remember it" :-)

PS/ when in tester - it reads not only from (separate per group) common but also from all copies being tested in parallel. By the way, this is also a potential bug - it seems it is possible to fool the tester and draw a grail

 
Maxim Kuznetsov:

if in COMMON, SHARE_READ is mandatory.

Well, it's not mandatory.

The multi-access is not as good as you'd like it to be.

 
Andrey F. Zelinsky:

Well, it doesn't have to be.

Multi-access isn't all it's cracked up to be.

I hope there are no problems with multi-access in read-only mode? Or is there?

 
Сергей Таболин:

Exactly right. If not a tester or optimiser, you don't get in here at all )))

Artem, if I understood correctly, then my such construction

is superfluous?

It will be enough

?

No. On the contrary.
Well that's if you need half-measures.
Reason: