Nested condition seems not to work
Forums › ProRealTime English forum › ProScreener support › Nested condition seems not to work
- This topic has 10 replies, 3 voices, and was last updated 6 years ago by Leo.
-
-
01/24/2018 at 8:22 AM #60362
Hi,
I am trying to filter data in a screener script in which I use another custom made indicator by the call function. After that I made a condition, but in the results there are items which should not be destilled. Is the code below correct anyway? Are nested clausule possible?
call indicator and define condition12indicator10, ignored, ignored = CALL DS(Close)c10 = (indicator10[0] <= 10 or (indicator10[1] <= 10) and indicator10[0] <= 15)By the way, is there a Debug option in Proscreener in which I can verify why results are destilled?
Any help is appreciated.
01/24/2018 at 9:24 AM #60369ProScreener does not support GRAPH to debug. You should convert your code to a temp strategy to debug it.
Since line 2 has an AND operator, for c10 to be true the condition
1indicator10[0] <= 15must ALWAYS be true, in addition to eventually other OR conditions. The correct use of parenthesis will be beneficial to your code.
Roberto
01/24/2018 at 10:27 AM #60374Hi,
Thanks for reply. I used the AND clause wrong. I changed it to below, but still some items in the results should not be there, i.e. bar[0] has a value of “27” and bar[1] has a value of “6” for indicator10, so c10 should have a result of false (or -1?), shouldn’t it?
nested and clause12indicator10, ignored, ignored = CALL DS(Close)c10 = (indicator10[0] <= 10 or (indicator10[1] <= 10 and indicator10[0] <= 15))any tips appreciated.
01/24/2018 at 11:58 AM #6037901/25/2018 at 12:01 AM #6045801/25/2018 at 12:56 AM #60460It’s not possible to analyze the indicator without the complete source code.
I attach a screenshot of a table of different values (not all possible variations) where I replaced the conditions with some values.
I also highlighted some odd (though they may well be right) conditions, where you test INDICATOR[0] both against 10 and 15.
I don’t know whether your indicator is right or wrong, but you should thoroughly test your conditions to make sure they reflect what you want.
1 user thanked author for this post.
01/25/2018 at 9:58 AM #60474Your called indicator “CALL” another one named “QUICK”.. This is difficult to know how the whole thing is combined to give result in your screener. Please post the code in text format next time, much easier for us to help with a simple copy/paste of your codes into our own platform! 😐
01/25/2018 at 10:11 AM #60478Hi Nicolas,
Appreciating your help! About the OR/AND clause test data: It is what I want. Or candle[0] needs to be below a particular value, or candle[1] needs that to be, but then candle[0] must not having a specific high value anymore.
I attached the DS indicator in text now. If you could take another look would be great help. The screener destills this stock: AMT. But that stock has candle[0]=28.7 and candle[1]=7.76 in the weekly chart. Using this code in proscreener script:1c10 = (indicator10[0] <= 10 or (indicator10[1] <= 10 and indicator10[0] <= 15))should filter AMT in my opinion.
01/25/2018 at 10:13 AM #6048001/25/2018 at 10:49 AM #6048501/31/2018 at 4:06 PM #61110 -
AuthorPosts
Find exclusive trading pro-tools on