You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
at the exit of the start function
Up to 100000 with no visible improvement
Replaced by
at
Same pepper.
Error 146.
i.e. we ourselves are waiting for our own trade context to be released
and in general, this is an extremely strange situation. after conducting a trade operation, the context is released instantly. otherwise it would be impossible to close positions in a loop
Once again.
The code above will cause the Expert Advisor to hang, if the trade flag has been cleared.
This will cause the trade to stop altogether, because no one will signal the semaphore. This situation is at least somehow controllable, because the flag can only be removed manually.
Worse is the case of the semaphore. GlobalVariableSet can fall on another EA, when the latter closes the semaphore. As the result, several EAs will try to trade at the same time.
As you can see, developers do not understand asynchronous processes inside the terminal. And this misunderstanding is exported into the forum.
No wonder that fatal errors, such as the one discussed here, occur and these errors cannot be fixed.
Why give damaging advice?
The assumption is that if the advisor has reached this point, then the trading flag stands!
the assumption is that if the EA has reached this point, then the trading flag is up!
What is the basis for this assumption? When assumptions do not match reality, unexpected errors occur.
The flag is nothing.
Synchronisation, mutexes, shared resources - the problem is real. It is nonsense to suggest that you solve it with user-level global variables. Especially since the example is unworkable.
Alas. "Since 12 at night" is not a statistic. For reasons unknown, the problems come in waves, then none, then several at once...
I thought - who cares (fiddler's tone from Kindzadz) :))
Regarding the reality of closing/opening - I have checks in all f-functions and errors appear, but they are FALSE errors. I checked the logs and order history, all positions were closed. The order just didn't have time to move in the history. I made a 1 second delay before checking - but that's not enough... When I asked, they didn't give me any answer.
Good point. But I've had cases where even an hour later the order hasn't gone anywhere, that is, sometimes they're not false.
I have a delay of 10 seconds too.
All my mistakes, as it turned out, were in the code =) i.e. I did the wrong check after the orderclose.
After I corrected it - there are none. It's true that not much time has passed, we have to wait...
After I corrected it - there are none. It's true that not much time has passed, we'll have to wait...
How does the corrected code look like?
for orderclaus:
for ordersand - just a 5x attempt to select an order with a second pause,
for modifiersand - comparing the old values with the current values