Finding the High of a series of bars
Forums › ProRealTime English forum › ProOrder support › Finding the High of a series of bars
- This topic has 6 replies, 4 voices, and was last updated 1 month ago by
robertogozzi.
-
-
09/26/2025 at 6:25 AM #251834
How do. I find the High of a series of bars.
say countofpostions = 10
How can I find the Maximum (or highest) of the High of the bar when countofpositions became 10 and the High of the current bar (and subsequent bar when that happens).
Thank you
09/26/2025 at 8:40 AM #251836You can use the HIGHEST function in ProBuilder to find the maximum of the last N bars.
In your case, if you want to get the highest value of the High over the last 10 bars, you can do it like this:12345678countofpositions = 10maxHigh = HIGHEST[countofpositions](High)if maxHigh = high thenDRAWTEXT("MaxHigh = #maxHigh#", BarIndex, High)endifreturn maxHigh1 user thanked author for this post.
09/26/2025 at 10:18 AM #251842Hi,
the request is slightly ambiguous because you don’t use the same spelling for countofposition as an existing proorder keyword, so it might give the impression you meant it as a variable for the series length, but it could be you really meant “when my position reaches size 10”:
https://www.prorealcode.com/documentation/countofposition/
so, assuming the latter and using countofposition as the above proorder command counting your number of contracts/shares (so spelling with no “s”, and adding the missing “i”) rather than a personal variable, then you could try this to find highest value of both highs, regardless of how long it took between reaching size 10 and current bar (NB: this piece of code doesn’t extrapolate on your behalf what value to give to “myhighest” after countofposition is not 10 anymore):
123456789if countofposition[1]<countofposition AND countofposition=10 thenhighwhen10=highelsif countofposition<>10 thenhighwhen10=0endifif countofposition=10 thenmyhighest= max(highwhen10,high)endif1 user thanked author for this post.
09/29/2025 at 11:55 AM #25193209/29/2025 at 8:18 PM #252009Maybe this one?
1234567891011121314151617181920212223When10bar = 0When10Hi = 0NextBar = 0NextHi = 0CurrentBar = 0CurrentHi = highmyPos = CountOfPositionFOR i = 0 TO BarIndex - 1IF myPos[i] = 10 THENWhen10bar = iWhen10Hi = high[i]NextBar = i - 1NextHi = high[NextBar]breakENDIFENDIFNEXTgraph When10bargraph When10Higraph NextBargraph NextHigraph CurrentBargraph CurrentHi1 user thanked author for this post.
10/02/2025 at 6:52 AM #25208710/02/2025 at 10:31 AM #252093Yes, that seems correct.
You can easily check it by GRAPHing TopLevel to verify if it’s the correct value when the last entry occurred:
1GRAPH TopLevel //or GRAPHONPRICE TopLevel1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on 