PINE LIBRARY
تم تحديثه

Mirpapa_Lib_HTF

117
Library "Mirpapa_Lib_HTF"
High Time Frame Handler Library:
Provides utilities for working with High Time Frame (HTF) and chart (LTF) conversions and data retrieval.

IsChartTFcomparisonHTF(_chartTf, _htfTf)
  IsChartTFcomparisonHTF
description
Determine whether the given High Time Frame (HTF) is greater than or equal to the current chart timeframe.
  Parameters:
    _chartTf (string): The current chart’s timeframe string (examples: "5", "15", "1D").
    _htfTf (string): The High Time Frame string to compare (examples: "60", "1D").
return
Returns true if HTF minutes ≥ chart minutes, false otherwise or na if conversion fails.

GetHTFrevised(_tf)
  GetHTFrevised
description
Retrieve a specific bar value from a Higher Time Frame (HTF) series.
Supports current and historical OHLC values, based on a case identifier.
  Parameters:
    _tf (string): The target HTF string (examples: "60", "1D").

GetHTFrevised(_tf, _case)
  Parameters:
    _tf (string)
    _case (string)

GetHTFfromLabel(_label)
  GetHTFfromLabel
description
Convert a Korean HTF label into a Pine Script-recognizable timeframe string.
Examples:
"5분" → "5"
"1시간" → "60"
"일봉" → "1D"
"주봉" → "1W"
"월봉" → "1M"
"연봉" → "12M"
  Parameters:
    _label (string): The Korean HTF label string (examples: "5분", "1시간", "일봉").
return
Returns the Pine Script timeframe string corresponding to the label, or "1W" if no match is found.

GetHTFoffsetToLTFoffset(_offset, _chartTf, _htfTf)
  GetHTFoffsetToLTFoffset
description
Adjust an HTF bar index and offset so that it aligns with the current chart’s bar index.
Useful for retrieving historical HTF data on an LTF chart.
  Parameters:
    _offset (int): The HTF bar offset (0 means current HTF bar, 1 means one bar ago, etc.).
    _chartTf (string): The current chart’s timeframe string (examples: "5", "15", "1D").
    _htfTf (string): The High Time Frame string to align (examples: "60", "1D").
return
Returns the corresponding LTF bar index after applying HTF offset. If result is negative, returns 0.

UpdateHTFCache(_cache, _tf)
  UpdateHTFCache
description HTF 데이터 캐싱 (성능 최적화).\
HTF의 OHLC 데이터를 캐싱하여 매 틱마다 request.security 호출 방지.\
_cache: 기존 캐시 (없으면 na, 첫 호출 시).\
_tf: 캐싱할 시간대 (예: "60", "1D").\
새 bar 또는 bar_index 변경 시에만 업데이트, 그 외에는 기존 캐시 반환.\
  Parameters:
    _cache (HTFCache): 기존 캐시 데이터 (없으면 na)
    _tf (string): 시간대
  Returns: HTFCache 업데이트된 캐시 데이터

GetTimeframeSettings(_currentTF, _midTF1m, _highTF1m, _midTF5m, _highTF5m, _midTF15m, _highTF15m, _midTF30m, _highTF30m, _midTF60m, _highTF60m, _midTF240m, _highTF240m, _midTF1D, _highTF1D, _midTF1W, _highTF1W, _midTF1M, _highTF1M)
  GetTimeframeSettings
description 현재 차트 시간대에 맞는 중위/상위 시간대 자동 선택.\
_currentTF: 현재 차트 시간대 (timeframe.period).\
1분~1월 차트별로 적절한 중위/상위 시간대 매핑.\
예: 5분 차트 → 중위 15분, 상위 60분.\
반환: [중위 시간대(string), 상위 시간대(string)].\
  Parameters:
    _currentTF (string): 현재 차트 시간대
    _midTF1m (string)
    _highTF1m (string)
    _midTF5m (string)
    _highTF5m (string)
    _midTF15m (string)
    _highTF15m (string)
    _midTF30m (string)
    _highTF30m (string)
    _midTF60m (string)
    _highTF60m (string)
    _midTF240m (string)
    _highTF240m (string)
    _midTF1D (string)
    _highTF1D (string)
    _midTF1W (string)
    _highTF1W (string)
    _midTF1M (string)
    _highTF1M (string)
  Returns: [string, string] [중위 시간대, 상위 시간대]

HTFCache
  Fields:
    _timeframe (series string)
    _lastBarIndex (series int)
    _isNewBar (series bool)
    _barIndex (series int)
    _open (series float)
    _high (series float)
    _low (series float)
    _close (series float)
    _open1 (series float)
    _close1 (series float)
    _high1 (series float)
    _low1 (series float)
    _open2 (series float)
    _close2 (series float)
    _high2 (series float)
    _low2 (series float)
    _high3 (series float)
    _low3 (series float)
    _time1 (series int)
    _time2 (series int)
ملاحظات الأخبار
v2

더해짐
GetCachedData(_cache, _offset, _type)
  GetCachedData
description 캐시된 HTF 데이터에서 특정 offset의 OHLCT 값 조회.\
배열 기반 캐시에서 안전하게 데이터 추출.\
  Parameters:
    _cache (HTFCache): HTF 캐시 데이터
    _offset (int): 조회할 offset (0~3)
    _type (string): 데이터 타입 ("o", "h", "l", "c", "t")
  Returns: float|int 요청된 데이터 값 (없으면 na)

GetBoxDataFromCache(_cache, _offset)
  GetBoxDataFromCache
description 캐시된 HTF 데이터에서 박스 생성용 좌표 추출.\
offset에 따른 시간과 가격 데이터를 한번에 반환.\
  Parameters:
    _cache (HTFCache): HTF 캐시 데이터
    _offset (int): 조회할 offset (0~3)
  Returns: [int, int, float, float] [leftTime, rightTime, high, low]

업데이트됨
UpdateHTFCache(_cache, _tf)
  UpdateHTFCache
description HTF 데이터 캐싱 (성능 최적화).\
HTF의 OHLC 데이터를 배열로 캐싱하여 매 틱마다 request.security 호출 방지.\
새 bar 또는 bar_index 변경 시에만 업데이트, 그 외에는 기존 캐시 반환.\
  Parameters:
    _cache (HTFCache): 기존 캐시 데이터 (없으면 na)
    _tf (string): 시간대 (예: "60", "1D")
  Returns: HTFCache 업데이트된 캐시 데이터

HTFCache
  Fields:
    _timeframe (series string)
    _lastBarIndex (series int)
    _isNewBar (series bool)
    _barIndex (series int)
    _opens (array<float>)
    _highs (array<float>)
    _lows (array<float>)
    _closes (array<float>)
    _times (array<int>)
ملاحظات الأخبار
v3

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.