Previous Daily + Previous Weekly levels

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #262451 quote
    SnowblindTrades
    Participant
    New

    Hello all,

    I just got a 2 week trial of ProRealTime and hoping to make the most of it. I already have two scripts working fine but I am not a real programmer by any stretch and basically used an LLM to help make some basic ones.

    However, for whatever reason it is extremely difficult for said LLMs to produce an indicator that shows the previous daily high, low, EQ (mid point) – super weird because this whole platform seems to be missing visible OHLC indicators unless I am missing something – which is quite odd because each candle I hover over has OHLC data.

    I don’t know how to extract the code either but there already is a ‘Highs and Lows’ indicator – but it cant be configured to be anchored to specific things – it just shows the high and low of what’s on the screen at the time.

    I also saw that a user named blackwing produced a sort-of working version here? https://www.prorealcode.com/topic/previous-weeks-high-and-low-price-level/

    Any assistance with this would be greatly appreciated – just don’t really know where to start with this one.

    All the best,

    Snow



    #262455 quote
    Iván González
    Moderator
    Legend

    Hi and welcome to ProRealTime and to the forum!

    You are not missing anything: the platform does not ship a built-in “previous day OHLC levels” indicator, but the data is fully accessible from code. The reason LLMs struggle with this is that they tend to hallucinate Pine Script / MQL syntax (things like request.security(), != or &&) that simply does not exist in ProBuilder. The idiomatic ProRealTime way is the TIMEFRAME(daily, updateonclose) block — the same technique used in the thread you linked, just applied to the weekly timeframe there.

    Here is an indicator that plots yesterday’s High, Low and EQ (the midpoint of the range). It also includes yesterday’s Open and Close as an option (set ShowOpenClose = 1 to display them):

    //-----------------------------------------------------------//
    //PRC_Previous Day High Low EQ
    //version = 1
    //10.07.2026
    //Ivan Gonzalez @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------------------------//
    // Settings
    ShowOpenClose = 0 // 1 = also plot previous day Open and Close
    //-----------------------------------------------------------//
    // Previous day values (last completed daily candle - no repainting)
    TIMEFRAME(daily, updateonclose)
    pdh = high[0]  // previous day High
    pdl = low[0]   // previous day Low
    pdo = open[0]  // previous day Open
    pdc = close[0] // previous day Close
    TIMEFRAME(default)
    
    
    // EQ = midpoint (equilibrium) of the previous day range
    eqLevel = (pdh + pdl) / 2
    
    
    // Optional Open/Close plots
    plotO = pdo
    plotC = pdc
    if ShowOpenClose = 0 then
      plotO = undefined
      plotC = undefined
    endif
    
    
    RETURN pdh COLOURED(0,150,0) STYLE(line,2) AS "Previous Day High", pdl COLOURED(200,0,0) STYLE(line,2) AS "Previous Day Low", eqLevel COLOURED(128,128,128) STYLE(dottedline,2) AS "Previous Day EQ", plotO COLOURED(0,110,220) STYLE(dottedline,1) AS "Previous Day Open", plotC COLOURED(230,140,0) STYLE(dottedline,1) AS "Previous Day Close"
    

    The updateonclose modifier guarantees the values come from the last completed daily candle, so nothing repaints during the current session and the lines stay fixed all day, on any intraday timeframe.

    For the weekly version (same idea as blackwing’s thread), you only need to change daily to weekly — here it is ready to paste as a second indicator:

    //-----------------------------------------------------------//
    //PRC_Previous Week High Low EQ
    //version = 1
    //10.07.2026
    //Ivan Gonzalez @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //-----------------------------------------------------------//
    TIMEFRAME(weekly, updateonclose)
    pwh = high[0] // previous week High
    pwl = low[0]  // previous week Low
    TIMEFRAME(default)
    
    
    weq = (pwh + pwl) / 2
    
    
    RETURN pwh COLOURED(0,150,0) STYLE(line,2) AS "Previous Week High", pwl COLOURED(200,0,0) STYLE(line,2) AS "Previous Week Low", weq COLOURED(128,128,128) STYLE(dottedline,2) AS "Previous Week EQ"
    

    A few indicators from the library that do exactly this kind of job, in case you want more complete tools:

    Enjoy the trial!


    robertogozzi thanked this post
    #262456 quote
    SnowblindTrades
    Participant
    New

    Hi Ivan!

    Huge thanks for such a rapid reply – I don’t quite know how I was able to get this working but I wanted to share with the rest of the community this incase its helpful for anyone else out there.

    Happy for any critiques or feedback if it could be better overall – but im using it right now on my chart and so far it is working.

    All the best,

    Snow


    // =============================================
    // Previous Day & Week High/Low + Equilibrium
    // =============================================
    
    
    DEFPARAM DrawOnLastBarOnly = True
    
    
    // ---------- Previous Day ----------
    TimeFrame(Daily, UpdateOnClose)
    PDH = Highest[1](High)
    PDL = Lowest[1](Low)
    PDEQ = (PDH + PDL) / 2
    
    
    // ---------- Previous Week ----------
    TimeFrame(1 Week, UpdateOnClose)
    PWH = Highest[1](High)
    PWL = Lowest[1](Low)
    
    
    // ---------- Back to Chart Timeframe ----------
    TimeFrame(Default)
    
    
    // ------------------- Drawing -------------------
    
    
    // Previous Day
    DRAWLINE(BarIndex-2, PDH, BarIndex, PDH) COLOURED(0, 255, 255) STYLE(Line, 1)     // PDH - Cyan
    DRAWLINE(BarIndex-2, PDL, BarIndex, PDL) COLOURED(255, 0, 20) STYLE(Line, 1)     // PDL - Red
    DRAWLINE(BarIndex-2, PDEQ, BarIndex, PDEQ) COLOURED(255, 0, 20) STYLE(DottedLine, 1) // PDEQ - Same red as PDL
    
    
    // Previous Week
    DRAWLINE(BarIndex-2, PWH, BarIndex, PWH) COLOURED(0, 255, 10) STYLE(Line, 1)     // PWH - Green
    DRAWLINE(BarIndex-2, PWL, BarIndex, PWL) COLOURED(255, 102, 0) STYLE(Line, 1)     // PWL - Orange
    
    
    // Labels on the right
    DRAWTEXT("PDH", BarIndex+2, PDH, SansSerif, Standard, 10) COLOURED(0, 255, 255)
    DRAWTEXT("PDL", BarIndex+2, PDL, SansSerif, Standard, 10) COLOURED(255, 0, 20)
    DRAWTEXT("PDEQ",BarIndex+2, PDEQ, SansSerif, Standard, 10) COLOURED(255, 0, 20)
    
    
    DRAWTEXT("PWH", BarIndex+2, PWH, SansSerif, Standard, 10) COLOURED(0, 255, 10)
    DRAWTEXT("PWL", BarIndex+2, PWL, SansSerif, Standard, 10) COLOURED(255, 102, 0)
    
    
    RETURN
    
    
    
    Iván González and robertogozzi thanked this post
    #262457 quote
    SnowblindTrades
    Participant
    New

    Adjusted the font to be slightly offset so the lines aren’t striking straight thru them (calibrated for 15m timeframe)

    // =============================================
    // Previous Day & Week High/Low + Equilibrium
    // =============================================
    
    DEFPARAM DrawOnLastBarOnly = True
    
    // ---------- Previous Day ----------
    TimeFrame(Daily, UpdateOnClose)
    PDH = Highest[1](High)
    PDL = Lowest[1](Low)
    PDEQ = (PDH + PDL) / 2
    
    // ---------- Previous Week ----------
    TimeFrame(1 Week, UpdateOnClose)
    PWH = Highest[1](High)
    PWL = Lowest[1](Low)
    
    // ---------- Back to Chart Timeframe ----------
    TimeFrame(Default)
    
    // Offset for labels (positive = up)
    LabelOffset = 0.0005 * (Close + High + Low)/3   // Small dynamic offset (~0.05%)
    
    // ------------------- Drawing -------------------
    
    // Previous Day
    DRAWLINE(BarIndex-2, PDH, BarIndex, PDH) COLOURED(0, 255, 255) STYLE(Line, 1)
    DRAWLINE(BarIndex-2, PDL, BarIndex, PDL) COLOURED(255, 0, 20) STYLE(Line, 1)
    DRAWLINE(BarIndex-2, PDEQ, BarIndex, PDEQ) COLOURED(255, 0, 20) STYLE(DottedLine, 1)
    
    // Previous Week
    DRAWLINE(BarIndex-2, PWH, BarIndex, PWH) COLOURED(0, 255, 10) STYLE(Line, 1)
    DRAWLINE(BarIndex-2, PWL, BarIndex, PWL) COLOURED(255, 102, 0) STYLE(Line, 1)
    
    // Labels (with upward offset)
    DRAWTEXT("PDH", BarIndex+2, PDH + LabelOffset, SansSerif, Standard, 10) COLOURED(0, 255, 255)
    DRAWTEXT("PDL", BarIndex+2, PDL + LabelOffset, SansSerif, Standard, 10) COLOURED(255, 0, 20)
    DRAWTEXT("PDEQ",BarIndex+2, PDEQ + LabelOffset, SansSerif, Standard, 10) COLOURED(255, 0, 20)
    
    DRAWTEXT("PWH", BarIndex+2, PWH + LabelOffset, SansSerif, Standard, 10) COLOURED(0, 255, 10)
    DRAWTEXT("PWL", BarIndex+2, PWL + LabelOffset, SansSerif, Standard, 10) COLOURED(255, 102, 0)
    
    RETURN
    
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Previous Daily + Previous Weekly levels


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by SnowblindTrades
1 day ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/10/2026
Status: Active
Attachments: No files
Logo Logo
Loading...