Nested condition seems not to work

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #60362 quote
    Leo
    Participant
    New

    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?

    indicator10, 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.

    #60369 quote
    robertogozzi
    Moderator
    Master

    ProScreener 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

    indicator10[0] <= 15

    must ALWAYS be true, in addition to eventually other OR conditions. The correct use of parenthesis will be beneficial to your code.

    Roberto

    #60374 quote
    Leo
    Participant
    New

    Hi,

    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?

    indicator10, ignored, ignored = CALL DS(Close)
    c10 = (indicator10[0] <= 10 or (indicator10[1] <= 10 and indicator10[0] <= 15))

    any tips appreciated.

    #60379 quote
    Nicolas
    Keymaster
    Master

    What is the “DS” indicator please? Could you post a screenshot?

    #60458 quote
    Leo
    Participant
    New

    Hi,

    Attached the DS indicator.

    DS.png DS.png
    #60460 quote
    robertogozzi
    Moderator
    Master

    It’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.

    Nicolas thanked this post
    True_False.jpg True_False.jpg
    #60474 quote
    Nicolas
    Keymaster
    Master

    Your 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! 😐

    #60478 quote
    Leo
    Participant
    New

    Hi 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:

    c10 = (indicator10[0] <= 10 or (indicator10[1] <= 10 and indicator10[0] <= 15))

    should filter AMT in my opinion.

    DS.txt
    #60480 quote
    Nicolas
    Keymaster
    Master

    This is the DS indicator, but we also need the “QUICK” one (line 18 of the DS indicator).

    #60485 quote
    Leo
    Participant
    New

    Attached.

    Quick.txt
    #61110 quote
    Leo
    Participant
    New

    Hi Nicolas,

    Any news on this issue?

    cheers, Leo

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.

Nested condition seems not to work


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Leo @srvman Participant
Summary

This topic contains 10 replies,
has 3 voices, and was last updated by Leo
8 years, 1 month ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 01/24/2018
Status: Active
Attachments: 4 files
Logo Logo
Loading...