August_Supertrader

ATR Price Range Prediction V.2

### ATR Price Range Prediction V.2

This script calculates the expected high and low prices for the current day based on the Average True Range (ATR) and displays the proportion of days where the daily range (high - low) is greater than or equal to the ATR. Additionally, the script provides an option to adjust the size of the text displayed in the top-right corner of the chart.

#### How It Works

1. **ATR Calculation**: The script calculates the ATR for a specified period (`atrPeriod`). ATR is a measure of volatility that represents the average range between the high and low prices over a specified number of periods.
2. **Expected High and Low Calculation**:
- **Expected High**: Calculated by adding the ATR value to the low price of the current day.
- **Expected Low**: Calculated by subtracting the ATR value from the high price of the current day.
3. **Proportion Calculation**: The script calculates the proportion of days where the daily range (high - low) is greater than or equal to the ATR value. This proportion is updated in real-time as new data comes in.
4. **Table Display**: Instead of displaying labels on each candle, the script shows the expected high, expected low, and the calculated proportion in a table located at the top-right corner of the chart. The size of the text in this table can be adjusted using the `Table Size` input.
5. **Color Coding**: The script changes the color of the bars to yellow if the daily range is greater than or equal to the ATR value, making it easy to identify these bars visually.

#### How to Use

- **ATR Period (`atrPeriod`)**: Adjust the period for the ATR calculation using the input parameter. The default value is 14.
- **Table Size (`tableSizeOption`)**: Choose the size of the text displayed in the table. Options include `tiny`, `small`, `normal`, `large`, and `huge`.
- **Expected High and Low**: Use the green and red lines to identify potential target prices or stop-loss levels for your trades. The green line represents the expected high, and the red line represents the expected low.
- **Proportion**: The table in the top-right corner of the chart shows the proportion of days where the daily range is greater than or equal to the ATR value. This can provide insight into the volatility of the asset.
- **Color Coding**: Yellow bars indicate days where the daily range is greater than or equal to the ATR value.


---

### ภาษาไทย

### ATR คาดการณ์ราคาสูงสุดและต่ำสุด พร้อมสัดส่วน

สคริปต์นี้คำนวณราคาสูงสุดและต่ำสุดที่คาดการณ์สำหรับวันปัจจุบันโดยอิงจากค่าเฉลี่ยช่วงที่แท้จริง (ATR) และแสดงสัดส่วนของวันที่ช่วงราคาต่อวัน (สูง - ต่ำ) มากกว่าหรือเท่ากับค่า ATR นอกจากนี้ยังมีตัวเลือกในการปรับขนาดข้อความที่แสดงในกล่องข้อความมุมขวาบนของกราฟ

#### วิธีการทำงาน

1. **การคำนวณ ATR**: สคริปต์คำนวณค่า ATR สำหรับช่วงเวลาที่กำหนด (`atrPeriod`) ATR เป็นมาตรวัดความผันผวนที่แสดงช่วงเฉลี่ยระหว่างราคาสูงสุดและต่ำสุดในช่วงเวลาที่กำหนด
2. **การคำนวณราคาสูงสุดและต่ำสุดที่คาดการณ์**:
- **ราคาสูงสุดที่คาดการณ์**: คำนวณโดยการบวกค่า ATR กับราคาต่ำสุดของวันปัจจุบัน
- **ราคาต่ำสุดที่คาดการณ์**: คำนวณโดยการลบค่า ATR จากราคาสูงสุดของวันปัจจุบัน
3. **การคำนวณสัดส่วน**: สคริปต์คำนวณสัดส่วนของวันที่ช่วงราคาต่อวัน (สูง - ต่ำ) มากกว่าหรือเท่ากับค่า ATR สัดส่วนนี้จะอัปเดตแบบเรียลไทม์เมื่อมีข้อมูลใหม่เข้ามา
4. **การแสดงผลในตาราง**: แทนที่จะแสดงป้ายกำกับบนแท่งเทียนแต่ละแท่ง สคริปต์จะแสดงราคาสูงสุดที่คาดการณ์ ราคาต่ำสุดที่คาดการณ์ และสัดส่วนที่คำนวณในตารางที่มุมขวาบนของกราฟ โดยสามารถปรับขนาดข้อความในตารางได้
5. **การใช้สี**: สคริปต์จะเปลี่ยนสีของแท่งเทียนเป็นสีเหลืองหากช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR ทำให้สามารถระบุแท่งเทียนเหล่านี้ได้ง่ายขึ้น

#### วิธีการใช้งาน

- **ATR Period (`atrPeriod`)**: ปรับช่วงเวลาสำหรับการคำนวณ ATR โดยใช้พารามิเตอร์การป้อนค่า ค่าเริ่มต้นคือ 14
- **Table Size (`tableSizeOption`)**: เลือกขนาดข้อความที่แสดงในตาราง ตัวเลือกได้แก่ `tiny`, `small`, `normal`, `large`, และ `huge`
- **ราคาสูงสุดและต่ำสุดที่คาดการณ์**: ใช้เส้นสีเขียวและสีแดงเพื่อระบุราคาที่เป็นเป้าหมายหรือระดับการหยุดขาดทุนสำหรับการซื้อขายของคุณ เส้นสีเขียวแสดงถึงราคาสูงสุดที่คาดการณ์และเส้นสีแดงแสดงถึงราคาต่ำสุดที่คาดการณ์
- **สัดส่วน**: ตารางที่มุมขวาบนของกราฟแสดงสัดส่วนของวันที่ช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR ซึ่งสามารถให้ข้อมูลเชิงลึกเกี่ยวกับความผันผวนของสินทรัพย์
- **การใช้สี**: แท่งเทียนสีเหลืองบ่งบอกถึงวันที่ช่วงราคาต่อวันมากกว่าหรือเท่ากับค่า ATR

_____
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?