PROTECTED SOURCE SCRIPT
5 MIN OPENING RANGE EXECUTION BOX V1.1

// ==============================================================================
// 5 MIN OPENING RANGE BOX V1.1
// ------------------------------------------------------------------------------
// [KOR] 지표 목적
// 본 지표는 5분봉 기준 Opening Range(초기 15분 범위)를 시각화하고,
// 해당 범위의 돌파(Breakout) 발생 시 구조 기반 손절선(Stop Line)을
// 자동 생성하여 실시간 실행 판단을 돕는 "Execution Mode" 전용 도구이다.
//
// 이 지표는 과거 복기용이 아닌, 당일 세션의 현재 유효 구조만을 표시하는
// 실행 중심(Execution-Focused) 상태 머신 구조를 채택한다.
//
// ------------------------------------------------------------------------------
// [KOR] 동작 개요
//
// 1. 세션 시작 시점에 Opening Range를 계산한다.
// - 5분봉 3개 (총 15분) 기준 High / Low 범위 확정
//
// 2. 종가 기준 돌파 발생 시:
// - 상방 돌파 → 박스 색상 녹색
// - 하방 돌파 → 박스 색상 파란색
//
// 3. 돌파 발생 즉시 구조 기반 손절선 생성
// - 상방 돌파(Long) → 직전 봉 몸통 하단
// - 하방 돌파(Short) → 직전 봉 몸통 상단
// - 손절선은 반드시 Opening Range 내부에 고정됨 (Manual Clamp 적용)
//
// 4. 손절선은 박스와 함께 우측으로 실시간 연장됨
// - 항상 단 하나의 유효 손절선만 유지 (Single Line Policy)
//
// 5. 가격이 다시 박스 내부로 복귀하면:
// - 돌파 상태 및 손절선 즉시 초기화
// - 새로운 돌파를 다시 첫 돌파로 인식
//
// ------------------------------------------------------------------------------
// [KOR] 사용 방법
//
// - 5분봉 차트에서 사용 권장
// - 세션 유형 선택 가능 (CRYPTO / KOREA / US)
// - 돌파 후 손절선이 유지되는 동안만 구조 유효
// - 손절선 이탈 시 해당 구조는 무효
// - 리테스트 화살표는 보조 참고용
//
// 본 지표는 자동 매매 전략이 아니며,
// 진입 및 청산은 트레이더의 판단 하에 이루어져야 한다.
//
// ==============================================================================
//
// [ENG] Indicator Purpose
// This indicator visualizes the 5-minute Opening Range (first 15 minutes)
// and generates a structure-based Stop Line upon breakout.
//
// It is designed as an Execution Mode tool, not for historical backtesting,
// but for monitoring the current active market structure in real time.
//
// ------------------------------------------------------------------------------
// [ENG] How It Works
//
// 1. Calculates the Opening Range (first 3 candles on 5m chart).
//
// 2. Detects breakout based on closing price:
// - BreakUp → Green Box
// - BreakDown → Blue Box
//
// 3. Immediately generates structural Stop Line:
// - Long breakout → previous candle body low
// - Short breakout → previous candle body high
// - Stop line is always clamped inside the Opening Range.
//
// 4. Stop Line extends dynamically with the box in real time.
// Only ONE valid stop line exists at any time.
//
// 5. If price returns inside the box:
// - Breakout state resets
// - Stop line is deleted
// - New breakout becomes the new valid structure.
//
// ------------------------------------------------------------------------------
// [ENG] Usage Guide
//
// - Recommended on 5-minute chart.
// - Select session type (CRYPTO / KOREA / US).
// - Structure remains valid while stop line holds.
// - Break of stop line invalidates the breakout.
// - Retest arrows are informational only.
//
// This is NOT an automated trading strategy.
// All execution decisions remain the trader’s responsibility.
//
// ==============================================================================
// 5 MIN OPENING RANGE BOX V1.1
// ------------------------------------------------------------------------------
// [KOR] 지표 목적
// 본 지표는 5분봉 기준 Opening Range(초기 15분 범위)를 시각화하고,
// 해당 범위의 돌파(Breakout) 발생 시 구조 기반 손절선(Stop Line)을
// 자동 생성하여 실시간 실행 판단을 돕는 "Execution Mode" 전용 도구이다.
//
// 이 지표는 과거 복기용이 아닌, 당일 세션의 현재 유효 구조만을 표시하는
// 실행 중심(Execution-Focused) 상태 머신 구조를 채택한다.
//
// ------------------------------------------------------------------------------
// [KOR] 동작 개요
//
// 1. 세션 시작 시점에 Opening Range를 계산한다.
// - 5분봉 3개 (총 15분) 기준 High / Low 범위 확정
//
// 2. 종가 기준 돌파 발생 시:
// - 상방 돌파 → 박스 색상 녹색
// - 하방 돌파 → 박스 색상 파란색
//
// 3. 돌파 발생 즉시 구조 기반 손절선 생성
// - 상방 돌파(Long) → 직전 봉 몸통 하단
// - 하방 돌파(Short) → 직전 봉 몸통 상단
// - 손절선은 반드시 Opening Range 내부에 고정됨 (Manual Clamp 적용)
//
// 4. 손절선은 박스와 함께 우측으로 실시간 연장됨
// - 항상 단 하나의 유효 손절선만 유지 (Single Line Policy)
//
// 5. 가격이 다시 박스 내부로 복귀하면:
// - 돌파 상태 및 손절선 즉시 초기화
// - 새로운 돌파를 다시 첫 돌파로 인식
//
// ------------------------------------------------------------------------------
// [KOR] 사용 방법
//
// - 5분봉 차트에서 사용 권장
// - 세션 유형 선택 가능 (CRYPTO / KOREA / US)
// - 돌파 후 손절선이 유지되는 동안만 구조 유효
// - 손절선 이탈 시 해당 구조는 무효
// - 리테스트 화살표는 보조 참고용
//
// 본 지표는 자동 매매 전략이 아니며,
// 진입 및 청산은 트레이더의 판단 하에 이루어져야 한다.
//
// ==============================================================================
//
// [ENG] Indicator Purpose
// This indicator visualizes the 5-minute Opening Range (first 15 minutes)
// and generates a structure-based Stop Line upon breakout.
//
// It is designed as an Execution Mode tool, not for historical backtesting,
// but for monitoring the current active market structure in real time.
//
// ------------------------------------------------------------------------------
// [ENG] How It Works
//
// 1. Calculates the Opening Range (first 3 candles on 5m chart).
//
// 2. Detects breakout based on closing price:
// - BreakUp → Green Box
// - BreakDown → Blue Box
//
// 3. Immediately generates structural Stop Line:
// - Long breakout → previous candle body low
// - Short breakout → previous candle body high
// - Stop line is always clamped inside the Opening Range.
//
// 4. Stop Line extends dynamically with the box in real time.
// Only ONE valid stop line exists at any time.
//
// 5. If price returns inside the box:
// - Breakout state resets
// - Stop line is deleted
// - New breakout becomes the new valid structure.
//
// ------------------------------------------------------------------------------
// [ENG] Usage Guide
//
// - Recommended on 5-minute chart.
// - Select session type (CRYPTO / KOREA / US).
// - Structure remains valid while stop line holds.
// - Break of stop line invalidates the breakout.
// - Retest arrows are informational only.
//
// This is NOT an automated trading strategy.
// All execution decisions remain the trader’s responsibility.
//
// ==============================================================================
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์ที่ได้รับการป้องกัน
สคริปต์นี้ถูกเผยแพร่เป็นแบบ closed-source อย่างไรก็ตาม คุณสามารถใช้ได้อย่างอิสระและไม่มีข้อจำกัดใดๆ – เรียนรู้เพิ่มเติมได้ที่นี่
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน