I understand that you have to unload to the init (or better ontik) after the change. I.e. memorise account numbers in global variables and unload if change occurs. You can also try to analyze _DeInitReason in the init() and unload.
This solution was shown. It works only if the same symbol exists after the account change.
I have a very good Expert Advisor, that should be deleted during account switching.
Suppose the Expert Advisor is running on EURUSD. It will switch to a server where symbols are prefixed. For example, EURUSD.abc.
In this case, the EA still hangs and cannot delete itself. Does anyone have a solution to this problem?
This is exactly what my answer was. If the instrument names are different in the different accounts, use the string handling functions and extract the right part of that string.
Do I need it? You're talking about the problem of different character names here.
That's exactly what my answer was. If the instrument names are different in different accounts, use the string handling functions and extract the right part of that string.
You are not talking to a beginner. Don't suggest unworkable hypotheses.
ExpertRemove() is definitely no help. We can try through templates. But in OnDeinit it is not possible to determine that there has been an account change.
Where ExpertRemove does not work - there is also ChartClose(). I do not understand what the problem is. What happens after the account is changed? An additional chart with Expert Advisor appears? Or it's just the current chart symbol changes? Maybe, the ChartID is changed and therefore your previous solution does not work? Ticks are processed anyway, it means that we have to unload to OnTick, if OnInit isn't working.
You are not talking to a newcomer. Don't suggest unworkable hypotheses.
Likewise, you should not publish non-working code. And don't discuss problems encountered on the thorny path of a programmer in the topic of language features.
In the same way, you should not publish non-working code. And don't discuss in the topic of language features the problems encountered on the thorny path of a programmer.
only the services are not linked to the chart. i haven't tested it, but most likely it will be able to restart after changing the account. and already from it change the templates of other charts. but in general it's strange that REASON_ACCOUNT is not caught.
but in general, it's more of a bug than a feature.
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.
I understand that you have to unload to the init (or better ontik) after the change. I.e. memorise account numbers in global variables and unload if change occurs. You can also try to analyze _DeInitReason in the init() and unload.
This solution was shown. It works only if the same symbol exists after the account change.
Please show here the source code for an EA that unloads itself when the account changes.
Do I need it? You're talking about the problem of different symbol names here.
Forum on trading, automated trading systems & strategy testing
Peculiarities of mql5, tips and tricks
fxsaber, 2020.05.20 23:09
I have a very good Expert Advisor, that should be deleted during account switching.
Suppose the Expert Advisor is running on EURUSD. It will switch to a server where symbols are prefixed. For example, EURUSD.abc.
In this case, the EA still hangs and cannot delete itself. Does anyone have a solution to this problem?
in which case is OnInit() not started?
Nothing is triggered.
Maybe at the level of OnDeinit() try to delete?
ExpertRemove() is definitely not a helper. You can try via templates. But OnDeinit is not able to detect that there has been an account change.
Do I need it? You're talking about the problem of different character names here.
That's exactly what my answer was. If the instrument names are different in different accounts, use the string handling functions and extract the right part of that string.You are not talking to a beginner. Don't suggest unworkable hypotheses.
Nothing is starting up.
ExpertRemove() is definitely no help. We can try through templates. But in OnDeinit it is not possible to determine that there has been an account change.
Where ExpertRemove does not work - there is also ChartClose(). I do not understand what the problem is. What happens after the account is changed? An additional chart with Expert Advisor appears? Or it's just the current chart symbol changes? Maybe, the ChartID is changed and therefore your previous solution does not work? Ticks are processed anyway, it means that we have to unload to OnTick, if OnInit isn't working.
You are not talking to a newcomer. Don't suggest unworkable hypotheses.
Likewise, you should not publish non-working code. And don't discuss problems encountered on the thorny path of a programmer in the topic of language features.
In the same way, you should not publish non-working code. And don't discuss in the topic of language features the problems encountered on the thorny path of a programmer.
You are incompetent on this problem.
only the services are not linked to the chart. i haven't tested it, but most likely it will be able to restart after changing the account. and already from it change the templates of other charts. but in general it's strange that REASON_ACCOUNT is not caught.
but in general, it's more of a bug than a feature.
You are incompetent on this problem.
If you are so competent, then please tell me why it does not work
REASON_ACCOUNT
6
Another account has been activated or reconnected to the trade server because of a change in account settings
If you are so competent, then please tell me why this does not work
REASON_ACCOUNT
6
Another account was activated or reconnected to the trade server because of a change in account settings