Screener return values

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #219052 quote
    OllieB
    Participant
    Junior

    Hi,

     

    I have created a screener for searching for bullish and bearish conditions.  I have set it to return -1 for the bearish results and 1 for the bullish results.

    The screener only ever returns bullish conditions.  I have coded up EXACTLY the same indicator and it works a treat.

    I then set the screener to return 1 for bullish and 2 for bearish, and it worked fine!

    This indicates that the screener cannot return negative values, or i am doing something wrong!

    Can anyone please help with this?

    Thanks.

    #219094 quote
    JS
    Participant
    Veteran

    Hi,

    Here is an example of a screener that shows 1 for bullish and -1 for bearish…

    In case of other problems, you will have to display your code…

     
    C1 = Close[1] < Open[1] and Open < Close[1] and Close > Open[1] // Bullish Engulfing
    C2 = Close[1] > Open[1] and Open > Close[1] and Close < Open[1] // Bearish Engulfing
    
    If C1 then
    Up = 1
    elsIf C2 then
    Up = -1
    EndIf
    
    SCREENER[C1 or C2](Up as "Bullish = 1 Bearish = -1")
    OllieB thanked this post
    Scherm­afbeelding-2023-08-15-om-08.31.39.png Scherm­afbeelding-2023-08-15-om-08.31.39.png
    #219202 quote
    OllieB
    Participant
    Junior
    c8MABounce = 0
    if c8MABounceUp then
    c8MABounce = 1
    elsif c8MABounceDn then
    c8MABounce = 2
    endif
    
    screener[c8MABounce](c8MABounce AS "8MA")
      Hi,   Many thanks for the reply.  I will use that.   The key section from my code is attached.  So this returns a 1 or a 2 as expected.  If i substitute the return value 2 for a -1 then the -1 doe snot get returned.  Its as if the screener can only return positive values.   Thanks.
    #219205 quote
    JS
    Participant
    Veteran
    Hi,   As you can see in my last/previous screenshot, it is not a problem for a screener to display negative values… 🙂   Unfortunately, I can’t try your screener because it’s not complete… Try your screener without the first line…”c8MABounce=0″…
    OllieB thanked this post
    #219223 quote
    OllieB
    Participant
    Junior
    Hi again, Yes, I have used your version now with my screener and it works great, thank you.  🙂  I see “1”s and “-1″s.  I am now just curious, for my own education, why my version does not work. A slimmed down edit (functional) of the full version of my screener is attached, so the variable names don’t make sense.  However, it works enough to prove my point in that the screener, when written like this, does not return negative values.  If you run this code against FX pairs, for example, AUDCAD does not appear in the results.  The only results that show are with a “1”. Its going to be something obvious but I just can’t see it……… Thanks again for your help. PS, removing the ”c8MABounce=0″ makes no difference  
    timeframe (DAILY)
    
    cMA21  = Average[21](Close)
    cMA50  = Average[50](Close)
    cMA200 = Average[200](Close)
    cMAOrderUp = (cMA21 > cMA50) AND (cMA50 > cMA200)
    cMAOrderDn = (cMA21 < cMA50) AND (cMA50 < cMA200)
    
    c21MABounceUp = (cMAOrderUp)
    c21MABounceDn = (cMAOrderDn)
    
    c21MABounce = 0
    if c21MABounceUp then
    c21MABounce = 1
    elsif c21MABounceDn then
    c21MABounce = -1
    endif
    
    screener[c21MABounce] (c21MABounce AS "21MA")
    rem screener[TrendTemplate](Ratio AS "Perf")
    
    #219229 quote
    JS
    Participant
    Veteran

    Hi,

    In your screener, you need to add the different conditions that can be true or false…

    Screener[c21MABounceUp or c21MABounceDn](c21MABounce as “21MA”)

     

    timeframe (DAILY)
    
    cMA21  = Average[21](Close)
    cMA50  = Average[50](Close)
    cMA200 = Average[200](Close)
    cMAOrderUp = (cMA21 > cMA50) AND (cMA50 > cMA200)
    cMAOrderDn = (cMA21 < cMA50) AND (cMA50 < cMA200)
    
    c21MABounceUp = (cMAOrderUp)
    c21MABounceDn = (cMAOrderDn)
    
    c21MABounce = 0
    if c21MABounceUp then
    c21MABounce = 1
    elsif c21MABounceDn then
    c21MABounce = -1
    endif
    
    screener[c21MABounceUp or c21MABounceDn] (c21MABounce AS "21MA")
    
    OllieB thanked this post
    Scherm­afbeelding-2023-08-16-om-23.20.09.png Scherm­afbeelding-2023-08-16-om-23.20.09.png
    #219231 quote
    JS
    Participant
    Veteran
    Hi, This will make your screener beter readable… if you want that 🙂
    cMA21  = Average[21](Close)
    cMA50  = Average[50](Close)
    cMA200 = Average[200](Close)
    
    C1 = (cMA21 > cMA50) AND (cMA50 > cMA200)
    C2 = (cMA21 < cMA50) AND (cMA50 < cMA200)
    
    if C1 then
    c21MABounce = 1
    elsif C2 then
    c21MABounce = -1
    endif
    
    screener[C1 or C2] (c21MABounce AS "21MA")
    
    OllieB thanked this post
    #219252 quote
    OllieB
    Participant
    Junior
    Hi,   Thank you very much for your help.  All suggestions have been incorporated in my screener.   Its fantastic that the community has members as knowledgeable and as helpful as you are.
    JS thanked this post
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.

Screener return values


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
OllieB @ollieb Participant
Summary

This topic contains 7 replies,
has 2 voices, and was last updated by OllieB
2 years, 7 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 08/14/2023
Status: Active
Attachments: 2 files
Logo Logo
Loading...