tartigradia

na_skip_highest

tartigradia מעודכן   
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
הערות שחרור:
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
הערות שחרור:
v3: fix a mistake that made the loop use one more iteration than intended.
ספריית Pine

ברוח TradingView אמיתית, המחבר פרסם את קוד Pine זה כספריית קוד פתוח כך שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומים אחרים בקוד פתוח, אך השימוש החוזר בקוד זה בפרסום כפוף לכללי הבית.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.

רוצה להשתמש בספרייה זו?

העתק את השורה הבאה והדבק אותה בסקריפט שלך.