Previous years Highest High and Lowest Lows
- This topic has 6 replies, 3 voices, and was last updated 6 years ago by .
Viewing 7 posts - 1 through 7 (of 7 total)
Viewing 7 posts - 1 through 7 (of 7 total)
Similar topics:
Forums › ProRealTime English forum › ProBuilder support › Previous years Highest High and Lowest Lows
Tagged: drawtext, yearly, yearly high
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… 🙂 .
1 2 3 4 5 |
TIMEFRAME(WEEKLY) IF YEAR = YEAR[1] THEN Wk52High = Highest[52](High[1]) con7 = Close >= Wk52High ENDIF |
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:
1 2 3 4 5 6 |
If Year<>Year[1] then yearlyHigh = Highest[BarIndex - lastYearBarIndex](High)[1] lastYearBarIndex = BarIndex endif return yearlyHigh |
@Nicolas, as always, THANK YOU!!!
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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 |
Sorry, I forgot the text, here is the modified code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
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 |
Find exclusive trading pro-tools on