Pine script รองรับการใช้งาน Volume Footprint แล้ว ทำให้คุณสามารถเข้าถึงรายละเอียดการไหลของออร์เดอร์ภายในแต่ละแท่งราคาได้โดยตรง
การอัปเดตนี้ช่วยให้คุณสามารถสร้างอินดิเคเตอร์ Footprint แบบกำหนดเอง ดึงข้อมูลตัวชี้วัดปริมาณที่แม่นยำ และวิเคราะห์กิจกรรมภายในแท่งได้โดยไม่ต้องพึ่งพาวิธีแก้ปัญหาเฉพาะหน้าในกรอบเวลาที่ต่ำกว่า
ทำไมจึงต้องใช้งาน Footprint ใน Pine?
การขอข้อมูลแบบ Footprint ช่วยให้คุณเข้าถึงข้อมูลภายในแท่งขั้นสูงและแมปข้อมูลระดับการไหลของออร์เดอร์ที่สำคัญในเชิงโครงสร้างได้ทันที เช่น:
- การแบ่งปริมาณแบบละเอียด: ปริมาณ “ซื้อ” (ask) และ “ขาย” (bid) ที่แน่นอนสำหรับแท่งราคาทั้งหมดและที่ระดับราคาเฉพาะ
- Volume Delta ที่แม่นยำ: ความแตกต่างที่เฉพาะเจาะจงระหว่างแรงซื้อและแรงขาย
- ระดับการประมูลที่สำคัญ: Point of Control (POC), Value Area High (VAH) และ Value Area Low (VAL) ของแท่งราคาได้ทันที
- ความไม่สมดุล: ข้อมูลเกี่ยวกับความไม่สมดุลของการซื้อและการขายในเฉพาะของแถวราคา
ด้วยการผสาน request.footprint() เข้ากับสคริปต์ที่กำหนดเอง คุณสามารถตรวจสอบข้อมูลการไหลของออร์เดอร์เชิงลึกได้โดยใช้โปรแกรม ในขณะที่ยังคงมุ่งเน้นไปที่กลยุทธ์และการดำเนินการ
วิธีการทำงานของ Footprint และโครงสร้างข้อมูล
ฟังก์ชัน request.footprint() เป็นเครื่องมือหลักที่ใช้ในการขอข้อมูล Volume Footprint สำหรับแท่งราคาปัจจุบัน เมื่อเรียกใช้ ฟังก์ชันนี้จะแสดง Footprint Object ซึ่งประกอบด้วยข้อมูล Volume Footprint ทั้งหมดที่ดึงมาได้สำหรับแท่งราคานั้นๆ
ข้อมูลถูกจัดเรียงเป็นโครงสร้างหลักสองแบบ:
- Footprint Objects: จะช่วยให้คุณเข้าถึงเมตริกโดยรวมของแท่งราคาได้ โดยใช้ฟังก์ชัน footprint.*() คุณสามารถดึงข้อมูลต่างๆ เช่น ปริมาณการซื้อทั้งหมด ปริมาณการขายทั้งหมด และ Volume Delta ได้
- Volume_row Objects: จะแสดงถึงแถวราคาเฉพาะภายในขอบเขตพื้นที่ เช่น Point of Control (POC) หรือขอบเขต Value Area โดยใช้ฟังก์ชัน volume_row.*() คุณสามารถเรียกดูระดับราคา มูลค่าปริมาณ Volume Delta และความไม่สมดุลของแถวนั้นๆ ได้
หมายเหตุ: ถ้าไม่มีข้อมูล Footprint สำหรับแท่งที่กำหนด ฟังก์ชัน request.footprint() จะแสดงค่า na
ตรวจสอบให้แน่ใจเสมอว่าสคริปต์ของคุณตรวจสอบแล้วว่า Object ที่แสดง ไม่ใช่ na ก่อนที่จะพยายามดึงข้อมูลตัวชี้วัดโดยใช้ฟังก์ชัน footprint.*() หรือ volume_row.*()
ตัวอย่างการใช้งาน
ด้านล่างนี้คือสคริปต์ที่ปรับปรุงให้กระชับขึ้น ซึ่งสาธิตวิธีการขอข้อมูล Footprint และเข้าถึงจุดข้อมูลพื้นฐาน:
//@version=6
indicator("Footprint Data Highlight", overlay = true)
// Request the footprint object for the current bar (100 ticks per row, 70% Value Area)
footprint reqFootprint = request.footprint(100, 70)
// We use a block to ensure we only process data when the footprint is available
if not na(reqFootprint)
// 1. Access overall bar metrics from the `footprint` object
float totalBuyVol = reqFootprint.buy_volume()
float totalSellVol = reqFootprint.sell_volume()
float volumeDelta = reqFootprint.delta()
// 2. Retrieve a specific `volume_row` object (the Point of Control)
volume_row pocRow = reqFootprint.poc()
// 3. Access specific price values from the `volume_row` object
float pocUpperPrice = pocRow.up_price()
float pocLowerPrice = pocRow.down_price()
// --- USING THE VARIABLES ---
// Use Buy/Sell Volume and Delta in a label
if barstate.islast
label.new(bar_index, high,
text = "Buy: " + str.tostring(totalBuyVol, format.volume) +
"\nSell: " + str.tostring(totalSellVol, format.volume) +
"\nDelta: " + str.tostring(volumeDelta, format.volume),
color = color.new(color.blue, 20),
textcolor = color.white,
style = label.style_label_down)
// Use POC prices to highlight the POC area on the chart
linefill.new(
line.new(bar_index, pocUpperPrice, bar_index[1], pocUpperPrice, color = color.orange),
line.new(bar_index, pocLowerPrice, bar_index[1], pocLowerPrice, color = color.orange),
color.new(color.orange, 80))
// Plotting the volume delta on a separate pane (if moved to non-overlay)
// or as a reference value in the Data Window
plot(not na(reqFootprint) ? reqFootprint.total_volume() : na, "Volume Delta", display = display.data_window)
โปรดทราบว่าในการใช้งานฟีเจอร์ Footprint เหล่านี้ คุณจะต้องสมัครใช้งานแผนแบบ Premium หรือ Ultimate
เพื่อติดตามข่าวสารล่าสุดเกี่ยวกับการปรับปรุงประสบการณ์การใช้งาน Pine Script® โปรดตรวจสอบ Release notes ในคู่มือผู้ใช้งาน
เราหวังว่าคุณจะเห็นว่าฟีเจอร์เหล่านี้มีประโยชน์อย่างที่เราคิด และโปรดส่งข้อเสนอแนะและคำติชมของคุณมาให้เรา เพื่อที่เราจะได้พัฒนาแพลตฟอร์มให้ดียิ่งขึ้นไปอีก เราสร้าง TradingView เพื่อคุณ และเรายินดีรับฟังความคิดเห็นของคุณเสมอ
ทีมงาน TradingView