PINE LIBRARY
ที่อัปเดต: MirPapa_Lib_Box

Library "MirPapa_Lib_Box"
GetHTFrevised(_tf, _case)
GetHTFrevised
description Retrieve a specific bar value from a Higher Time Frame (HTF) series.
Parameters:
_tf (string): string The target HTF string (examples: "60", "1D").
_case (string): string Case string determining which OHLC value to request.
return float Returns the requested HTF value or na if _case does not match.
GetHTFrevised(_tf)
Parameters:
_tf (string)
GetHTFoffsetToLTFoffset(_offset, _chartTf, _htfTf)
GetHTFoffsetToLTFoffset
description Adjust an HTF offset to an LTF offset by calculating the ratio of timeframes.
Parameters:
_offset (int): int The HTF bar offset (0 means current HTF bar).
_chartTf (string): string The current chart's timeframe (e.g., "5", "15", "1D").
_htfTf (string): string The High Time Frame string (e.g., "60", "1D").
return int The corresponding LTF bar index. Returns 0 if the result is negative.
GetHtfFromLabel(_label)
GetHtfFromLabel
description Convert a Korean HTF label into a Pine Script timeframe string.
Parameters:
_label (string): string The Korean label (e.g., "5분", "1시간").
return string Returns the corresponding Pine Script timeframe (e.g., "5", "60").
IsChartTFcomparisonHTF(_chartTf, _htfTf)
IsChartTFcomparisonHTF
description Determine whether a given HTF is greater than or equal to the current chart timeframe.
Parameters:
_chartTf (string): string Current chart timeframe (e.g., "5", "15", "1D").
_htfTf (string): string HTF timeframe (e.g., "60", "1D").
return bool True if HTF ≥ chartTF, false otherwise.
IsCondition(_boxType, _isBull, _pricePrev, _priceNow)
IsCondition
description FOB, FVG 조건 체크.\
_boxType: "fob"(Fair Order Block) 또는 "fvg"(Fair Value Gap).\
_isBull: true(상승 패턴), false(하락 패턴).\
상승 시 현재 가격이 이전 가격보다 높으면 true, 하락 시 이전 가격이 현재 가격보다 높으면 true 반환.
Parameters:
_boxType (string): 박스 타입 ("fob", "fvg")
_isBull (bool): 상승(true) 또는 하락(false)
_pricePrev (float): 이전 가격
_priceNow (float): 현재 가격
Returns: bool 조건 만족 여부
IsCondition(_boxType, _high2, _high1, _high0, _low2, _low1, _low0)
IsCondition
description Sweep 조건 체크 (Swing High/Low 동시 발생).\
_boxType: "sweep" 또는 "breachBoth".\
조건: high2 < high1 > high0 (Swing High) AND low2 > low1 < low0 (Swing Low).\
중간 캔들이 양쪽보다 높고 낮은 지점을 동시에 형성할 때 true 반환.
Parameters:
_boxType (string): 박스 타입 ("sweep", "breachBoth")
_high2 (float)
_high1 (float)
_high0 (float)
_low2 (float)
_low1 (float)
_low0 (float)
Returns: bool 조건 만족 여부
IsCondition(_boxType, _isBull, _open1, _close1, _high1, _low1, _open0, _close0, _low2, _low3, _high2, _high3)
IsCondition
description RB (Rejection Block) 조건 체크.\
_boxType: "rb" (Rejection Block).\
상승 RB: candle1=음봉, candle0=양봉, low3>low1 AND low2>low1, close1*1.001>open0, open1<close0.\
하락 RB: candle1=양봉, candle0=음봉, high3<high1 AND high2<high1, close1*0.999<open0, open1>close0.\
이전 캔들의 거부 후 현재 캔들이 반대 방향으로 전환될 때 true 반환.
Parameters:
_boxType (string): 박스 타입 ("rb")
_isBull (bool): 상승(true) 또는 하락(false)
_open1 (float)
_close1 (float)
_high1 (float)
_low1 (float)
_open0 (float)
_close0 (float)
_low2 (float)
_low3 (float)
_high2 (float)
_high3 (float)
Returns: bool 조건 만족 여부
IsCondition(_boxType, _isBull, _open2, _close1, _open1, _close0)
IsCondition
description SOB (Strong Order Block) 조건 체크.\
_boxType: "sob" (Strong Order Block).\
상승 SOB: 양봉2 => 음봉1 => 양봉0, open2 > close1 AND open1 < close0.\
하락 SOB: 음봉2 => 양봉1 => 음봉0, open2 < close1 AND open1 > close0.\
3개 캔들 패턴으로 강한 주문 블록 형성 시 true 반환.
Parameters:
_boxType (string): 박스 타입 ("sob")
_isBull (bool): 상승(true) 또는 하락(false)
_open2 (float): 2개 이전 캔들 open
_close1 (float): 1개 이전 캔들 close
_open1 (float): 1개 이전 캔들 open
_close0 (float): 현재 캔들 close
Returns: bool 조건 만족 여부
CreateBox(_boxType, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache)
CreateBox
description 박스 생성 (breachMode 자동 결정).\
_boxType: "fob", "rb", "custom" → directionalHighLow, 나머지 → both.\
_tf: 시간대 (timeframe.period 또는 HTF).\
_isBull: true(상승 박스), false(하락 박스).\
_cache: HTF 사용 시 필수, CurrentTF는 na.\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateBox(_boxType, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache, _customText)
CreateBox
description 박스 생성 (커스텀 텍스트 지원, breachMode 자동 결정).\
_boxType: "fob", "rb", "custom" → directionalHighLow, 나머지 → both.\
_customText: 박스에 표시할 텍스트 (비어있으면 "시간대 박스타입" 형식으로 자동 생성).\
_isBull: true(상승 박스), false(하락 박스).\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터
_customText (string): 커스텀 텍스트
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateBox(_boxType, _breachMode, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache, _customText)
CreateBox
description 박스 생성 (breachMode 명시적 지정).\
_breachMode: "both"(양쪽 모두 돌파), "directionalHighLow"(방향성 high/low 돌파), "directionalClose"(방향성 close 돌파).\
_isBull: true(상승 박스), false(하락 박스).\
_customText: 박스에 표시할 텍스트 (비어있으면 "시간대 박스타입" 형식으로 자동 생성).\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입 (fob, fvg, sweep, rb, custom 등)
_breachMode (string): 돌파 처리 방식: "both" (양쪽 모두), "directionalHighLow" (방향성 high/low), "directionalClose" (방향성 close)
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false) 방향
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터 (CurrentTF는 na)
_customText (string): 커스텀 텍스트 (비어있으면 자동 생성)
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateCustomBox(_boxType, _breachMode, _isBull, _top, _bottom, _left, _right, _useLine, _colorBG, _colorBD, _colorText, _text)
CreateCustomBox
description 완전히 유연한 커스텀 박스 생성.\
사용자가 박스 위치(top, bottom, left, right), breach mode, 모든 파라미터를 직접 지정.\
조건 체크는 사용자 스크립트에서 수행하고, 이 함수는 박스 생성만 담당.\
새로운 박스 타입 추가 시 라이브러리 수정 없이 사용 가능.
Parameters:
_boxType (string): 박스 타입 (사용자 정의 문자열)
_breachMode (string): 돌파 처리 방식: "both", "directionalHighLow", "directionalClose", "sobClose"
_isBull (bool): 상승(true) 또는 하락(false) 방향
_top (float): 박스 상단 가격
_bottom (float): 박스 하단 가격
_left (int): 박스 시작 시간 (xloc.bar_time 사용)
_right (int): 박스 종료 시간 (xloc.bar_time 사용)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_text (string): 박스에 표시할 텍스트
Returns: [bool, BoxData] 성공 여부와 박스 데이터
ProcessBoxDatas(_openBoxes, _closedBoxes, _useMidLine, _closeCount, _colorClose, _currentBarIndex, _currentLow, _currentHigh, _currentTime)
ProcessBoxDatas
description 박스 확장 및 돌파 처리.\
열린 박스들을 현재 bar까지 확장하고, 돌파 조건 체크.\
_closeCount: 돌파 횟수 (이 횟수만큼 돌파 시 박스 종료).\
breachMode에 따라 돌파 체크 방식 다름 (both/directionalHighLow/directionalClose).\
종료된 박스는 _closedBoxes로 이동하고 _colorClose 색상 적용.\
barstate.islast와 barstate.isconfirmed에서 호출 권장.
Parameters:
_openBoxes (array<BoxData>): 열린 박스 배열
_closedBoxes (array<BoxData>): 닫힌 박스 배열
_useMidLine (bool): 중간선 표시 여부
_closeCount (int): 돌파 카운트 (이 횟수만큼 돌파 시 종료)
_colorClose (color): 종료된 박스 색상
_currentBarIndex (int): 현재 bar_index
_currentLow (float): 현재 low
_currentHigh (float): 현재 high
_currentTime (int): 현재 time
Returns: bool 항상 true
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] [중위 시간대, 상위 시간대]
BoxData
BoxData
Fields:
_type (series string): 박스 타입 (fob, fvg, sweep, rb, custom 등)
_breachMode (series string): 돌파 처리 방식
_isBull (series bool): 상승(true) 또는 하락(false) 방향
_box (series box)
_line (series line)
_boxTop (series float)
_boxBot (series float)
_boxMid (series float)
_topBreached (series bool)
_bottomBreached (series bool)
_breakCount (series int)
_createdBar (series int)
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)
GetHTFrevised(_tf, _case)
GetHTFrevised
description Retrieve a specific bar value from a Higher Time Frame (HTF) series.
Parameters:
_tf (string): string The target HTF string (examples: "60", "1D").
_case (string): string Case string determining which OHLC value to request.
return float Returns the requested HTF value or na if _case does not match.
GetHTFrevised(_tf)
Parameters:
_tf (string)
GetHTFoffsetToLTFoffset(_offset, _chartTf, _htfTf)
GetHTFoffsetToLTFoffset
description Adjust an HTF offset to an LTF offset by calculating the ratio of timeframes.
Parameters:
_offset (int): int The HTF bar offset (0 means current HTF bar).
_chartTf (string): string The current chart's timeframe (e.g., "5", "15", "1D").
_htfTf (string): string The High Time Frame string (e.g., "60", "1D").
return int The corresponding LTF bar index. Returns 0 if the result is negative.
GetHtfFromLabel(_label)
GetHtfFromLabel
description Convert a Korean HTF label into a Pine Script timeframe string.
Parameters:
_label (string): string The Korean label (e.g., "5분", "1시간").
return string Returns the corresponding Pine Script timeframe (e.g., "5", "60").
IsChartTFcomparisonHTF(_chartTf, _htfTf)
IsChartTFcomparisonHTF
description Determine whether a given HTF is greater than or equal to the current chart timeframe.
Parameters:
_chartTf (string): string Current chart timeframe (e.g., "5", "15", "1D").
_htfTf (string): string HTF timeframe (e.g., "60", "1D").
return bool True if HTF ≥ chartTF, false otherwise.
IsCondition(_boxType, _isBull, _pricePrev, _priceNow)
IsCondition
description FOB, FVG 조건 체크.\
_boxType: "fob"(Fair Order Block) 또는 "fvg"(Fair Value Gap).\
_isBull: true(상승 패턴), false(하락 패턴).\
상승 시 현재 가격이 이전 가격보다 높으면 true, 하락 시 이전 가격이 현재 가격보다 높으면 true 반환.
Parameters:
_boxType (string): 박스 타입 ("fob", "fvg")
_isBull (bool): 상승(true) 또는 하락(false)
_pricePrev (float): 이전 가격
_priceNow (float): 현재 가격
Returns: bool 조건 만족 여부
IsCondition(_boxType, _high2, _high1, _high0, _low2, _low1, _low0)
IsCondition
description Sweep 조건 체크 (Swing High/Low 동시 발생).\
_boxType: "sweep" 또는 "breachBoth".\
조건: high2 < high1 > high0 (Swing High) AND low2 > low1 < low0 (Swing Low).\
중간 캔들이 양쪽보다 높고 낮은 지점을 동시에 형성할 때 true 반환.
Parameters:
_boxType (string): 박스 타입 ("sweep", "breachBoth")
_high2 (float)
_high1 (float)
_high0 (float)
_low2 (float)
_low1 (float)
_low0 (float)
Returns: bool 조건 만족 여부
IsCondition(_boxType, _isBull, _open1, _close1, _high1, _low1, _open0, _close0, _low2, _low3, _high2, _high3)
IsCondition
description RB (Rejection Block) 조건 체크.\
_boxType: "rb" (Rejection Block).\
상승 RB: candle1=음봉, candle0=양봉, low3>low1 AND low2>low1, close1*1.001>open0, open1<close0.\
하락 RB: candle1=양봉, candle0=음봉, high3<high1 AND high2<high1, close1*0.999<open0, open1>close0.\
이전 캔들의 거부 후 현재 캔들이 반대 방향으로 전환될 때 true 반환.
Parameters:
_boxType (string): 박스 타입 ("rb")
_isBull (bool): 상승(true) 또는 하락(false)
_open1 (float)
_close1 (float)
_high1 (float)
_low1 (float)
_open0 (float)
_close0 (float)
_low2 (float)
_low3 (float)
_high2 (float)
_high3 (float)
Returns: bool 조건 만족 여부
IsCondition(_boxType, _isBull, _open2, _close1, _open1, _close0)
IsCondition
description SOB (Strong Order Block) 조건 체크.\
_boxType: "sob" (Strong Order Block).\
상승 SOB: 양봉2 => 음봉1 => 양봉0, open2 > close1 AND open1 < close0.\
하락 SOB: 음봉2 => 양봉1 => 음봉0, open2 < close1 AND open1 > close0.\
3개 캔들 패턴으로 강한 주문 블록 형성 시 true 반환.
Parameters:
_boxType (string): 박스 타입 ("sob")
_isBull (bool): 상승(true) 또는 하락(false)
_open2 (float): 2개 이전 캔들 open
_close1 (float): 1개 이전 캔들 close
_open1 (float): 1개 이전 캔들 open
_close0 (float): 현재 캔들 close
Returns: bool 조건 만족 여부
CreateBox(_boxType, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache)
CreateBox
description 박스 생성 (breachMode 자동 결정).\
_boxType: "fob", "rb", "custom" → directionalHighLow, 나머지 → both.\
_tf: 시간대 (timeframe.period 또는 HTF).\
_isBull: true(상승 박스), false(하락 박스).\
_cache: HTF 사용 시 필수, CurrentTF는 na.\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateBox(_boxType, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache, _customText)
CreateBox
description 박스 생성 (커스텀 텍스트 지원, breachMode 자동 결정).\
_boxType: "fob", "rb", "custom" → directionalHighLow, 나머지 → both.\
_customText: 박스에 표시할 텍스트 (비어있으면 "시간대 박스타입" 형식으로 자동 생성).\
_isBull: true(상승 박스), false(하락 박스).\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터
_customText (string): 커스텀 텍스트
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateBox(_boxType, _breachMode, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache, _customText)
CreateBox
description 박스 생성 (breachMode 명시적 지정).\
_breachMode: "both"(양쪽 모두 돌파), "directionalHighLow"(방향성 high/low 돌파), "directionalClose"(방향성 close 돌파).\
_isBull: true(상승 박스), false(하락 박스).\
_customText: 박스에 표시할 텍스트 (비어있으면 "시간대 박스타입" 형식으로 자동 생성).\
반환: [성공 여부(bool), 박스 데이터(BoxData)].
Parameters:
_boxType (string): 박스 타입 (fob, fvg, sweep, rb, custom 등)
_breachMode (string): 돌파 처리 방식: "both" (양쪽 모두), "directionalHighLow" (방향성 high/low), "directionalClose" (방향성 close)
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false) 방향
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache): HTF 캐시 데이터 (CurrentTF는 na)
_customText (string): 커스텀 텍스트 (비어있으면 자동 생성)
Returns: [bool, BoxData] 성공 여부와 박스 데이터
CreateCustomBox(_boxType, _breachMode, _isBull, _top, _bottom, _left, _right, _useLine, _colorBG, _colorBD, _colorText, _text)
CreateCustomBox
description 완전히 유연한 커스텀 박스 생성.\
사용자가 박스 위치(top, bottom, left, right), breach mode, 모든 파라미터를 직접 지정.\
조건 체크는 사용자 스크립트에서 수행하고, 이 함수는 박스 생성만 담당.\
새로운 박스 타입 추가 시 라이브러리 수정 없이 사용 가능.
Parameters:
_boxType (string): 박스 타입 (사용자 정의 문자열)
_breachMode (string): 돌파 처리 방식: "both", "directionalHighLow", "directionalClose", "sobClose"
_isBull (bool): 상승(true) 또는 하락(false) 방향
_top (float): 박스 상단 가격
_bottom (float): 박스 하단 가격
_left (int): 박스 시작 시간 (xloc.bar_time 사용)
_right (int): 박스 종료 시간 (xloc.bar_time 사용)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_text (string): 박스에 표시할 텍스트
Returns: [bool, BoxData] 성공 여부와 박스 데이터
ProcessBoxDatas(_openBoxes, _closedBoxes, _useMidLine, _closeCount, _colorClose, _currentBarIndex, _currentLow, _currentHigh, _currentTime)
ProcessBoxDatas
description 박스 확장 및 돌파 처리.\
열린 박스들을 현재 bar까지 확장하고, 돌파 조건 체크.\
_closeCount: 돌파 횟수 (이 횟수만큼 돌파 시 박스 종료).\
breachMode에 따라 돌파 체크 방식 다름 (both/directionalHighLow/directionalClose).\
종료된 박스는 _closedBoxes로 이동하고 _colorClose 색상 적용.\
barstate.islast와 barstate.isconfirmed에서 호출 권장.
Parameters:
_openBoxes (array<BoxData>): 열린 박스 배열
_closedBoxes (array<BoxData>): 닫힌 박스 배열
_useMidLine (bool): 중간선 표시 여부
_closeCount (int): 돌파 카운트 (이 횟수만큼 돌파 시 종료)
_colorClose (color): 종료된 박스 색상
_currentBarIndex (int): 현재 bar_index
_currentLow (float): 현재 low
_currentHigh (float): 현재 high
_currentTime (int): 현재 time
Returns: bool 항상 true
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] [중위 시간대, 상위 시간대]
BoxData
BoxData
Fields:
_type (series string): 박스 타입 (fob, fvg, sweep, rb, custom 등)
_breachMode (series string): 돌파 처리 방식
_isBull (series bool): 상승(true) 또는 하락(false) 방향
_box (series box)
_line (series line)
_boxTop (series float)
_boxBot (series float)
_boxMid (series float)
_topBreached (series bool)
_bottomBreached (series bool)
_breakCount (series int)
_createdBar (series int)
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เอกสารเผยแพร่
v3더해짐
BoxType
BoxType
Fields:
FOB (series string)
FVG (series string)
IFVG (series string)
SOB (series string)
RB (series string)
BB (series string)
MB (series string)
SWEEP (series string)
CUSTOM (series string)
BreachMode
BreachMode
Fields:
BOTH_HIGH_LOW (series string)
BOTH_CLOSE (series string)
DIRECTIONAL_HIGH_LOW (series string)
DIRECTIONAL_CLOSE (series string)
NEAR_HIGH (series string)
NEAR_CLOSE (series string)
NEAR_LOW (series string)
FAR_HIGH (series string)
FAR_CLOSE (series string)
FAR_LOW (series string)
업데이트됨
CreateBox(_boxType, _tf, _isBull, _useLine, _colorBG, _colorBD, _colorText, _cache)
CreateBox (자동 계산 방식)
description 박스 생성 (tf/cache 기반 자동 좌표 계산).\
라이브러리가 boxType에 따라 좌표를 자동 계산.\
breachMode는 boxType 기반 자동 결정.\
Parameters:
_boxType (string): 박스 타입
_tf (string): 시간대
_isBull (bool): 상승(true) 또는 하락(false)
_useLine (bool): 중간선 표시 여부
_colorBG (color): 박스 배경색
_colorBD (color): 박스 테두리색
_colorText (color): 텍스트 색상
_cache (HTFCache type from goodia/Mirpapa_Lib_HTF/1): HTF 캐시 데이터
Returns: [bool, BoxData] 성공 여부와 박스 데이터
BoxData
BoxData
Fields:
_type (series string): 박스 타입
_breachMode (series string): 돌파 처리 방식
_isBull (series bool): 상승(true) 또는 하락(false) 방향
_box (series box)
_line (series line)
_boxTop (series float)
_boxBot (series float)
_boxMid (series float)
_topBreached (series bool)
_bottomBreached (series bool)
_breakCount (series int)
없어짐
CreateCustomBox(_boxType, _breachMode, _isBull, _top, _bottom, _left, _right, _useLine, _colorBG, _colorBD, _colorText, _text)
CreateCustomBox
description 완전히 유연한 커스텀 박스 생성.\
사용자가 박스 위치(top, bottom, left, right), breach mode, 모든 파라미터를 직접 지정.\
조건 체크는 사용자 스크립트에서 수행하고, 이 함수는 박스 생성만 담당.\
새로운 박스 타입 추가 시 라이브러리 수정 없이 사용 가능.
UpdateHTFCache(_cache, _tf)
UpdateHTFCache
description HTF 데이터 캐싱 (성능 최적화).\
HTF의 OHLC 데이터를 캐싱하여 매 틱마다 request.security 호출 방지.\
_cache: 기존 캐시 (없으면 na, 첫 호출 시).\
_tf: 캐싱할 시간대 (예: "60", "1D").\
새 bar 또는 bar_index 변경 시에만 업데이트, 그 외에는 기존 캐시 반환.\
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)].\
HTFCache
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน