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).
You 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:
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”:
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):
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.