OrderClose : bugs or expected ? - page 3

 
squallmat:


Like i said : "and depending of the conditions/operations/functioning of the closing functions/EA that could be disastrous."

You're making assumption that all EA function like that.

If your EA can't handle a second pass, then your EA is broken. If the other doesn't then That one is broken. You can't code around everything.

If the other is incompatible, then run it on a second instance of MT4

 
squallmat:

Yes, i didn't thought about that. Seems that finally the semaphore can guarantee a thread-safe closing between multiple EA.

hi, the semaphore will give you more security, but if EA's on different charts are running truely paralell on a multicpu system i think the semaphor itself (reading if locked, if no then lock and continue) is not threadsafe..

But generally spoken, like WHRoeder said, your or any EA should handle this issue. To be honest, i don't know how my EA should be damaged trough a other EA unless he modifys/closes my orders.

 

AFAIK (i just discovered this english acronym thanks to you :p) metatrader 4 is not optimized for multicores (and then not multicpu too). But even if it was the case there is no difference for the semaphore that the parallelism comes from different threads, different process or different cpu-core.

The only problem then would come from an inherent problem of the semaphores themselves : that a EA doesn't unlock the semaphore for X reason(s).

 

Seems that the best (or less bad) solution is to just use invert loop finally.

(yes i know i search for the little issues, but that come from my job :p)

 

A semaphore won't work unless all EA's put it around the entire for loop and they must use the same variable name and the implimentation must be correct.

Again it isn't necessary. you can't code against everything. If the other EA closes your orders, it is broken. If the EA can't handle the same order twice without problems, it is broken.

Reason: