Proscreener for a specific date

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

    Hi

    I wound if there is a smart way to run a screener for a specific date, eg. 20201201.
    I want to do get a list of what ROC[60] my defined shares had on a specific date.

    #182952 quote
    robertogozzi
    Moderator
    Master

    There you go (but you can’t go backwards more than 254 bars with IG):

    MyROC = ROC[10](close)
    x     = 0
    FOR i = 0 TO 253
       IF date[i] = 20211203 THEN //Dec. 3rd, 2021
          IF MyROC[i] > MyROC THEN
             x = i
             break
          ENDIF
       ENDIF
    NEXT
    SCREENER [x](x AS "Bar")
    #182993 quote
    erike
    Participant
    Junior

    Thank you robertogozzi (Is it ok to refer like this?)

    I guess I was a bit unclear of my need.
    Your solution seems to give me all shares that had a greater ROC on a specific date compared to the latest ROC.

    What I wanted was:
    – On specific date, say latest date for a quarter, eg. 20210930
    – A list of ROC(60) for the top shares during that quarter: 202107 – 202109

    Then I want to do the same for the previous quarter, from 20210630 and so on.

    I am trying to manually backtest a momentum strategi but perhaps there is smarter ways to do this automatically?
    Though I also want to visually see how the graph look like for the top shares.

    BTW: Can you tell me more about the limitation “you can’t go backwards more than 254 bars with IG”.
    Why is that? Is there any more limitations like this with IG?

    -Erik

    #182996 quote
    robertogozzi
    Moderator
    Master

    254 bars are the maximum lookback number of candles that you can scan.

    That is you can refer, at most, say CLOSE[253], or use an Exponential average with no more than about 80-85 periods.

    On a 1-minute chart you can access only the last 254 (0-253) minutes, on a Daily chart it’s 254 trading days. If you combine more TFs, the lowest TF sets the lookback period, so a screener cannot use both the Daily and 1-minute TF as a day is made of 1440 1-minute bars, way too many!

    If you have access to PRT premium then the limit is now 1024 bars.

    To check between a starting and an ending period you need two dates, not just one.

    erike thanked this post
    #183023 quote
    erike
    Participant
    Junior

    And this is what I have come up with. Any comments robertogozzi?

    // PRC_ROC-66 stock screener | screener
    // 2021-12-08
    // Screens for ROC[66] (configurable) for shares
    // from a configurable base date
    //
    LowestROC = 40 // Need to be adjusted so we get number of hits <= 50
    
    period = 66 // Quarter = 3 months = 3 * 22 days
    MyROC = ROC[period](close)
    
    IGLimitation = 254
    ROCLimitation = IGLimitation - period // 188
    
    // 20210219 Oldest date to define in IG on the 2021-12-08
    // Defines base date as a date in the last week in March, June, Sep or Dec
    //baseDate = 20210323 // 2021Q1 Oldest Quarter date to go in IG on the 2021-12-08
    //baseDate = 20210622 // 2021Q2
    baseDate = 20210921 // 2021Q3
    
    FOR i = 1 TO ROCLimitation // When index = i - 1 is used we can't start at 0
    IF date[i] = baseDate THEN
    index = i - 1 // Don't know why this is needed if not used we get ROC at baseDate - 1
    //index = i
    rocAtBaseDate = MyROC[index]
    break
    ENDIF
    NEXT
    
    SCREENER [rocAtBaseDate > LowestROC] (rocAtBaseDate AS "ROC")
    #183082 quote
    robertogozzi
    Moderator
    Master

    The logic seems correct.

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

Proscreener for a specific date


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
erike @erike Participant
Summary

This topic contains 5 replies,
has 2 voices, and was last updated by robertogozzi
4 years, 3 months ago.

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