Yedelkin: ..And the thought comes back to the infinite loop again as the simplest example of explicit delayed event handling.
Here's a question: what function do you use to send trade requests?
G001: 2 Yedelkin, I told you that the Expert Advisor simply falls asleep and stops working. And it only wakes up by reloading the terminal and it works.
Everything must have a reason and an explanation, including the phenomenon that seems to "stop working" for now.
sergeev: In what MQL event (which function in your EA) do you "catch it when it falls asleep" ?
Yes, it visually detects that the Expert Advisor has "fallen asleep". It compares the time in comments on the chart with its own time. It does not use any events.
I want to make an EA that after closing a position it would immediately open the same position with the opposite position
For example, there were open only 2 positions 1 Sell and 1 Buy. One of them is closed, eg Buy at TP or SL , I would like the EA to reopen a Buy position and a new Sell position with it
There are 2 Sell positions and 1 Buy position
May someone come up with some formula that will open a closed position with an opposite one.
or any other way... I've tried everything I know(((( does not work :, (
Yedelkin: Yes it visually detects that the expert has "fallen asleep". It compares the time in the commentary on the chart with its computer time. It does not use any events.
Right. That was my request, how to find out programmatically when the EA stops working.
I see. You useOrderSend() function. The version is that the delay in OnTick() event processing by NewTick( ) function may be caused by lack of server's response, because theOrderSend() function must wait for this response. If interesting, try touse its asynchronous copy instead ofOrderSend() functionwhich doesn't wait for the server's reply. Will it cause the Expert Advisor to stop working?
Yedelkin: Got it. You are usingOrderSend() function. The version is that the delay may be due to server's no response, because theOrderSend() function has to wait for this response. If you are interested, try touse its asynchronous copy instead ofOrderSend() function, which does not wait for the server's reply.Will it hang in this case too?
Thank you. I also thought of using asynchronous version, but I do not know if the broker will not consider the trades. But I will try.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
2 sergeev, In MQL5, when the clock stops, it means it fell asleep.
Here's a question: what function do you use to send trade requests?
Everything must have a reason and an explanation, including the phenomenon that seems to "stop working" for now.
2 sergeev, In MQL5, when the clock stops, it means it fell asleep.
This is a question: what function do you use to send trade requests?
There must be a reason and an explanation for everything, including the phenomenon that so far seems to have "stopped working".
In what MQL event (which function in your EA) do you "catch it when it goes to sleep" ?
Sorry, I don't really know what you're asking... :(
The clock is right aftervoid OnTick()
In what MQL event (which function in your EA) do you "catch it when it falls asleep" ?
Can anyone help with a condition for an EA?
I want to make an EA that after closing a position it would immediately open the same position with the opposite position
For example, there were open only 2 positions 1 Sell and 1 Buy. One of them is closed, eg Buy at TP or SL , I would like the EA to reopen a Buy position and a new Sell position with it
There are 2 Sell positions and 1 Buy position
May someone come up with some formula that will open a closed position with an opposite one.
or any other way... I've tried everything I know(((( does not work :, (
Yes it visually detects that the expert has "fallen asleep". It compares the time in the commentary on the chart with its computer time. It does not use any events.
G001: ResBear = OrderSend(request,result);
Got it. You are usingOrderSend() function. The version is that the delay may be due to server's no response, because theOrderSend() function has to wait for this response. If you are interested, try touse its asynchronous copy instead ofOrderSend() function, which does not wait for the server's reply.Will it hang in this case too?