How do I draw opening range lines?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #166109 quote
    RubberToe
    Participant
    Average

    I just want to draw two lines, the high and low of the live trading day from a timestamp.  Essentially ORB at 45 minutes from market open.  I’ve been modifying this indicator many ways, but I just can’t get anywhere with it, and I’m losing my mind.  This should be simple…

    Open Range Breakout Indicator ORB

    #166149 quote
    Vonasi
    Moderator
    Master

    RubberToe – ‘Struggling with a simple task’ is not a meaningful title. Your title has been edited.

    • Give your topic a meaningful title. Describe your question or your subject in your title. Do not use meaningless titles such as ‘Coding Help Needed’.
    #166151 quote
    robertogozzi
    Moderator
    Master

    There you go, just change the time as best fits you:

    once maxii=undefined
    once minii=undefined
    once maxi1=undefined
    once mini1=undefined
    once maxi2=undefined
    once mini2=undefined
    once maxi3=undefined
    once mini3=undefined
    if time=090000 then
       maxi=high 
       mini=low
    Endif
    maxi=max(high,maxi)
    mini=min(low,mini)
    lerange=(maxi-mini)/2
    maxii=maxi
    minii=mini
    maxi1=maxi+lerange
    mini1=mini-lerange
    maxi2=maxi+2*lerange
    mini2=mini-2*lerange
    maxi3=maxi+3*lerange
    mini3=mini-3*lerange
    return maxii as "Maxi première heure de cotation", minii as "Mini première heure de cotation", maxi1 as "Maxi1" ,mini1 as "Mini1",maxi2 as "Maxi2" ,mini2 as "Mini2",maxi3 as "Maxi3" ,mini3 as "Mini3"
    #166164 quote
    RubberToe
    Participant
    Average

    Thank you for looking at this, but we are hitting the same problem.

    The lines are still draw dynamically throughout the trend, but I only need two static lines set off the highest/lowest price in the first 30 minutes after the open.  The lines would start at a time (for example 11:00 am EST and stop at the end of the trading day.

    I’ve been trying the DRAWSEGMENT command, but I can’t find good examples and the documentation is pretty thin…

    Screenshot-2021-04-04-112426.jpg Screenshot-2021-04-04-112426.jpg
    #166169 quote
    RubberToe
    Participant
    Average

    OK, some success.  I modified the code and set to 30 minute timeframe, which seems to do the range nicely.  Now I need a way to not draw the line for those first 30 minutes….

    once maxii=undefined
    once minii=undefined
    //once maxi1=undefined
    //once mini1=undefined
    //once maxi2=undefined
    // mini2=undefined
    //once maxi3=undefined
    //once mini3=undefined
    timeframe(30mn)
    if time=110000 then
    maxi=high
    mini=low
    Endif
    //maxi=max(high,maxi)
    //mini=min(low,mini)
    //lerange=(maxi-mini)/2
    maxii=maxi
    minii=mini
    //maxi1=maxi+lerange
    //mini1=mini-lerange
    //maxi2=maxi+2*lerange
    //mini2=mini-2*lerange
    //maxi3=maxi+3*lerange
    //mini3=mini-3*lerange
    return maxii as "Maxi première heure de cotation", minii as "Mini première heure de cotation"
    
    //, maxi1 as "Maxi1" ,mini1 as "Mini1",maxi2 as "Maxi2" ,mini2 as "Mini2",maxi3 as "Maxi3" ,mini3 as "Mini3"
    Screenshot-2021-04-04-122124.jpg Screenshot-2021-04-04-122124.jpg
    #166174 quote
    pableitor
    Participant
    Master

    how about this little code (just change the ORB and end of session times that fits you) :

    orbstart = 090000
    orbend = 110000
    endsession = 174500
    
    if opentime = orbstart then
    ORBH = high
    ORBL = low
    endif
    if opentime >= orbstart and opentime <= orbend then
    ORBH = max(high,ORBH)
    ORBL = min(low,ORBL)
    endif
    
    alpha = 255 * (opentime > orbend and opentime <= endsession)
    
    return ORBH coloured(0,0,0, alpha) as "ORB HIGH" , ORBL coloured(0,0,0, alpha) AS "ORB LOW"
    RubberToe thanked this post
    #166184 quote
    RubberToe
    Participant
    Average
    Nice thanks!
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

How do I draw opening range lines?


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
RubberToe @rubbertoe Participant
Summary

This topic contains 6 replies,
has 4 voices, and was last updated by RubberToe
4 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/03/2021
Status: Active
Attachments: 2 files
Logo Logo
Loading...