find stock who rise x % every year since last x years

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #134861 quote
    stigv
    Participant
    New

    Hello,

    i’m trying to code a screener which finds stock who rise x consequent years for y % per year.

    i cannot seem to find the right way. one way could be to compare week 0 with week 52, then week 52 with week 104, then week 104 with week 156 etc. but that limits me because the max of Close is 254? How to get passed this limit? Can you do something with month or year?

    Other thing is that i could compare the first Close of a year with the last close of a year, but how to get that?

    my code for now is like this:

    // example screener code
    p = 37 // how many percent
    j = 4 // how many years?
    //
    //
    p = p + 100//150 = + 50%
    timeframe(weekly)
    
    yearStartWEEKNR=52
    yearStopWEEKNR=0
    
    yearsOK = 0
    FOR i = 0 to j-1 DO
    yearStart=Close[yearStartWEEKNR]
    yearStop=Close[yearStopWEEKNR]
    
    IF ((yearStop*100)/yearStart>p) THEN
    yearsOK=yearsOK+1
    ENDIF
    
    IF not (i+1 = j) THEN
    yearStartWEEKNR=yearStartWEEKNR+52
    yearStopWEEKNR=yearStopWEEKNR+52
    ENDIF
    NEXT
    
    voldoet = 0
    IF (yearsOK = j) THEN
    voldoet = 1
    ENDIF
    
    c1=voldoet>0
    
    screener[c1] (yearsOK as "yearsOK")
    #134863 quote
    robertogozzi
    Moderator
    Master

    No, ProScreener does not support MONTHLY and YEARLY TF’s.

    So 254 weeks is the maximun lookback period you can have.

    #134866 quote
    stigv
    Participant
    New

    and is there any other possibility?

    #134867 quote
    robertogozzi
    Moderator
    Master

    No.

    #134927 quote
    GraHal
    Participant
    Master

    Other thing is that i could compare the first Close of a year with the last close of a year, but how to get that?

    Does your code above work?

    If No, then can’t you do something with barindex using 1 52 104 156 208 254 to check for x% rise each year over a 5 year period?

    Doesn’t have to be exactly 5 years / 260 weeks?

    #134979 quote
    stigv
    Participant
    New

    can you help me how the barindex could be of any help?

    how can i calculate and show % raise on 0 52 104 156 208 260 etc?

    #135029 quote
    GraHal
    Participant
    Master

    Needs coding but to give x% change over 5 years …

    (Close at barindex 254 + x%*Close at barindex 0) >= (Close at barindex 0)

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

find stock who rise x % every year since last x years


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
stigv @stigv Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by GraHal
5 years, 9 months ago.

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