screen condition c within last x days

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11268 quote
    Rolf
    Participant
    New

    Good morning,

    I am wondering how  to screen for a condition that occured within the last x days.

    E.g.: a new 2months low that happened within the last 3 days

    Does anybody know how to program or where to find information how to do it ?

    Thx in advance

    Brgds Rolf

    #11364 quote
    Derek
    Participant
    Veteran

    Hello Rolf,

    in this example the event is the moving average[20] crossing over the moving average[40].

    The event is valid ( event =1) for “X” bars. You can set the variable eventtime to define the number of bars.

    You can use the PRT Assistant to create the screener for event=1.

     

    ////timeframe for the event
    eventtime = X
    
    
    ind1 = Average[20](close)
    ind2 = Average[40](close)
    
    c1 = ind1 crosses over ind2
    
    if c1 then
    event = 1
    eventindex = barindex
    endif
    
    if barindex - eventindex < eventtime then
    event = 1
    elsif barindex - eventindex > eventtime then
    event = 0
    endif
    
    
    return event as "event"
    
    Sam Macy and Nicolas thanked this post
    #11519 quote
    Rolf
    Participant
    New

    Thx Derek for the hint 🙂

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

screen condition c within last x days


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
Rolf @rolf Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by Rolf
9 years, 6 months ago.

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