TradingView
theheirophant
12 avr. 2020 02:24

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

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Description

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!
Commentaires
LucF
This is a crazy good gem. Love it! Elegant, simple, brilliant and raw beauty. Thanks for this.
ddctv
Hi @theheirophant ! Thanks so much for this. I just discovered how to combine valuewhen and barssince and was doing it manually - so this is a big help. I'm curious - could this be used as part of pine's new "libraries" in v5, so I could import this and other handy little "utility" scripts with one line? Hit me up with a DM if you would care to discuss, would be great! Thanks. =)
theheirophant
@ddctv, Yes I will be releasing this and other functions as part of some libraries very soon! Stay tuned its already in the works :)
ddctv
@theheirophant, Boom! That's great. I'd definitely liked to be notified of such an event. Is there a way I can be?
TradeChartist
Bloody Brilliant.
Peter_O
This is outstanding, thanks man!
iamthree
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 !!!
theheirophant
@iamthree, thanks for letting me know mate. comments like this make my day!
kurtsmock
amazing stuff. always so helpful!
PineCoders
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!
Plus