- Perhaps you should read the manual. If you had, you would know that is exactly what it does.
Brief Estimate of Boolean Operations
The scheme of the so called "brief estimate" is applied to boolean operations, i.e. the calculation of the expression is terminated when the result of the expression can be precisely estimated.
Language Basics / Operations and Expressions / Boolean Operations - Reference on algorithmic/automated trading language for MetaTrader 5 - I doubt you could even measure the difference between the two methods.
- If you want to speed up the tester:
- EAs : Don't do per tick that you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts and you recalculate.)
If you are waiting for an order to open or close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum - Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly.
- EAs : Don't do per tick that you can do per bar, or on open.
hi every one
my question is that, assuming that there are two ways to write a Boolean script, which way is faster (makes the EA backtest/optimization faster)?
bool a,b,c;
a=true;
c=(a big an complicated formula that only needs to be tested when a==false);
method 1- if(!a) {b=C;}
method 2-
you see, i'm not sure that in the second method when the terminal, checks all the two parameters or it when it sees that the first one is false it doesn't check the second part?
thanks in advance
In term of performance you won't really see a difference. In term of syntax,
if a = false and c=true ; b=(!a && c); will return true else it'll return false
- Perhaps you should read the manual. If you had, you would know that is exactly what it does.
- I doubt you could even measure the difference between the two methods.
- If you want to speed up the tester:
- EAs : Don't do per tick that you can do per bar, or on open.
If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts and you recalculate.)
If you are waiting for an order to open or close, only look when OrdersTotal (or MT5 equivalent) has changed.
How to get backtesting faster ? - MT4 - MQL4 programming forum - Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
How to do your lookbacks correctly.
- EAs : Don't do per tick that you can do per bar, or on open.
thanks for your reply
you were right. it was mentioned in the manual.
Best Regard and once again thanks for your time.
hi every one
my question is that, assuming that there are two ways to write a Boolean script, which way is faster (makes the EA backtest/optimization faster)?
bool a,b,c;
a=true;
c=(a big an complicated formula that only needs to be tested when a==false);
method 1- if(!a) {b=C;}
method 2- b=(!a && C );
you see, i'm not sure that in the second method when the terminal, checks all the two parameters or it when it sees that the first one is false it doesn't check the second part?
thanks in advance
It is described in documentation:
Brief Estimate of Boolean Operations
The scheme of the so called "brief estimate" is applied to boolean operations, i.e. the
calculation of the expression is terminated when the result of the expression can be precisely estimated.
//+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { //--- the first example of the brief estimate if(func_false() && func_true()) { Print("Operation &&: You will never see this expression"); } else { Print("Operation &&: Result of the first expression is false, so the second wasn't calculated"); } //--- the second example of the brief estimate if(!func_false() || !func_true()) { Print("Operation ||: Result of the first expression is true, so the second wasn't calculated"); } else { Print("Operation ||: You will never see this expression"); } } //+------------------------------------------------------------------+ //| the function always returns false | //+------------------------------------------------------------------+ bool func_false() { Print("Function func_false()"); return(false); } //+------------------------------------------------------------------+ //| the function always returns true | //+------------------------------------------------------------------+ bool func_true() { Print("Function func_true()"); return(true); }
It is described in documentation:
thanks a lot for your kind response.
Best regards
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi every one
my question is that, assuming that there are two ways to write a Boolean script, which way is faster (makes the EA backtest/optimization faster)?
bool a,b,c;
a=true;
c=(a big an complicated formula that only needs to be tested when a==false);
method 1- if(!a) {b=C;}
method 2- b=(!a && C );
you see, i'm not sure that in the second method when the terminal, checks all the two parameters or it when it sees that the first one is false it doesn't check the second part?
thanks in advance