
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
The intelligent assumption is that the transfer should be done immediately, without executing the rest of the code. Right?
But in fact TesterStop() does not stop the test at all!
It is expected that if further code execution must be stopped just write return and there will be no further execution. TesterStop(), as well as ExpertRemove()
And the second observed flaw is that
tester_stop = false;
it is not in place at all.
It is supposed to be smart, if you need to stop further code execution, just write return and there will be no further execution. TesterStop() as well as ExpertRemove()
And the second error we have noticed is that
is not in place at all.
The next event is OnTick() ?
Where does OnTick() exit to?
Why is it out of place? It was expected that if TesterStop() was triggered, the execution would not reach this line.
The next event is OnTick() ?
Where does OnTick() take the output from?
Why is this not in place? It was expected that if TesterStop() was triggered, the execution would not reach this line.
Where to exit and what to continue is up to the developer.
The tester_stop flag in this code will set false regardless of whether or not TesterStop() is executed
Where to go and what to continue is up to the developer.
In this code, the tester_stop flag will take false regardless of whether or not TesterStop() is executed
I've got that already)))
The question is what to do? How to stop the test? To be specific. Developers nearly swear when usingINIT_PARAMETERS_INCORRECT in OnInit() and it blows away genetics.
I've found a way out and had no problems until recently. And now ... Oh, dear ))))
And still where may I get out of OnTick()?
I got that already)))
The question is what to do? How do I stop the test? To be specific. Developers nearly swear when usingINIT_PARAMETERS_INCORRECT in OnInit() and it blows away genetics.
I've found a way out but there were no problems lately. And now ... Oh, dear ))))
Well, if you understand what the problem is?
All code, after executing TesterStop, will not be executed. I.e. it will stop working immediately. Going further, we can adjust the tester_stop flag...
Another question: What is this number? Is minus a lot of nines an attempt to get some additional pain? That's where it gets really ugly...
Well if you understand what the problem is left?
All code, after executing TesterStop, will not be executed. In other words, it will immediately stop working. From there, we can regulate using the tester_stop flag...
Another question: What is this number? Is minus a lot of nines an attempt to get some additional pain? That's where it gets really ugly...
Minus a lot of nines is to determine that the output was exactly by TesterStop(). I use it only as a substitute forINIT_PARAMETERS_INCORRECT. That's why I don't need everything else after it. But what happens now is that the whole code is executed and the programmer gets the division by zero error. Sure, if an array has size 1, the value of the latter minus the value of the former will always be zero! And I hadn't insured myself against this bug, or, oh, excuse me, misunderstanding.
I tried to insert return... Only a bit wrong ))) :
I ended up with:
Just awesome ))))
Greatest THANK YOU!!!
Minus a lot of nines is to determine that the output was exactly by TesterStop(). I use it only as a substitute forINIT_PARAMETERS_INCORRECT. That's why I don't need everything else after it. But what happens now is that the whole code is executed and the programmer gets the division by zero error. Sure, if an array has size 1, the value of the latter minus the value of the former will always be zero! And I hadn't insured myself against this bug, or, oh, excuse me, misunderstanding.
I tried to insert return... Only a bit wrong ))) :
I ended up with:
Just awesome ))))
A HUGE THANK YOU!!!
Thanks, I got that already. But it doesn't solve the problem. It can be solved either byMQL_TESTER_STOP constant, or by changing the return value from void to bool.
An unexpected solution was suggested byAlexey Viktorov: if return is used after TesterStop(), everything seems to be ok. How and why it happens I personally cannot figure it out. Nevertheless...
Hence, either add this point to the documentation or changevoid to bool.
P.S. I encountered this problem in build 2085. There was no problem before that. Does it say something to me? )))
Sergey, there is nothing unexpected about this. On the contrary, it is logical and consistent. There are different cases. Sometimes you have to finish processing the event before the Expert Advisor is finished, and sometimes, like in your case, you have to finish it right away. The developers are faced with the question, what is the right thing to do, to stop immediately, causing discontent of those who need to finish processing the event, or to stop after the completion of event processing. Any programmer has return operator in his/her arsenal, while there's nothing in case of forced termination.
And why do you need to change the void type on the bool, because again, in the arsenal of the programmer there are static variables that can be changed before or after TesterStop (), and in principle, everything will be as you want. And you left it out of my example for some reason.
Sergey, there is nothing unexpected in it. On the contrary, everything is logical and consistent. There are different cases. Sometimes you have to finish processing the event before the Expert Advisor is finished, and sometimes, like in your case, you have to finish it right away. The developers are faced with the question, what is the right thing to do, to stop immediately, causing discontent of those who need to finish processing the event, or to stop after the completion of event processing. Any programmer has return operator in his/her arsenal, while there's nothing in case of forced termination.
And why do you need to change the void type on the bool, because again, in the arsenal of the programmer there are static variables that can be changed before or after TesterStop (), and in principle, everything will be as you want. And you left it out of my example for some reason.
Alexey, thank you very much for your help.
I understand the issue facing the developers and that's why I'm suggesting such a solution. In order to be able to react to the situation correctly.
As for static variables and your example, which I "threw out"... Sorry, but I don't quite understand what we're talking about. Explain it to me, if you don't mind.
And ask for some indulgence and patience. I have a very bad life situation which can make me very irritable (I am aware of that but can't do anything about it) and unattentive.
I'm just not understanding at all. My head is spinning...
Here is an example:
My code shows that if the last array value minus the first array value is early zero, the result must be -9999999999999.88.
But during optimization I get this result:
9587 - 10000 is in no way equal to zero and the result is -999999999999999.88. How?!?!? I'm already getting a hang-up...
Alexey, thank you very much for your help.
I understand the issue facing the developers and that's why I'm suggesting such a solution. To be able to react to the situation correctly.
As for static variables and your example, which I "threw out"... Sorry, but I don't quite understand what we're talking about. Explain it to me, if you don't mind.
And ask for some indulgence and patience. I have a very bad life situation which can make me very irritable (I am aware of that but can't do anything about it) and unattentive.
I'm just not understanding at all. My head is spinning...
Here is an example:
My code shows that if the last array value minus the first array value is early zero, the result must be -9999999999999.88.
But during optimization I get this result:
9587 - 10000 is in no way equal to zero and the result is -999999999999999.88. How?!?!? I'm getting a hang-up...
I don't know if it's good or bad, but I never get into the whole code, that's why I was talking about a static variable. And judging by the fact that the tester_stop flag is used in different parts of the program, this flag must be declared at the level of global variables.
It confirms that you unreasonably "threw out" changing the flag's value from my example.
This is the use of
if(tester_stop) return(-99999999999.99);
And apparently this flag either does not change at all, or does not change because the change is not provided where it should be.
Sometimes it is necessary to terminate event processing before the advisor terminates.
Any programmer has the return operator in his or her arsenal, but there is nothing in the forced termination.
In this context, can't we do a check?