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

Nth-Occurrence Custom barssince() Function by Cryptorhythms

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!
Ta bort från favoritskript Lägg till som favoritskript


This is a crazy good gem. Love it! Elegant, simple, brilliant and raw beauty. Thanks for this.
+3 Svara
Bloody Brilliant.
+1 Svara
This is outstanding, thanks man!
+1 Svara
Thank you So much @theheirophant :) this script / code helped me to achieve my goal of building an indicator that I can adjust to begin from the Nth Occurrence
awesome work !!! I am so great full that you published this
as a total programming and pinescript noob people like you make my dreams possible

My goal was to start a part of an indicator on a Nth Occurrence
I could not be successful with out the help and hard work of the Pine script giants or Legends that came before me

I have been trying for over 8 days to build what I wanted to
this was the break though I needed

Thank you kindly :) X infinity !!!
+1 Svara
@iamthree, thanks for letting me know mate. comments like this make my day!
+1 Svara
amazing stuff. always so helpful!
+1 Svara
This publication will be featured in our "Best Scripts of The Month" selection. Thank you for your valuable contribution to the TradingView community, and congrats!
+1 Svara
Amazing and elegant implementation! Thanks for sharing ;)
+1 Svara
what is the usage of this?
theheirophant alirezakaj
@alirezakaj, you would use it in the same places that you would use barssince(). But with this version you can choose the barssince the third occurrence, or the 12th. In terms of trading there are tons of places you can use something like this. It simply counts how many bars have passed since the specified condition occurred.
Hem Aktie-screener Forex-screener Krypto-screener Ekonomisk kalender Hur det fungerar Diagramfunktioner Priser Tipsa en vän Ordningsregler Hjälpcenter Webbsidor och mäklarlösningar Widgets Diagramlösningar Lightweight Charting Library Blogg och nyheter Twitter
Profil Profilinställningar Konto och fakturering Hänvisade vänner Mynt Mina kölappar Hjälpcenter Publicerade idéer Följare Följer Privata meddelanden Chatt Logga ut