Previous years Highest High and Lowest Lows

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

    Hi All, Pls can somone help with how to get the highest highs and lowest lows of the previous years? i have this code but not sure why trying to check if the current weeks bar close is higher than the last year’s highest high doesn’t work all the time?. I’m new to ProRealTime and ProRealCode… 🙂 .

    TIMEFRAME(WEEKLY)
    IF YEAR = YEAR[1] THEN
    Wk52High = Highest[52](High[1])
    con7 = Close >= Wk52High
    ENDIF
    
    #31276 quote
    Nicolas
    Keymaster
    Master

    The code you made is not compatible with ProBuilder, TIMEFRAME keyword is only available for ProScreener.

    This is the code of an indicator that can give you the last year high:

    If Year<>Year[1] then
    yearlyHigh = Highest[BarIndex - lastYearBarIndex](High)[1]
    lastYearBarIndex = BarIndex
    endif
    
    return yearlyHigh
    #31287 quote
    donaldthetrader
    Participant
    Average

    @Nicolas, as always, THANK YOU!!!

    #80827 quote
    roos
    Participant
    New

    Hi Nicolas, I wondered how could I adjust this code to only see the prior year levels rather than all the years H,L,C,  and also how might I add text to the lines eg “PY High {price}” etc..

    Many thanks

    #80841 quote
    Nicolas
    Keymaster
    Master

    This code should only plot the last year High on the chart. Make sure you have sufficient displayed units for the code to correctly compute.

    myline=undefined
    
    If Year<>Year[1]  then
    yearlyHigh = Highest[BarIndex - lastYearBarIndex](High)[1]
    lastYearBarIndex = BarIndex
    yearTest = year
    endif
    
    if yeartest = CurrentYear then 
    myline  = yearlyHIgh
    endif
    
    return myline
    roos thanked this post
    #80843 quote
    Nicolas
    Keymaster
    Master

    Sorry, I forgot the text, here is the modified code:

    defparam drawonlastbaronly=true
    myline=undefined
    
    If Year<>Year[1]  then
    yearlyHigh = Highest[BarIndex - lastYearBarIndex](High)[1]
    lastYearBarIndex = BarIndex
    yearTest = year
    endif
    
    if yeartest = CurrentYear then 
    myline  = yearlyHIgh
    drawtext("                                  PY High {#myline#}",barindex,myline,dialog,bold,14)
    endif
    
    return myline
    roos thanked this post
    #80943 quote
    roos
    Participant
    New

    Great work Nicolas, thank very much for the quick response.

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

Previous years Highest High and Lowest Lows


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by roos
7 years, 4 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/06/2017
Status: Active
Attachments: 3 files
Logo Logo
Loading...