OPEN-SOURCE SCRIPT
1M XAU Cumulative Delta Volume with OB Breakouts

### Overview
This is a **session-based CVD strategy** built around the **00:00–07:00 CEST range**. It finds the high/low of that session, turns them into **adaptive ATR-based support (yellow)** and **resistance (purple)** zones, and trades only **CVD-confirmed reversals** off those levels.
---
### How it Works
* For each day, the script:
* Builds a 00:00–07:00 CEST **profile high/low**.
* Creates a **support zone** around the session low and a **resistance zone** around the session high.
* Using lower timeframe data, it reconstructs **Cumulative Volume Delta (CVD)** and a **recent delta** filter.
* It arms “pending” states when price **enters a zone from the correct side**, then confirms:
* **BUY (long):** price reclaims above support and recent CVD is strongly positive.
* **SELL (short):** price rejects below resistance and recent CVD is strongly negative.
Only these two CVD signals (`buySignal` / `sellSignal`) open trades.
---
### Strategy Logic
* **Entries**
* `buySignal` → open **long** (if flat).
* `sellSignal` → open **short** (if flat).
* No pyramiding; one position at a time.
* **Exits (only TP & SL)**
* Long: TP at `avg_price * (0.5 + TP%)`, SL at `avg_price * (1 – SL%)`.
* Short: TP at `avg_price * (0.5 – TP%)`, SL at `avg_price * (1 + SL%)`.
* No opposite-signal exits.
---
### Extras
* **Reversal markers** on yellow/purple zones and **breakout/retest markers** are plotted for context and alerts but **do not trigger entries**.
* Zone width and “thickening” are ATR-based so important touches and near-touches are easy to see.
* Only suited for **1m intraday scalping** (e.g. XAU/USD), but can be tested on other markets/timeframes.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน