OPEN-SOURCE SCRIPT

Nth-Occurrence Custom barssince() Function by Cryptorhythms [CR]

By theheirophant
Nth-Occurrence Custom barssince() Function by Cryptorhythms [CR]

Description
The vanilla barssince() function in pine only finds the number of bars since the most recent occurrence of the condition. This version allows you to specify an Nth occurrence back to check the bars since! Its also a nice little one liner.

I really hope you enjoy it and if you're looking for more, this is our 79th script on TV, so there is plenty to choose from!

Let me know in the comments if you create anything useful from this or think of anyway to improve it!
barssincecryptorhythmscustomcustomfunctionfunctionimprovedMoving AveragesNTHnth-occurrenceoccurrenceTrend AnalysisVolatility
theheirophant
Twitter - twitter.com/cryptorhythms
Cryptorhythms Group Chat - t.me/cryptorhythms

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer