Be careful when using “OR” in a screener parameter query. "AND" is evaluated before "OR"


“OR” will give you different results, depending on whether you are using it with or without brackets. For example, see the following query with and without brackets. 


When I create a screener using an “OR” query with brackets:


(Net Profit TTM Growth %  > 15  OR 

 Net Profit QoQ Growth %  > 20)  AND 

 ROE Annual %  > 40    


I get 98 results. Note the bracket placement limits OR to two filters: Net Profit TTM Growth% and Net Profit QoQ Growth%.


When I run a screener with the same query above without brackets:


Net Profit TTM Growth %  > 15  OR 

 Net Profit QoQ Growth %  > 20  AND 

 ROE Annual %  > 40 


I get more than 200 results. This is because without brackets, the “OR” gets applied to all the rules that follow it, making all of them optional. So the above query is evaluated as the following making it less restrictive.


Net Profit TTM Growth %  > 15  

OR 

(Net Profit QoQ Growth %  > 20  AND 

ROE Annual %  > 40)