Discussion of article "Tips from a professional programmer (Part II): Storing and exchanging parameters between an Expert Advisor, scripts and external programs" - page 2

 
The article is poorly developed.
Examples of parameters
  • Zero bar time
....
Where to store such parameters?
Why store the time of the zero bar in one of the suggested places?

From the table: the lifetime of a file is limited by the lifetime of the file. What's not to like "the lifetime of a global variable is limited by the lifetime of a global variable" :)))?

For packing arbitrary data into global variables it is better to use union.

Nothing is said about binary files....
 
Recently the level of articles has been falling in the sense of complexity of ideas, approaches, but not all of them, of course.
 

...

As you know, the OnInit handler of an Expert Advisor is triggered not only when it is launched, but also when the timeframe is changed. In fact, each time the timeframe is switched, the variables are reset and initialised again, except for the Expert Advisor parameters.

...

Incorrect. This is what happens in the indicator. When parameters are changed and the symbol/timeframe of the chart is changed, the Expert Advisor is not reinitialised.

Now, as for information transfer between Expert Advisors/indicators/services, etc.

  1. Global terminal variable - aha, the robot trades with real money, and its work is based on the data, to which everyone has access: indicators, scripts, other experts, user's children, the user himself with naughty hands....
  2. A graphical object on a chart is the same.
  3. Comments to orders - DC can change them (oops).
  4. File (binary is better) - probably the best of all listed in the article, but the developers never answered (or I missed) the question about synchronisation of file sharing. And it's a crutch.

That leaves only EventChartCustom(...), with all its disadvantages.

So, tick the box to allow import of dll and start doing the right thing, or, better, no way.

 
Aliaksandr Hryshyn:
1) The article is poorly developed.
Examples of parameters
  • Time of zero bar
2) Why store the zero bar time in one of the suggested locations?

3) From the table: the lifetime of a file is limited by the lifetime of the file. What's wrong with "the lifetime of a global variable is limited by the lifetime of a global variable" :)))?

4) To pack arbitrary data into global variables, it is better to use union.

5) Nothing is said about binary files....

1) I was praised by the moderator.

2) so as not to run the bar analysis repeatedly

3) the lifetime of the file is longer than that of the global variable

4) I showed one of the ways of packing

5) I don't use them

 
Vladimir Simakov:

...

a) Incorrect. This is what happens in the indicator. When parameters are changed and symbol/timeframe of the chart is changed, the Expert Advisor is not reinitialised.

Now, as for information transfer between Expert Advisors/indicators/services, etc.

  1. Global terminal variable - aha, the robot trades with real money, and its work is based on the data, to which everyone has access: indicators, scripts, other experts, user's children, the user himself with naughty hands....
  2. A graphical object on a chart is the same.
  3. Comments to orders - DC can change them (oops).
  4. File (binary is better) - probably the best of all listed in the article, but the developers never answered (or I missed) the question about synchronisation of file sharing. Oh, and it's a crutch.

b) So, tick the box to allow dll import and start doing it right, or, better, not at all.

a) I agree that reinitialisation of Expert Advisor variables is not done

1-2) we are talking about exchange between your EA and scripts. If you want, you can encrypt the information ;-)

3) the DC can add something to the end in MT4. There is no such thing in MT5, at least for me ;-)

4) Well, I usually use the flag FILE_SHARE_READ.

int file = FileOpen(path, FILE_SHARE_READ|FILE_UNICODE);

b) if you do it for yourself, then as they say "flag in your hands....".

If you do it for the market, DLLs don't pass there.

 
Malik Arykov:

(a) Agrees that there is no reinitialisation of EA variables

1-2) we are talking about the exchange between the Expert Advisor and scripts. You can encrypt the information if you want ;-)

3) to add something to the end in MT4. There is no such thing in MT5, at least for me.

4) Well, I usually use the flag FILE_SHARE_READ

b) if you do it for yourself, then as they say "flag in your hands....".

If you're doing it for the market, DLLs don't pass there.

1-2) So encrypt or not encrypt, but you can still change/delete it)))))

3) If it is not explicitly stated that you can not, then ... Personally, I'm not sure I'm going to be able to do that.

4) I'm not talking about that, I'm talking about the situation of data "races" when sharing a resource from different threads. Run the two attached scripts on different graphs. Run write first. This is the answer to my long-standing question about metaquotes. And, again, in the context of the test result, which I finally got to (thanks to TC) and the question to them: where are the native synchronisation primitives?

This is also the answer why it is somehow mauvais for a professional to do such a thing in the market without warning huge letters to customers.

Files:
write.mq5  2 kb
read.mq5  2 kb
 
Vladimir Simakov:

....

All the examples from my articles, work fine for me (in my EA and scripts)

 
Malik Arykov:

All the examples from my articles, I have them working fine for me (in my EA and scripts)

My post is not about what does not work, but about the fact that data security and integrity are not ensured. When using all of the above methods of data transfer, the reliability of the mechanism is not ensured. Moreover, it is related not to possible bugs of third-party systems (Terminal, OS, hardware bugs), but to the method itself: collision of names or user actions in case of global terminal variables, the same + deletion functions for graphical objects, lack of synchronisation for operations of reading and writing to a file from different threads.

Yes, the probability of this can be reduced to very low values, but not to 0. That's what you should keep in mind)

 
Vladimir Simakov:

My post isn't about what doesn't work, it's about not ensuring data security and integrity. When using all of the above methods of data transfer, the reliability of the mechanism is not ensured. Moreover, it is related not to possible bugs of third-party systems (Terminal, OS, hardware bugs), but to the method itself: collision of names or user actions in case of global terminal variables, the same + deletion functions for graphical objects, lack of synchronisation for operations of reading and writing to a file from different threads.

Yes, the probability of this can be reduced to very low values, but not to 0. This is what you should keep in mind)

Storing parameters in files provide 100% reliability. All your "collisions" are solved by prefixes of object names, including global variables.

For example, level parameters are stored in Files\Cayman\Params\128968168864101576\exp_05_Lev607A160E_H4.txt. Where 128968168864101576 is ChartID. Nobody knows about this file except the analyser of this particular level. Take any piece of code from the article and try to "break" it ;-) If you break it, I will show you where you made a mistake ;-)

 
void OnStart()
  {
   while(!IsStopped())
      for(int i=GlobalVariablesTotal();i>=0;--i)
         GlobalVariableSet(GlobalVariableName(i),MathRand());
  }

Something like this script in any EA/indicator/script/service run by a curious user, and you have fun weeks of searching for an unreproducible bug that doesn't exist)))))