I'm looking at the version 4 documentation (https://www.tradingview.com/pine-script-docs/en/v4/index.html and I'm not sure I'm finding what I need:
I'd like to have a function which, for some price P
, determines the number of times the real price p crossed that value within the most recent candle.
Ex.
if price P was above high / below low, then crossing number of C(p,P)=0
.
Ex2.
if price p was monotonic, then for any P in the candle, C(p,P)= 1
.