tartigradia

na_skip_highest

tartigradia Mis à jour   
Library "na_skip_highest"
Finds the highest historic value over len bars but skip na valued bars (eg, off days). In other words, this will ensure we find the highest value over len bars with a real value, and if there are any na bars in-between, we skip over but the loop will continue. This allows to mimic calculations on markets with off days (eg, weekends).

na_skip_highest(src, len)
  Finds the highest historic value over len bars but skip na valued bars (eg, off days). In other words, this will ensure we find the highest value over len bars with a real value, and if there are any na bars in-between, we skip over but the loop will continue. This allows to mimic calculations on markets with off days (eg, weekends).
  Parameters:
    src: series float source (eg, close)
    len: int length, number of recent bars to consider in the window to find the highest value
  Returns: highest float highest value found over the len window
Notes de version:
v2

Fixed:
Forgot to remove a debug line in calculations, previous version was not working, now it works as expected (tested on field in another indicator).

Added:
na_skip_highest_or_lowest(src, len, mode)
  Internal function. Finds the highest or lowest historic value over len bars but skip na valued bars (eg, off days). In other words, this will ensure we find the highest value over len bars with a real value, and if there are any na bars in-between, we skip over but the loop will continue. This allows to mimic calculations on markets with off days (eg, weekends).
  Parameters:
    src: series float source (eg, close)
    len: int length, number of recent bars to consider in the window to find the highest value
    mode: int If 0 finds the highest value, if 1 finds the lowest value. Internal parameter.
  Returns: highest float highest value found over the len window

na_skip_lowest(src, len)
  Finds the lowest historic value over len bars but skip na valued bars (eg, off days). In other words, this will ensure we find the lowest value over len bars with a real value, and if there are any na bars in-between, we skip over but the loop will continue. This allows to mimic calculations on markets with off days (eg, weekends).
  Parameters:
    src: series float source (eg, close)
    len: int length, number of recent bars to consider in the window to find the highest value
  Returns: highest float highest value found over the len window
Notes de version:
v3: fix a mistake that made the loop use one more iteration than intended.
Bibliothèque Pine

Dans le véritable esprit de TradingView, l'auteur a publié ce code Pine en tant que bibliothèque open-source afin que d'autres programmeurs Pine de notre communauté puissent le réutiliser. Bravo à l'auteur ! Vous pouvez utiliser cette bibliothèque à titre privé ou dans d'autres publications open-source, mais la réutilisation de ce code dans une publication est régie par notre Règlement.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.

Vous voulez utiliser cette bibliothèque?

Copiez le texte dans le presse-papiers et collez-le dans votre script.