PINE LIBRARY
Mirpapa_Lib_Unicorn

Library "Mirpapa_Lib_Unicorn"
유니콘 패턴 라이브러리 (Unicorn Pattern Library)
유니콘 모델 전략 로직, 데이터 구조체 및 상태 관리를 구현합니다.
initUnicornData(_isBull, _createTime, _createBar, _timeframe)
UnicornData 초기화
description 새로운 UnicornData 객체를 생성하고 초기화합니다.
Parameters:
_isBull (bool): 방향 (True: 상승, False: 하락)
_createTime (int): 생성 시간
_createBar (int): 생성 Bar Index
_timeframe (string): 시간대
calculateOverlap(_obTop, _obBot, _fvgTop, _fvgBot)
중첩 영역(Overlap Zone) 계산
description OB와 FVG 사이의 겹치는 영역을 계산합니다.
Parameters:
_obTop (float): OB 상단
_obBot (float): OB 하단
_fvgTop (float): FVG 상단
_fvgBot (float): FVG 하단
Returns: [float top, float bot, bool hasOverlap] 겹침 영역 상단, 하단, 겹침 여부
updateUnicornStatus(_data, _currentHigh, _currentLow, _time)
유니콘 상태 업데이트
description 가격 움직임에 따라 유니콘 패턴의 상태를 업데이트합니다.
active: 진입 대기 (리테스트 대기) -> triggered: 진입 (TP/SL 대기) -> win/loss: 결과 확정
Parameters:
_data (UnicornData): UnicornData 객체
_currentHigh (float): 현재 고가
_currentLow (float): 현재 저가
_time (int): 현재 시간
Returns: UnicornData 업데이트된 객체
activateUnicorn(_data)
유니콘 활성화 (Active 전환)
description Pending 상태인 유니콘 데이터를 Active 상태로 전환합니다. (보통 CHoCH 발생 시 호출)
Parameters:
_data (UnicornData): UnicornData 객체
setTradeLevels(_data, _entry, _stop, _target)
트레이딩 레벨 설정
description 진입가, 목표가, 손절가를 설정합니다.
Parameters:
_data (UnicornData): UnicornData 객체
_entry (float): 진입가
_stop (float): 손절가
_target (float): 목표가
UnicornData
유니콘 데이터 (UnicornData)
Fields:
_isBull (series bool): // 상승/하락 방향 (True: Long, False: Short)
_status (series string): // "pending", "active", "triggered", "win", "loss", "cancelled"
_createTime (series int): // 생성 시간
_createBar (series int): // 생성 bar_index
_obTop (series float): // OB 상단
_obBot (series float): // OB 하단
_obTime (series int): // OB 캔들 시간
_obBox (series box): // OB 박스 객체
_fvgTop (series float): // FVG 상단
_fvgBot (series float): // FVG 하단
_fvgTime (series int): // FVG 시간
_fvgBox (series box): // FVG 박스 객체
_zoneTop (series float): // 겹침 영역 상단 (Unicorn Zone)
_zoneBot (series float): // 겹침 영역 하단 (Unicorn Zone)
_zoneBox (series box): // Unicorn Zone 박스 객체
_chochConfirmed (series bool): // CHoCH 확정 여부
_chochTime (series int): // CHoCH 발생 시간
_chochPrice (series float): // CHoCH 돌파 가격
_entryPrice (series float): // 진입가
_targetPrice (series float): // 목표가 (다음 유동성 레벨)
_stopPrice (series float): // 손절가 (Zone 반대편)
_result (series string): // "none", "win", "loss"
_resultTime (series int): // 결과 확정 시간
_resultPrice (series float): // 결과 확정 가격
_profitPips (series float): // 수익 pips (양수)
_lossPips (series float): // 손실 pips (음수)
_profitPercent (series float): // 수익 %
_lossPercent (series float): // 손실 %
_rrRatio (series float): // Risk:Reward 비율
_timeframe (series string): // 시간대 (HTF/MTF/CTF)
_triggerTime (series int): // 진입 트리거 시간 (리테스트)
_triggerPrice (series float): // 진입 트리거 가격
_isRetested (series bool): // 리테스트 여부
_retestCount (series int): // 리테스트 횟수
_maxDrawdown (series float): // 최대 손실폭 (진입 후)
_maxProfit (series float): // 최대 수익폭 (진입 후)
유니콘 패턴 라이브러리 (Unicorn Pattern Library)
유니콘 모델 전략 로직, 데이터 구조체 및 상태 관리를 구현합니다.
initUnicornData(_isBull, _createTime, _createBar, _timeframe)
UnicornData 초기화
description 새로운 UnicornData 객체를 생성하고 초기화합니다.
Parameters:
_isBull (bool): 방향 (True: 상승, False: 하락)
_createTime (int): 생성 시간
_createBar (int): 생성 Bar Index
_timeframe (string): 시간대
calculateOverlap(_obTop, _obBot, _fvgTop, _fvgBot)
중첩 영역(Overlap Zone) 계산
description OB와 FVG 사이의 겹치는 영역을 계산합니다.
Parameters:
_obTop (float): OB 상단
_obBot (float): OB 하단
_fvgTop (float): FVG 상단
_fvgBot (float): FVG 하단
Returns: [float top, float bot, bool hasOverlap] 겹침 영역 상단, 하단, 겹침 여부
updateUnicornStatus(_data, _currentHigh, _currentLow, _time)
유니콘 상태 업데이트
description 가격 움직임에 따라 유니콘 패턴의 상태를 업데이트합니다.
active: 진입 대기 (리테스트 대기) -> triggered: 진입 (TP/SL 대기) -> win/loss: 결과 확정
Parameters:
_data (UnicornData): UnicornData 객체
_currentHigh (float): 현재 고가
_currentLow (float): 현재 저가
_time (int): 현재 시간
Returns: UnicornData 업데이트된 객체
activateUnicorn(_data)
유니콘 활성화 (Active 전환)
description Pending 상태인 유니콘 데이터를 Active 상태로 전환합니다. (보통 CHoCH 발생 시 호출)
Parameters:
_data (UnicornData): UnicornData 객체
setTradeLevels(_data, _entry, _stop, _target)
트레이딩 레벨 설정
description 진입가, 목표가, 손절가를 설정합니다.
Parameters:
_data (UnicornData): UnicornData 객체
_entry (float): 진입가
_stop (float): 손절가
_target (float): 목표가
UnicornData
유니콘 데이터 (UnicornData)
Fields:
_isBull (series bool): // 상승/하락 방향 (True: Long, False: Short)
_status (series string): // "pending", "active", "triggered", "win", "loss", "cancelled"
_createTime (series int): // 생성 시간
_createBar (series int): // 생성 bar_index
_obTop (series float): // OB 상단
_obBot (series float): // OB 하단
_obTime (series int): // OB 캔들 시간
_obBox (series box): // OB 박스 객체
_fvgTop (series float): // FVG 상단
_fvgBot (series float): // FVG 하단
_fvgTime (series int): // FVG 시간
_fvgBox (series box): // FVG 박스 객체
_zoneTop (series float): // 겹침 영역 상단 (Unicorn Zone)
_zoneBot (series float): // 겹침 영역 하단 (Unicorn Zone)
_zoneBox (series box): // Unicorn Zone 박스 객체
_chochConfirmed (series bool): // CHoCH 확정 여부
_chochTime (series int): // CHoCH 발생 시간
_chochPrice (series float): // CHoCH 돌파 가격
_entryPrice (series float): // 진입가
_targetPrice (series float): // 목표가 (다음 유동성 레벨)
_stopPrice (series float): // 손절가 (Zone 반대편)
_result (series string): // "none", "win", "loss"
_resultTime (series int): // 결과 확정 시간
_resultPrice (series float): // 결과 확정 가격
_profitPips (series float): // 수익 pips (양수)
_lossPips (series float): // 손실 pips (음수)
_profitPercent (series float): // 수익 %
_lossPercent (series float): // 손실 %
_rrRatio (series float): // Risk:Reward 비율
_timeframe (series string): // 시간대 (HTF/MTF/CTF)
_triggerTime (series int): // 진입 트리거 시간 (리테스트)
_triggerPrice (series float): // 진입 트리거 가격
_isRetested (series bool): // 리테스트 여부
_retestCount (series int): // 리테스트 횟수
_maxDrawdown (series float): // 최대 손실폭 (진입 후)
_maxProfit (series float): // 최대 수익폭 (진입 후)
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Biblioteka Pine
W zgodzie z duchem TradingView autor opublikował ten kod Pine jako bibliotekę open-source, aby inni programiści Pine z naszej społeczności mogli go ponownie wykorzystać. Ukłony dla autora. Można korzystać z tej biblioteki prywatnie lub w innych publikacjach open-source, jednak ponowne wykorzystanie tego kodu w publikacjach podlega Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.