could you convert this over plesea thannks

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #248276 quote
    Patrick K Templar
    Participant
    Average

    Session and Opening Range detection

    Drawing the range box and center line

    Plotting horizontal lines (ORB high, low, mid, targets)

    1️⃣ Session & ORB Detection
    In Pine Script:
    
    pinescript
    Copy
    Edit
    in_session = time(timeframe.period, session + ":23456", sTimeZone) != na
    if is_first
        orbHigh := high; orbLow := low
    else
        orbHigh := orbHigh[1]; orbLow := orbLow[1]
    ...
    ProRealTime equivalent (server time used):
    
    prorealcode
    Copy
    Edit
    // Inputs
    StartTime = 143000  // 09:30 EST
    EndTime   = 150000  // 10:00 EST
    
    // Variables
    once orbHigh = 0
    once orbLow = 0
    once started = 0
    
    if time >= StartTime and time < EndTime then
        if started = 0 then
            orbHigh = high
            orbLow = low
            started = 1
        else
            orbHigh = max(orbHigh, high)
            orbLow = min(orbLow, low)
        endif
    else
        started = 0  // reset for next session
    endif
    started flags first bar of session.
    
    After setup, orbHigh and orbLow track max/min.
    
    2️⃣ Drawing the Range Box & Center Line
    In Pine:
    
    pinescript
    Copy
    Edit
    dailyBox := box.new(...)
    box.set_*()
    // center line with line.new()
    ProRealTime uses drawrectangle:
    
    prorealcode
    Copy
    Edit
    if started = 1 then
        drawrectangle("", barindex - bars_in_session + 1, orbLow, barindex, orbHigh) coloured boxColor
        if showCenterLine then
            mid = (orbHigh + orbLow)/2
            drawline("", barindex - bars_in_session + 1, mid, barindex, mid) coloured rangeCenterColor
        endif
    endif
    Use only empty "" names.
    
    bars_in_session matches number of bars in defined session length.
    
    3️⃣ Plotting Horizontal ORB Levels & Targets
    In Pine, they use line.new() and arrays for many targets:
    
    pinescript
    Copy
    Edit
    orbHighLine := line.new(...)
    line.set_x2(...)
    ProRealTime is simpler — use multiple plot calls:
    
    prorealcode
    Copy
    Edit
    plot1( orbHigh, "ORB High", orbHighColor )
    plot2( orbLow,  "ORB Low",  orbLowColor )
    plot3( (orbHigh+orbLow)/2, "Mid", orbMidColor )
    
    range = orbHigh - orbLow
    target50 = orbHigh + range * 0.5
    plot4(target50, "Target 50%", orb50Color)
    
    target100 = orbHigh + range * 1.0
    plot5(target100, "Target 100%", orb100Color)
    #248280 quote
    JS
    Participant
    Senior

    Hi Patrick,

    Try this one:

    DefParam DrawOnLastBarOnly=True
    
    StartTime=143000 //09:30 EST
    EndTime=150000 //10:00 EST
    
    Once ORBHigh=0
    Once ORBLow=0
    Once Started=0
    
    If OpenTime=StartTime then
    BarIndexStart=BarIndex
    ElsIf OpenTime=EndTime then
    BarIndexEnd=BarIndex
    EndIf
    
    If OpenTime>=StartTime and OpenTime<=EndTime then
    If Started=0 then
    ORBHigh=High
    ORBLow=Low
    Started=1
    else
    ORBHigh=max(ORBHigh,High)
    ORBLow=min(ORBLow,Low)
    EndIf
    else
    Started=0 //Reset for next session
    EndIf
    
    MidLine=ORBLow+(ORBHigh-ORBLow)/2
    xRange=(ORBHigh-ORBLow)
    Target50=ORBHigh+xRange*0.5
    Target100=ORBHigh+xRange
    
    DrawRectangle(BarIndexStart,ORBLow,BarIndexEnd,ORBHigh)Coloured("Yellow")
    DrawSegment(BarIndexEnd,ORBHigh,BarIndex,ORBHigh)Coloured("Red")
    DrawText("ORBHigh=#ORBHigh#",BarIndex,ORBHigh+Range/4)Coloured("Red")
    DrawSegment(BarIndexEnd,ORBLow,BarIndex,ORBLow)Coloured("Green")
    DrawText("ORBLow=#ORBLow#",BarIndex,ORBLow-Range/4)Coloured("Green")
    DrawSegment(BarIndexEnd,MidLine,BarIndex,MidLine)
    DrawText("MidLine=#MidLine#",BarIndex,MidLine+Range/4)
    DrawSegment(BarIndexEnd,Target50,BarIndex,Target50)
    DrawText("Target50%=#Target50#",BarIndex,Target50+Range/4)
    DrawSegment(BarIndexEnd,Target100,BarIndex,Target100)
    DrawText("Target100%=#Target100#",BarIndex,Target100+Range/4)
    
    Return
    #248311 quote
    Patrick K Templar
    Participant
    Average

    thannk you i got todo my needs but i would like it better if you would like to help thannk you so much

    #248319 quote
    Patrick K Templar
    Participant
    Average
    DefParam DrawOnLastBarOnly=True
     
    StartTime=080000 //09:30 EST
    EndTime=081500 //10:00 EST
    CutoffTime = 153000 // 13:30 EST (lines stop plotting)
    
    Once ORBHigh=0
    Once ORBLow=0
    Once Started=0
     
    If OpenTime=StartTime then
    BarIndexStart=BarIndex
    ElsIf OpenTime=EndTime then
    BarIndexEnd=BarIndex
    EndIf
     
    If OpenTime>=StartTime and OpenTime<=EndTime then
    If Started=0 then
    ORBHigh=High
    ORBLow=Low
    Started=1
    else
    ORBHigh=max(ORBHigh,High)
    ORBLow=min(ORBLow,Low)
    EndIf
    else
    Started=0 //Reset for next session
    EndIf
     
    MidLine=ORBLow+(ORBHigh-ORBLow)/2
    MidLine2=MidLine+(ORBHigh-MidLine)/2
    MidLine3=MidLine+(ORBlow-MidLine)/2
    xRange=(ORBHigh-ORBLow)
    
    Target25=MidLine2+xRange*0.5
    Target50=ORBHigh+xRange*0.5
    Target75=MidLine2+xRange*1.0
    Target100=ORBHigh+xRange
    
    TargetM100=ORBlow-xRange
    TargetM75=MidLine3-xRange*1.0
    TargetM50=ORBlow-xRange*0.5
    TargetM25=MidLine3-xRange*0.5
    
    DrawRectangle(BarIndexStart,ORBLow,BarIndexEnd,ORBHigh)Coloured("Yellow")
    DrawSegment(BarIndexEnd,ORBHigh,BarIndex,ORBHigh)Coloured("Red")
    //DrawText("ORBHigh=#ORBHigh#",BarIndex,ORBHigh+Range/4)Coloured("Red")
    DrawSegment(BarIndexEnd,ORBLow,BarIndex,ORBLow)Coloured("Green")
    //DrawText("ORBLow=#ORBLow#",BarIndex,ORBLow-Range/4)Coloured("Green")
    DrawSegment(BarIndexEnd,MidLine,BarIndex,MidLine)
    //DrawText("MidLine=#MidLine#",BarIndex,MidLine+Range/4)
    DrawSegment(BarIndexEnd,Target50,BarIndex,Target50)Coloured("red")
    //DrawText("Target50%=#Target50#",BarIndex,Target50+Range/4)Coloured("red")
    DrawSegment(BarIndexEnd,Target100,BarIndex,Target100)Coloured("red")
    //DrawText("Target100%=#Target100#",BarIndex,Target100+Range/4)Coloured("red")
    DrawSegment(BarIndexEnd,MidLine2,BarIndex,MidLine2)Coloured(255,20,20,60)
    //DrawText("MidLine2=#MidLine2#",BarIndex,MidLine2+Range/4)Coloured(255,20,20,100)
    DrawSegment(BarIndexEnd,Target25,BarIndex,Target25)Coloured(255,20,20,60)
    //DrawText("Target25%=#Target25#",BarIndex,Target25+Range/4)Coloured(255,20,20,100)
    DrawSegment(BarIndexEnd,MidLine2,BarIndex,MidLine2)Coloured(255,20,20,60)
    //DrawText("MidLine2=#MidLine2#",BarIndex,MidLine2+Range/4)Coloured(255,20,20,100)
    DrawSegment(BarIndexEnd,Target75,BarIndex,Target75)Coloured(255,20,20,60)
    //DrawText("Target75%=#Target75#",BarIndex,Target75+Range/4)Coloured(255,20,20,100)
    DrawSegment(BarIndexEnd,TargetM100,BarIndex,TargetM100)Coloured("green")
    //DrawText("TargetM100%=#TargetM100#",BarIndex,TargetM100+Range/4)Coloured("green")
    DrawSegment(BarIndexEnd,Targetm75,BarIndex,Targetm75)Coloured(20,225,20,100)
    //DrawText("TargetM75%=#TargetM75#",BarIndex,TargetM75+Range/4)Coloured("green")
    DrawSegment(BarIndexEnd,Targetm50,BarIndex,Targetm50)Coloured("green")
    //DrawText("TargetM50%=#TargetM50#",BarIndex,TargetM75+Range/4)Coloured("green")
    DrawSegment(BarIndexEnd,Targetm25,BarIndex,Targetm25)Coloured(20,225,20,60)
    DrawSegment(BarIndexEnd,MidLine3,BarIndex,MidLine3)Coloured(20,225,20,60)
    //DrawText("Target25%=#Target25#",BarIndex,Target25+Range/4)Coloured(255,20,20,100)
    Return
    
    #248320 quote
    Patrick K Templar
    Participant
    Average

    As you can see I just copied more lines of your code and played about with it to make sure they ended up in the right place the coloring and then faded it all within the coding bar what would be better if that was outside so it just settings so you can change the thickness the style of the Lions the colors of the lines and the amount of lines if there’s a way to increase the amount of lines so you got the the main measurement and the Half point measurement and the quarter point measurement so and having them set individually and then being able to add more of them if you need them so the full measurement is the width of the range and then that’s just deviated from that half is obviously half of the Range and a quarter is also a quarter and the way I would do it the half ones would be the most bright colored lines and they fade as they go down to half and quarter

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

could you convert this over plesea thannks


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Patrick K Templar
7 months, 3 weeks ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 06/14/2025
Status: Active
Attachments: 2 files
Logo Logo
Loading...