Stocks above/below opening prices

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

    Hi all,

    I have been trying to make this work for over a month and bashing my head until I’ve just decided to ask for help. I would like to screen for stocks that are trading above/below opening prices for the Hour, Day, Week, Month, Quarter and Year. The most I have been able to do is create an indicator that plots all the opening prices after filtering out stocks above/below daily and weekly opening prices and then manually looking at the closing price relative to the others using the indicator.

    // The following code is related to this timescale:daily
    TIMEFRAME(daily)
    c1 = (close < open)
    
    // The following code is related to this timescale:weekly
    TIMEFRAME(weekly)
    c2 = (close < open)
    
    // The following code is related to this timescale:1 hour
    //TIMEFRAME(1 hour)
    //c3 = (close < open)
    
    // The following code is related to this timescale:daily
    TIMEFRAME(daily)
    c4 = (close > 0.2)
    
    // The following code is related to this timescale:daily
    TIMEFRAME(daily)
    criteria = volume
    c5 = volume > 300
    
    // The following code is related to this timescale:DEFAULT
    TIMEFRAME(DEFAULT)
    
    SCREENER[c1 AND c2 AND c4 AND c5](criteria AS "Volume")

    I have tried using the “Insert Function” to call the indicator but the screener never picks up any of the values. I tested with ONLY the Yearly Open and the screen isn’t able to get that value. Below is the code for the indicator.

    //defparam drawonlastbaronly = true
    
    if openyear <> openyear[1] then //yearly
    yearindex = yearindex + 1
    //yearhigh = 0
    //yearlow = close
    yearopen = open
    //yearclose = close
    endif
    
    if openmonth <> openmonth[1] and (openmonth = 1 or openmonth = 4 or openmonth = 7 or openmonth = 10) then                              //quarterly
    quarterindex = quarterindex + 1
    //quarterhigh = 0
    //quarterlow = close
    quarteropen = open
    //quarterclose = close
    endif
    
    if openmonth <> openmonth[1] then //monthly
    monthindex = monthindex + 1
    //monthhigh = 0
    //monthlow = close
    monthopen = open
    //monthclose = close
    endif
    
    if opendayofweek < opendayofweek[1] then //weekly
    weekindex = weekindex + 1
    //weekhigh = 0
    //weeklow = close
    weekopen = open
    //weekclose = close
    endif
    
    if openday <> openday[1] then //daily
    dayindex = dayindex + 1
    //dayhigh = 0
    //daylow = close
    dayopen = open
    //dayclose = close
    endif
    
    if dayindex < 1 then
    dayopen = undefined
    endif
    
    if weekindex < 1 then
    weekopen = undefined
    endif
    
    return yearopen as "Year Open", monthopen as "Month Open", quarteropen as "Quarter Open", weekopen as "Week Open", dayopen coloured(100,149,237) as "Day Open", close coloured(255,128,0) as "Last"
    

    Can someone please help me out and/or suggest some tips? It would be greatly appreciated. Thank you.

    AX1-Daily.png AX1-Daily.png
    #138605 quote
    Nicolas
    Keymaster
    Master

    You should group all the same timeframe code below the same TIMEFRAME instruction.

    The indicator doesn’t return anything because it uses instructions not compatible with ProScreener (all instructions that begin with Open: OpenWeek, ..).

    To get the monthly Close try this (in daily imeframe):

    If Month<>Month[1] then
     monthlyClose = Close[1]
    endif

    Quarterly Close price, example in this code snippet (uses to get the quarterly pivot point): https://www.prorealcode.com/topic/formule-points-pivots-quarterly/#post-51188

    #138736 quote
    revstrat
    Participant
    New

    Thank you so much Nicolas. Works like a charm.

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

Stocks above/below opening prices


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
revstrat @revstrat Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by revstrat
5 years, 8 months ago.

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