How to ensure that the EA only works on the chart where it was first dropped - page 5

 
Itso:

In "big" programming they use mutex

Thanks, didn't know about it. It's a cool thing, if you use mutex name to convey meaningful information.

but it's almost an analogue of the global variable in MT4. it does not solve my problem: after starting the mutex first, it can create the EA that was "second" and it has not been allowed to work.


damn - the name of the subject is wrong, but I don't know how to phrase it in a few words :(

 
granit77:
Why not use this, the simplest option? The Expert Advisor creates a control file and checks for the existence of the file before doing so. If the file of the same name already exists, the EA will not start. If the EA exits the chart correctly, it will erase the file. If a crash occurs, the remaining file blocks the launch of any instance of the EA and it is deleted manually in order to continue working.


And this is the point - when the terminal crashes . another EA looks into the file - sees not its ID and crashes...

If you don't want it in a file, write it in the registry - also your topic, by the way.

 
ForexTools:


Damn - the name of the topic is wrong, but I don't know how to phrase it properly in a few words :(


Well, like, "How to limit the work of the EA (no more than one working instance)?"
 
PapaYozh:

Well, like, "How to limit the work of the EA (no more than one working copy)?"

that's the thing: no :(

How to ensure that the EA only works on the chart where it was first dropped

 

Do I have to beg you? :) I've already suggested a solution to your problem. If you don't even want to read the replies, why did you create the topic in the first place?

 
gip:

Do I have to beg you? :) I've already suggested a solution to your problem.

Sorry, I didn't notice your third option (with the ID object) - I must have been flooded with messages after it and didn't pay attention when I started replying to them and ..... :(
 
gip:

Do I have to beg you? :) I've already suggested a solution to your problem. If you don't even want to read the replies, why did you create the topic in the first place?

He wants ready-made code that works and has been tested. It seems to me, that everyone who stated here is convinced, that it is the only correct idea.)
 
ForexTools:
Sorry, I didn't notice your third option (with object identifier) - I must have been flooded with messages after it and didn't pay attention started replying to them and ..... :(


The third is a development of the second. Everything works.

I use the simple first one more often.

 
sanyooooook:
They want the code ready, working and tested.

+101

who wouldn't want that? ;)

Well, I already have a solution algorithm (of course, it's a crutch), but the realizable - I can do it myself.

 
gip:
Option three is to link to a specific chart by creating an identifying (or resolving) graphic object on that chart.
When the terminal crashes, the graphical objects created in the last session are not saved. Correct, if I'm wrong.
Reason: