any standard procedures for that.
is there any way to reload an ea automatically when it exits due to certain errors ?
i am not using arrays or any indicator related items.
Your approach could be done with try & catch.
But never ends good...
I don't know what you are trying to do, but do you know this functionality?
double variable = 0.0; double division = 1000.0 / ( variable == 0.0 ? 1.0 : 0.0 ) ;
That would avoid the runtime error but not sure what you are trying to accomplish
Like Marco said, test it for zero before the process where you might be dividing by zero.
(not tested code, just to show example)
if (valueYouDontWantToBeZero = 0) { // do this code } else { // do this code that lets you divide by that value }
Like Marco said, test it for zero before the process where you might be dividing by zero.
(not tested code, just to show example)
if (valueYouDontWantToBeZero = 0) { // do this code } else { // do this code that lets you divide by that value
}
Slight correction:
if (valueYouDontWantToBeZero == 0)
Both work, depends on how complicated you want to get if it does = zero. For me, I like to see it broken down further.
No sory, they don't both work. "=" is assigning a value, "==" is a comparison operator
nope so make sure it does not happen.
check the value before you divide and if it's 0 change it.
My total code length runs beyond 27000+ lines.
Defending every division is going to be a very long task.
Ah, I see it now, good catch, thought you were trying to condense the entire if/else down to one line. My mistake.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
any standard procedures for that.
is there any way to reload an ea automatically when it exits due to certain errors ?
i am not using arrays or any indicator related items.