First Hour Opening Range

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #212127 quote
    Alex72
    Participant
    New

    Hi, can someone help to create an indicator showing me th First Hour Opening Range?

    in other word the Initial Balance for the first hour of trading drawing in a box from 0o am to 23 pm like showing in the picture.

    #212130 quote
    robertogozzi
    Moderator
    Master

    There you go:

    //DEFPARAM DrawOnLastBarOnly = true
    StartTime = 000000
    EndTime   = 010000
    IF OpenTime = StartTime OR ((OpenTime > StartTime) AND (OpenTime < OpenTime[1])) THEN
       myBar = BarIndex
       HH    = high
       LL    = low
    ENDIF
    IF (OpenTime >= StartTime) AND (OpenTime <= EndTime) THEN
       HH    = max(HH,high)
       LL    = min(LL,low)
    ENDIF
    IF OpenTime >= EndTime THEN
       DrawSegment(myBar,HH,BarIndex,HH) coloured("Blue",255)
       DrawSegment(myBar,LL,BarIndex,LL) coloured("Red",255)
    ENDIF
    RETURN
    #212133 quote
    Alex72
    Participant
    New

    Thank you, just one thing

    I want it to stay for the 1 Hour range in every time frame, can you tell me where to add a code for it?

    #212134 quote
    Alex72
    Participant
    New

    Like in the picture

    #212140 quote
    robertogozzi
    Moderator
    Master

    That will show exactly, for any timeframe equal or less than 1 hour, the HIGH and LOW of the first hour (or whatever time you choose), from 0 to 23.

    #212144 quote
    Alex72
    Participant
    New

    i have made this change to get it

     

    timeframe(1 hour)  // I declare the timeframe, if not this will give the high and low of the first candle of the timeframe selected

     

    And thank you.

    #212145 quote
    Alex72
    Participant
    New

    I just copied and changed your code to apply it for the 15 minutes openning range, i got a scaling scaling down like in the picture here attached, can you tell me where is my error?

    Thank you

    //DEFPARAM DrawOnLastBarOnly = true
    timeframe(15mn)
    StartTime = 143000// this is my zone start time
    EndTime   = 000000
    IF OpenTime = StartTime OR ((OpenTime > StartTime) AND (OpenTime < OpenTime[1])) THEN
    myBar = BarIndex
    HH    = high
    LL    = low
    ENDIF
    IF (OpenTime >= StartTime) AND (OpenTime <= EndTime) THEN
    HH    = max(HH,high)
    LL    = min(LL,low)
    ENDIF
    IF OpenTime >= EndTime THEN
    DrawSegment(myBar,HH,BarIndex,HH) coloured("Green",255)
    DrawSegment(myBar,LL,BarIndex,LL) coloured("Red",255)
    ENDIF
    RETURN HH AS "OPR 15min High",LL AS "OPR 15min Low"
    
    #212153 quote
    robertogozzi
    Moderator
    Master

    There is no error, I used DRAWSEGMENT and DEFPARAM DrawOnLastBarOnly = true to prevent this.

    With RETURN you can’t change what has been printed in the prior candles, so you will always see steps when there’a new high or low. It can’t be gotten rid of.

    #212157 quote
    Alex72
    Participant
    New

    Thank you, i have a tradingview that doesnt show steps but it is a close source, so i can’t read it.

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

First Hour Opening Range


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Alex72 @alex72 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/26/2023
Status: Active
Attachments: 3 files
Logo Logo
Loading...