If Center_errey is removed, the test takes less than a minute. If this condition is still included in the code, the test takes about 2 hours.
By the terms, recalculations and checks are not relevant on every tick, but only when a new bar appears.
That's why it makes sense to apply a corresponding function, like this one:
bool NevBar(){
staticint PrevTime=0;
if (PrevTime==Time[0]) return(false);
PrevTime=Time[0];
return(true);}
and run Center_errey only when it appears.
You may also throw out all sorts of "trash". But it won't essentially affect the speed.
There is also a gross error in your code - if there is no margin, you cancel the entire code. What about trawl? Although... perhaps it's because it's only part of the code, as I understand from the comments.
This is basically all the code:
If Center_errey is removed, the test takes less than a minute. If this condition is still included in the code, the test runs for 2 hours
This is basically all the code:
If Center_errey is removed, the test takes less than a minute. If this condition is still included in the code, the test runs for 2 hours
Didn't you try to make an indicator?
have a variable A, which can take the values 0,1,2.
Will these comparisons be equivalent?
if(A=0 || A=1){do} and if(A != 2){do}
have a variable A, which can take the values 0,1,2.
Will these comparisons be equivalent?
if(A=0 || A=1){do} and if(A != 2){do}
have a variable A that can take values 0,1,2.
Will these comparisons be equal?
if(A=0 || A=1){do} and if(A != 2){do}
No, because neither "A=0" nor "A=1" is a comparison.
But the comparison is "A == 0" and "A == 1".
No, because neither "A=0" nor "A=1" is a comparison.
But "A == 0" and "A == 1" are comparisons.
This is basically all the code:
If Center_errey is removed, the test takes less than a minute. If this condition is still included in the code, the test takes about 2 hours.
That's why it makes sense to apply a corresponding function, like this one:
and run Center_errey only when it appears.
You may also throw out all sorts of "trash". But it won't essentially affect the speed.
There is also a gross error in your code - if there is no margin, you cancel the entire code. What about trawl? Although... perhaps it's because it's only part of the code, as I understand from the comments.
No, because neither "A=0" nor "A=1" is a comparison.
But "A == 0" and "A == 1" are comparisons.
Credit ))))
Only I wrote it not in MQL, but formally, that's the trouble (:
Score ))))
Only I didn't write in MQL, but formally, that's the problem (: