OPEN-SOURCE SCRIPT
ที่อัปเดต: ORB SESSIONS

## ORB SESSIONS — Multi-Session Opening Range Breakout + Retest Strategy
**ORB SESSIONS** is a multi-session Opening Range Breakout (ORB) strategy built for intraday trading across the **New York, Asia, and London** sessions, with optional overlays (PDH/PDL, session levels, FVGs) and an optional higher-timeframe bias dashboard. It is designed to standardize ORB execution with configurable **breakout vs retest** entry logic, **R-multiple targets**, optional **trailing-to-TP behavior**, and a **prop-firm “flat window”** to force risk compliance.
---
## Core concept
For each enabled session, the script:
1. Builds an **opening range** (high/low, optional midline) during a configurable ORB window.
2. Trades breakouts from that range using the selected **Entry Mode**:
* **Breakout**: enter on a confirmed close through the ORB boundary.
* **Retest Zone**: after breakout, wait for a wick back to the broken level.
* **Retest Midpoint**: after breakout, wait for a wick back to the ORB midpoint.
3. Manages risk via session-specific **Stop Loss methods** and up to **3 take-profits** expressed as **R:R multiples**.
4. Optionally uses a **trailing stop** mechanic that “arms” after price moves **N ticks beyond a TP**, then trails the stop to that TP level.
5. Optionally **re-arms** after a trade closes (with max trades/session, exit-type filter, direction filter, cooldown bars, and “bars inside ORB” requirements).
---
## What’s included
### Trading modules (per session)
* **Session 1: New York ORB** (enable, direction filter, ORB start/duration, session end, flatten at end, SL method, TP R:R and quantities).
* **Session 2: Asia ORB** (same structure).
* **Session 3: London ORB** (same structure).
### Filters & controls
* **Timezone selector** (all session times interpret in this timezone).
* **Day-of-week filter** (enable/disable specific weekdays).
* **Prop Firm Flat Window**: optionally flatten/block new entries during a specified time window.
### Visual overlays (optional)
* Historical ORB lines, optional midlines, labels.
* PDH/PDL, Asian/London/NY session overlays, and Fair Value Gaps (FVG) display.
---
## Recommended directions for use
1. **Apply to an intraday chart** (commonly 1m–15m).
2. Open **Settings → Global Settings**:
* Set **Timezone** to match your intended session definitions.
3. Open **Trade Settings (All Sessions)**:
* Choose **Entry Mode** (Breakout vs Retest Zone vs Retest Midpoint).
* Set **Contracts** and whether to show SL/TP visuals.
4. Configure each session you want to trade:
* Enable/disable sessions, choose direction (long/short/both), set ORB start + duration, and define session end/flatten behavior.
5. Configure exits:
* Pick an SL method (Midpoint / Opposite Side / Fixed Points) and set TP R:R levels and TP quantities per session.
6. Optional: turn on **Trailing Stop** and/or **Re-Arm**:
* Trailing: arms after N ticks beyond TP, then trails stop to TP.
* Re-arm: control max trades/session, cooldown bars, and re-arm conditions.
---
## Alerts (automation-ready)
This script is designed to run with **a single TradingView alert** that triggers only when the strategy actually fills orders.
**Create ONE alert** and set:
* **Condition**: this strategy
* **Trigger**: **Order fills only**
* **Message**: `{{strategy.order.alert_message}}`
The script attaches an order-specific alert payload at fill time (Buy/Sell/Exit), so your automation receives exactly what the strategy executed.
---
## Notes / expectations
* ORB behavior depends on how you define each session’s ORB window and the chart’s liquidity/volatility; optimize ORB duration + SL method + TP R:R per market.
* If you enable **Prop Firm Flat Window**, entries are blocked and positions can be forced flat during that period (use this to comply with rules).
Note : description written by ChatGPT
**ORB SESSIONS** is a multi-session Opening Range Breakout (ORB) strategy built for intraday trading across the **New York, Asia, and London** sessions, with optional overlays (PDH/PDL, session levels, FVGs) and an optional higher-timeframe bias dashboard. It is designed to standardize ORB execution with configurable **breakout vs retest** entry logic, **R-multiple targets**, optional **trailing-to-TP behavior**, and a **prop-firm “flat window”** to force risk compliance.
---
## Core concept
For each enabled session, the script:
1. Builds an **opening range** (high/low, optional midline) during a configurable ORB window.
2. Trades breakouts from that range using the selected **Entry Mode**:
* **Breakout**: enter on a confirmed close through the ORB boundary.
* **Retest Zone**: after breakout, wait for a wick back to the broken level.
* **Retest Midpoint**: after breakout, wait for a wick back to the ORB midpoint.
3. Manages risk via session-specific **Stop Loss methods** and up to **3 take-profits** expressed as **R:R multiples**.
4. Optionally uses a **trailing stop** mechanic that “arms” after price moves **N ticks beyond a TP**, then trails the stop to that TP level.
5. Optionally **re-arms** after a trade closes (with max trades/session, exit-type filter, direction filter, cooldown bars, and “bars inside ORB” requirements).
---
## What’s included
### Trading modules (per session)
* **Session 1: New York ORB** (enable, direction filter, ORB start/duration, session end, flatten at end, SL method, TP R:R and quantities).
* **Session 2: Asia ORB** (same structure).
* **Session 3: London ORB** (same structure).
### Filters & controls
* **Timezone selector** (all session times interpret in this timezone).
* **Day-of-week filter** (enable/disable specific weekdays).
* **Prop Firm Flat Window**: optionally flatten/block new entries during a specified time window.
### Visual overlays (optional)
* Historical ORB lines, optional midlines, labels.
* PDH/PDL, Asian/London/NY session overlays, and Fair Value Gaps (FVG) display.
---
## Recommended directions for use
1. **Apply to an intraday chart** (commonly 1m–15m).
2. Open **Settings → Global Settings**:
* Set **Timezone** to match your intended session definitions.
3. Open **Trade Settings (All Sessions)**:
* Choose **Entry Mode** (Breakout vs Retest Zone vs Retest Midpoint).
* Set **Contracts** and whether to show SL/TP visuals.
4. Configure each session you want to trade:
* Enable/disable sessions, choose direction (long/short/both), set ORB start + duration, and define session end/flatten behavior.
5. Configure exits:
* Pick an SL method (Midpoint / Opposite Side / Fixed Points) and set TP R:R levels and TP quantities per session.
6. Optional: turn on **Trailing Stop** and/or **Re-Arm**:
* Trailing: arms after N ticks beyond TP, then trails stop to TP.
* Re-arm: control max trades/session, cooldown bars, and re-arm conditions.
---
## Alerts (automation-ready)
This script is designed to run with **a single TradingView alert** that triggers only when the strategy actually fills orders.
**Create ONE alert** and set:
* **Condition**: this strategy
* **Trigger**: **Order fills only**
* **Message**: `{{strategy.order.alert_message}}`
The script attaches an order-specific alert payload at fill time (Buy/Sell/Exit), so your automation receives exactly what the strategy executed.
---
## Notes / expectations
* ORB behavior depends on how you define each session’s ORB window and the chart’s liquidity/volatility; optimize ORB duration + SL method + TP R:R per market.
* If you enable **Prop Firm Flat Window**, entries are blocked and positions can be forced flat during that period (use this to comply with rules).
Note : description written by ChatGPT
เอกสารเผยแพร่
Added buffer zone for entries.สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน