Daily Range boxes at three different time periods in one indicator Tradingview

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #206002 quote
    TraderGlyn
    Participant
    Senior

    Hi,

    I would be most grateful if this indicator could be coded for PRT or if not feedback as to how to create something with a similar function.

    It creates three range boxes at three different hourly  periods within 24h ( 0930-1025,0300-0355, 1930-2025) highlighting the high and low of price and within each box the highest candle close is marked with a dotted line. Lines extend forward from the high and low into following time periods and includes options to adjust time range, colours, style labels and lines.

    Thanks!

    #206018 quote
    TraderGlyn
    Participant
    Senior

    I also have the NT8 code for this, if that is better to look at.

    #206107 quote
    JS
    Participant
    Senior

    Hi @TraderGlyn

    I can draw the three “range boxes” at the different times but the lines are a problem (for me?) because the lines can be drawn but once drawn they can not be removed in PRT…

    Maybe a start…

    Regards Jaap

    If IntraDayBarIndex = 0 then
    x0300=0
    x0930=0
    x1930=0
    EndIf
    If OpenTime = 035500 and x0300=0 then
    HH = Highest[12](High)
    LL = Lowest[12](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0300=1
    EndIf
    
    If OpenTime = 102500 and x0930=0 then
    HH = Highest[12](High)
    LL = Lowest[12](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0930=1
    EndIf
    
    If OpenTime = 202500 and x1930=0 then
    HH = Highest[12](High)
    LL = Lowest[12](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x1930=1
    EndIf
    Return
    TraderGlyn and Nicolas thanked this post
    #206999 quote
    TraderGlyn
    Participant
    Senior
    This has proven very useful and is a great “start” thank you very much indeed. I enquired about getting the complete code created by PRT but unfortunately the cost is prohibitive for me at this time. One issue I am totally baffled about… I am trying to get the range box to appear on other time frames, particularly the 1 minute. I have studied the probuilder documents and cannot work out how to make this happen. It could be it is not possible but I thought that multi time frame adaptations was available now? Would greatly appreciate any solution.
    #207005 quote
    JS
    Participant
    Senior
    Hi @TraderGlyn I will have a look and let you know…
    #207014 quote
    JS
    Participant
    Senior

    Hi @TraderGlyn

    Here is the indicator for use in a time frame of 5 minutes and a time frame of 1 minute…

    Officially they are not multiple time frames because drawn objects in multiple time frames cause problems (with me?) but I solved it in a different way with “GetTimeFrame”…

     
    If IntraDayBarIndex = 0 then
    x0300=0
    x0930=0
    x1930=0
    EndIf
    
    xTF = GetTimeFrame
    
    If xTF=300 then
    If OpenTime = 035500 and x0300=0 then
    HH = Highest[11](High)
    LL = Lowest[11](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0300=1
    EndIf
    
    If OpenTime = 102500 and x0930=0 then
    HH = Highest[11](High)
    LL = Lowest[11](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0930=1
    EndIf
    
    If OpenTime = 202500 and x1930=0 then
    HH = Highest[11](High)
    LL = Lowest[11](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-11,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-12,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-12,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-12,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-12,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x1930=1
    EndIf
    EndIf
    
    If xTF=60 then
    If OpenTime = 035500 and x0300=0 then
    HH = Highest[55](High)
    LL = Lowest[55](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-55,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-60,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-60,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-60,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-60,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0300=1
    EndIf
    
    If OpenTime = 102500 and x0930=0 then
    HH = Highest[55](High)
    LL = Lowest[55](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-55,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-60,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-60,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-60,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-60,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x0930=1
    EndIf
    
    If OpenTime = 202500 and x1930=0 then
    HH = Highest[55](High)
    LL = Lowest[55](Low)
    xBarIndex = BarIndex
    DrawRectangle(xBarIndex-55,LL,xBarIndex,HH) Coloured(0,255,0)
    DrawSegment(xBarIndex-60,HH,xBarIndex,HH)Coloured(0,255,0)
    DrawSegment(xBarIndex-60,LL,xBarIndex,LL)Coloured(255,0,0)
    DrawText("High=#HH#",xBarIndex-60,HH+5*pipsize)Coloured(0,255,0)
    DrawText("Low=#LL#",xBarIndex-60,LL-5*pipsize)Coloured(255,0,0)
    //DrawRay(xBarIndex,HH,xBarIndex+1,HH)Coloured(0,255,0)Style(DottedLine)
    //DrawRay(xBarIndex,LL,xBarIndex+1,LL)Coloured(255,0,0)Style(DottedLine)
    x1930=1
    EndIf
    EndIf
    Return
    TraderGlyn and Nicolas thanked this post
    #207053 quote
    TraderGlyn
    Participant
    Senior
    Hi JS, This is excellent and works perfectly! Thanks for being so generous with your time and skills, really appreciate.
    JS thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Daily Range boxes at three different time periods in one indicator Tradingview


ProBuilder support

New Reply
Author
author-avatar
TraderGlyn @traderglyn Participant
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by TraderGlyn
3 years ago.

Topic Details
Forum: ProBuilder support
Language: English
Started: 12/18/2022
Status: Active
Attachments: 6 files
Logo Logo
Loading...