tartigradia

na_skip_highest

tartigradia Zaktualizowano   
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
Informacje o Wersji:
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
Informacje o Wersji:
v3: fix a mistake that made the loop use one more iteration than intended.
Biblioteka Pine

Działając zgodnie z prawdziwym duchem TradingView, autor opublikował ten kod Pine jako bibliotekę o otwartym kodzie źródłowym, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Brawa dla niego! Możesz korzystać z tej biblioteki prywatnie lub w innych publikacjach typu open source, ale ponowne wykorzystanie tego kodu w publikacji podlega Regulaminowi.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz skorzystać z tej biblioteki?

Skopiuj poniższy wiersz i wklej go w swoim skrypcie.