Adding a date range to a screener code

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #241360 quote
    segie
    Participant
    Senior

    Hi,

    How do I add a date range to the screener code below? E.g if I want to screen from the the 2nd of December to the 6th of December 2024.

    Regards,

    Segie

    #241372 quote
    robertogozzi
    Moderator
    Master

    There you go (not tested):

    Timeframe(Daily)
    Sma20 = average[20,0](close[5])
    Timeframe(Weekly)
    c1    = close[1] CROSSES OVER Sma20
    Timeframe(default)
    Cond = 0
    For j = BarIndex down to 0
       If (date[j] >= 20241202) and (date[j] <= 20241206) then
          c2    = (close[j]>= 1) AND (close [j] <= 5)
          c3    = (high[j]  <> low[j])
          Cond  = c1[j] AND c2 AND c3
       Endif
       If Cond then
          Exit for
       Endif
    Next
    SCREENER[Cond]
    segie and Iván González thanked this post
    #241378 quote
    segie
    Participant
    Senior

    Will run and revert. Thank you

    #241415 quote
    segie
    Participant
    Senior

    Saying “line 1 Error unknown command”

    Attached screenshot

    Line-1-error.png Line-1-error.png
    #241418 quote
    druby
    Participant
    New

    Don’t use screeners myself but try this.

    Timeframe(Daily)
    Sma20 = average[20,0](close[5])
    Timeframe(Weekly)
    c1= close[1] CROSSES OVER Sma20
    Timeframe(default)
    Cond = 0
    For j = BarIndex downto 0
       If (date[j] >= 20241202) and (date[j] <= 20241206) then
          c2= (close[j]>= 1) AND (close [j] <= 5)
          c3= (high[j]  <> low[j])
          Cond= c1[j] AND c2 AND c3
       Endif
    Next
    SCREENER[Cond]
    #241419 quote
    robertogozzi
    Moderator
    Master

    Sometimes Copy & Paste inserts odd characters,  usullay removing all blanks in the highlighted line, then retyping them solves the problem.

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

Adding a date range to a screener code


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
segie @segie Participant
Summary

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

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