PINE LIBRARY
Updated

Mirpapa_Lib_Struct

105
Library "Mirpapa_Lib_Struct"
ICT 구조 변화 감지 라이브러리 (BOS, CHoCH, MSS, Sweep)

initStructState()
  StructState 초기화

checkBOS(_trend, _currentClose, _lastHHPrice, _lastLLPrice)
  BOS 체크 (추세 지속) - 종가 기준
  Parameters:
    _trend (string): 현재 추세
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]

checkCHoCH(_trend, _currentClose, _lastHHPrice, _lastLLPrice)
  CHoCH 체크 (추세 전환) - 종가 기준
  Parameters:
    _trend (string): 현재 추세
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]

checkSweep(_currentHigh, _currentLow, _currentClose, _lastHHPrice, _lastLLPrice)
  Sweep 체크 (유동성 수집) 설명
  Parameters:
    _currentHigh (float): 현재 고가
    _currentLow (float): 현재 저가
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]

checkMSS(_hadCHoCH, _chochDir, _currentHigh, _currentLow, _chochPrice)
  MSS 체크 (CHoCH + 리테스트 확인)
  Parameters:
    _hadCHoCH (bool): CHoCH 발생 여부
    _chochDir (string): CHoCH 방향
    _currentHigh (float): 현재 고가
    _currentLow (float): 현재 저가
    _chochPrice (float): CHoCH 발생 가격
  Returns: [bool 발생여부, string 방향]

drawStructLabel(_price, _time, _type, _dir, _lblColor)
  구조 변화 라벨 그리기
  Parameters:
    _price (float): 가격
    _time (int): 시간
    _type (string): 구조 타입
    _dir (string): 방향
    _lblColor (color): 라벨 색상

drawStructLine(_price, _startTime, _endTime, _lineColor, _lineWidth)
  구조 변화 라인 그리기
  Parameters:
    _price (float): 가격
    _startTime (int): 시작 시간
    _endTime (int): 끝 시간
    _lineColor (color): 라인 색상
    _lineWidth (int): 라인 두께

StructType
  구조 타입 상수
  Fields:
    BOS (series string)
    CHOCH (series string)
    MSS (series string)
    SWEEP (series string)

TrendDir
  추세 방향 상수
  Fields:
    UP (series string)
    DOWN (series string)
    NONE (series string)

StructState
  구조 변화 상태
  Fields:
    _trend (series string): 현재 추세 방향
    _lastHHPrice (series float): 마지막 HH 가격
    _lastHHTime (series int): 마지막 HH 시간
    _lastLLPrice (series float): 마지막 LL 가격
    _lastLLTime (series int): 마지막 LL 시간
    _peakHHPrice (series float): 최고 HH 가격 (BOS 레벨용)
    _peakHHTime (series int): 최고 HH 시간
    _peakLLPrice (series float): 최저 LL 가격 (BOS 레벨용)
    _peakLLTime (series int): 최저 LL 시간
    _bosLevelHH (series float): BOS 체크용 HH 레벨 (확정된 최고 HH)
    _bosLevelHHTime (series int): BOS 체크용 HH 시간
    _bosLevelLL (series float): BOS 체크용 LL 레벨 (확정된 최저 LL)
    _bosLevelLLTime (series int): BOS 체크용 LL 시간
Release Notes
v2

더해짐
updateStructFromHHLL(_state, _confirmedType, _confirmedPrice, _confirmedTime)
  HH/LL 데이터로 구조 상태 업데이트
description 스윙 라이브러리의 HH/LL 확정 결과를 구조 라이브러리 상태에 반영합니다.
  Parameters:
    _state (StructState): 구조 상태 객체
    _confirmedType (string): 확정된 타입 ("HH" or "LL")
    _confirmedPrice (float): 확정된 가격
    _confirmedTime (int): 확정된 시간
  Returns: StructState 업데이트된 구조 상태

initFVGState()
  FVGState 초기화

checkFVG(_c0High, _c0Low, _c2High, _c2Low, _time)
  FVG 검출 (3캔들 패턴)
  Parameters:
    _c0High (float): 캔들0 고가 (2봉 전)
    _c0Low (float): 캔들0 저가
    _c2High (float): 캔들2 고가 (현재 봉)
    _c2Low (float): 캔들2 저가
    _time (int): 현재 시간
  Returns: FVGState (FVG 발견 시 활성 상태로 반환, 없으면 비활성)

updateFVGState(_state, _close)
  FVG 상태 업데이트 (far_close 기반)
  Parameters:
    _state (FVGState): 현재 FVG 상태
    _close (float): 현재 종가
  Returns: FVGState 업데이트된 상태

initOBState()
  OBState 초기화

createOBFromFVG(_fvg)
  FVG로부터 OB 생성
  Parameters:
    _fvg (FVGState): FVG 상태
  Returns: OBState (FVG가 활성이면 OB 생성, 아니면 비활성)

updateOBState(_state, _close)
  OB 상태 업데이트 (far_close 기반)
  Parameters:
    _state (OBState): 현재 OB 상태
    _close (float): 현재 종가
  Returns: OBState 업데이트된 상태

extendOB(_state, _high, _low)
  OB 확장 (같은 방향 캔들로 영역 확대)
  Parameters:
    _state (OBState): 현재 OB 상태
    _high (float): 현재 캔들 고가
    _low (float): 현재 캔들 저가
  Returns: OBState 업데이트된 상태

FVGStatus
  FVG 상태 상수
  Fields:
    CREATED (series string)
    STARTED (series string)
    ENDED (series string)

FVGState
  FVG (Fair Value Gap) 상태
  Fields:
    _isBullish (series bool): true: Bullish FVG, false: Bearish FVG
    _top (series float): FVG 상단 가격
    _bottom (series float): FVG 하단 가격
    _startTime (series int): 생성 시간
    _status (series string): 현재 상태 (CREATED, STARTED, ENDED)
    _isActive (series bool): 활성 상태

OBStatus
  OB 상태 상수
  Fields:
    CREATED (series string)
    EXTENDED (series string)
    STARTED (series string)
    ENDED (series string)

OBState
  OB (Order Block) 상태
  Fields:
    _isBullish (series bool): true: Bullish OB, false: Bearish OB
    _top (series float): OB 상단 가격
    _bottom (series float): OB 하단 가격
    _startTime (series int): 생성 시간
    _status (series string): 현재 상태 (CREATED, EXTENDED, STARTED, ENDED)
    _isActive (series bool): 활성 상태

업데이트됨
checkSweep(_currentHigh, _currentLow, _currentClose, _lastHHPrice, _lastLLPrice)
  Sweep 체크 (유동성 수집)
  Parameters:
    _currentHigh (float): 현재 고가
    _currentLow (float): 현재 저가
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]
Release Notes
v3

업데이트됨
checkBOS(_trend, _currentOpen, _currentClose, _lastHHPrice, _lastLLPrice)
  BOS 체크 (추세 지속) - 종가 기준
  Parameters:
    _trend (string): 현재 추세
    _currentOpen (float)
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]

checkCHoCH(_trend, _currentOpen, _currentClose, _lastHHPrice, _lastLLPrice)
  CHoCH 체크 (추세 전환) - 종가 기준
  Parameters:
    _trend (string): 현재 추세
    _currentOpen (float): 현재 시가
    _currentClose (float): 현재 종가
    _lastHHPrice (float): 마지막 HH 가격
    _lastLLPrice (float): 마지막 LL 가격
  Returns: [bool 발생여부, string 방향]

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.