Screener OR function

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #171444 quote
    grimweasel47
    Participant
    Senior

    Hello

    I’m having trouble getting the screener to look for two outcomes within the same command. I’m trying to find stocks that with a close above/below the highest/lowest weekly close over the past 13 weeks, with weekly averages in order, but combined with an ROC [13] greater than +30 for the highest, and -30 for the lowest, yet when I run the screener I’m not getting the same results as running the highest / lowest variants under separate screeners? Any help appreciated! Thanks

    Timeframe(Weekly)
    C2 = close > 2.00
    Indicator2 = Volume
    Indicator3 =(highest[26](volume[1]))
    C3 = indicator2 > indicator3
    
    
    Indy4 = exponentialaverage[13](close)
    Indy5 = exponentialaverage[39](close)
    c4 = (indy4 <= Indy5)
    Indy6 = (lowest[13](low[1]))
    c5 = (close <= Indy6)
    criteria = volume
    
    ///Long
    
    Indy6 = exponentialaverage[13](close)
    Indy7 = exponentialaverage[39](close)
    c6 = (indy6 >= Indy7)
    Indy6 = (highest[13](high[1]))
    c7 = (close >= Indy6)
    criteria = volume
    
    Filter = ROC[13](close) >30
    Filter1 = ROC[13](close) <-30
    Screener [c2 and c3 and (c4 and c5 and filter1) or c2 and c3 and (c6 and c7 and filter)] (criteria as "volume")
    #171447 quote
    robertogozzi
    Moderator
    Master

    It may be due to the way conditions are combined with relational operators.

    How do you want to combine them?

    #172602 quote
    grimweasel47
    Participant
    Senior

    Hi Robert

    I’m not sure I understand? All I want the screener for is to show both the longs and shorts possible screening for the criteria listed. Or would it be better to split into two screeners, one long and one short?

     

    Thanks

    #172606 quote
    robertogozzi
    Moderator
    Master

    Conditions involving relational operators can behave differently according to the use of parentheses. Try this as line 26, inside SCREENER’s brackets:

    (c2 and c3 and c4 and c5 and filter1) OR (c2 and c3 and c6 and c7 and filter)

    In any case, I tested your original code and it just returned about ten signals on the weekly TF, selecting shares from UK, USA, Germany and Italy.

    #172648 quote
    grimweasel47
    Participant
    Senior

    Thanks Robert. That makes sense now!!! 😉

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

Screener OR function


ProScreener: Market Scanners & Detection

New Reply
Author
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by grimweasel47
4 years, 8 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 06/09/2021
Status: Active
Attachments: No files
Logo Logo
Loading...