Not getting wanted barssince result in screener

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #249360 quote
    sgrech
    Participant
    Junior

    some very simply code  below (in theory) and I can’t explain some of the results  eg the screen returns MNG (UK) where the close was last below 20ma 4 bars ago but 32 is returned – this is driving me nuts what on earth am I doing wrong?

    timeframe(monthly)
    ma = average[20](close)

    c1 = barssince(close < ma)

    SCREENER[c1](c1 as “bars”)

    #249363 quote
    robertogozzi
    Moderator
    Master

    The line

    c1 = barssince(close < ma)

    assigns C1 the bar where the condition has been met, which will ALWAYS retain a value other than 0, so it will always be true, thus returning ALL instruments.

    Try changing the last line so that it only scans the instruments where the condition has only been met within the last 5 (or any other number of your choice) bars:

    SCREENER[c1 <= 5](c1 as “bars”)
    #249366 quote
    JS
    Participant
    Senior

    Hi,

    I’m getting the right results…

    Did you set the “Period” to “Month”… ?

    Scherm­afbeelding-2025-08-05-om-12.37.23.png Scherm­afbeelding-2025-08-05-om-12.37.23.png
    #249368 quote
    JS
    Participant
    Senior

    It is also possible that your “data” has not yet been adjusted to dividends…

    robertogozzi and Iván González thanked this post
    Scherm­afbeelding-2025-08-05-om-12.46.22.png Scherm­afbeelding-2025-08-05-om-12.46.22.png
    #249378 quote
    sgrech
    Participant
    Junior
    So I was not adjusting for dividend, data now look consistent.  Thanks so much.   This leads onto a separate question, should adjustment be enabled or disabled.  The chart for the particular asset I was looking is massively different probably becuase it has a hefty 10% yield!
    before_adj.jpg before_adj.jpg after_adj.jpg after_adj.jpg
    #249383 quote
    JS
    Participant
    Senior

    When you use a “screener” you always have to adjust the data for dividend because a “screener” works with “real-time” data (data adjusted for dividend)…

    Iván González thanked this post
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.

Not getting wanted barssince result in screener


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
sgrech @sgrech Participant
Summary

This topic contains 5 replies,
has 3 voices, and was last updated by JS
6 months, 4 weeks ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 08/05/2025
Status: Active
Attachments: 4 files
Logo Logo
Loading...