อินดิเคเตอร์สำหรับ TradingView · แสดงในหน้าต่างของตัวเองTradingView indicator · draws in its own pane

OBV Consolidation Zones v1.0.0

อินดิเคเตอร์นี้วาด On Balance Volume (OBV) ในหน้าต่างใต้กราฟราคา แล้วเพิ่มสามโมดูลบนเส้นนั้น: Consolidation ตีกรอบช่วงที่ OBV เดินออกข้างแคบกว่าปกติของตัวเอง และบอกเมื่อ OBV หลุดออกจากกรอบ (ส่วนหลักของอินดิเคเตอร์) Divergence หาไดเวอร์เจนซ์ระหว่าง OBV กับราคาจากจุดกลับตัวของ OBV และ Smoothing MA เส้นเฉลี่ยของ OBV พร้อมแถบเบี่ยงเบนที่เปิดได้ alert ทั้งหมดส่งผ่าน alert ตัวเดียว ต้องใช้กราฟที่มีข้อมูล volume ถ้าสินทรัพย์ไม่มี volume อินดิเคเตอร์จะหยุดพร้อมข้อความแจ้ง กราฟทุกอันในหน้านี้เป็นกราฟจริงที่กดได้: ราคาอยู่ด้านบน หน้าต่างของ OBV อยู่ด้านล่าง เลื่อนเมาส์ไปบนแท่งไหน ค่าในหน้าต่าง OBV จะแสดงตามแท่งนั้น กด ตั้งค่า เพื่อเปิดแผงตั้งค่าแบบเดียวกับบน TradingViewThis indicator draws On Balance Volume (OBV) in a pane under the price chart and adds three modules on that line: Consolidation boxes the stretches where OBV moves sideways, tight for its own recent behaviour, and reports when OBV breaks out of a box (the core of the indicator); Divergence finds divergence between OBV and price from OBV's turns; Smoothing MA is a moving average of OBV with optional deviation bands. Every alert goes through one alert. It needs volume data: on a symbol without volume it stops with a message. Every chart on this page is live: price on top, the OBV pane below. Move the cursor over a bar to read that bar in the OBV pane, and press Settings for the same settings you have on TradingView.

ส่วนที่ 1Part 1

เส้น OBV และเส้นเฉลี่ยThe OBV line and its average

1โมดูลนี้คืออะไรWhat it is

OBV สะสม volume ตามทิศของราคาปิดแต่ละแท่ง จึงบอกว่า volume ไหลไปทางเดียวกับราคาหรือไม่ ระดับตัวเลขของ OBV ไม่มีความหมายในตัวเอง เพราะขึ้นกับว่ากราฟโหลดประวัติย้อนไปถึงไหน สิ่งที่อ่านได้คือรูปทรงและทิศของเส้น ตามค่าเริ่มต้นเส้นเปลี่ยนสีตามทิศของแท่งต่อแท่ง: เขียวอมฟ้าเมื่อ OBV สูงกว่าแท่งก่อน แดงเมื่อไม่สูงกว่า (รวมแท่งที่เท่าเดิม)OBV accumulates volume in the direction of each bar's close, so it shows whether volume is flowing with price. Its number means nothing on its own, because it depends on how far back the chart's history starts; what reads is the line's shape and direction. By default the line is coloured bar over bar: teal where OBV is above the previous bar, red where it is not (an unchanged bar included).

Smoothing MA คือเส้นเฉลี่ยของ OBV (ค่าเริ่มต้น EMA 14) เนื่องจากระดับของ OBV เปลี่ยนไปตามประวัติที่โหลด ตำแหน่งของ OBV เทียบกับเส้นเฉลี่ยของตัวเองจึงเป็นการอ่านเดียวที่ไม่ขึ้นกับระดับ เปิด Deviation bands ได้ เป็นแถบเหนือและใต้เส้นเฉลี่ยตามจำนวนส่วนเบี่ยงเบนมาตรฐานของ OBV ที่ตั้งไว้ บอกว่า OBV ยืดออกจากช่วงล่าสุดของตัวเองมากแค่ไหน แถบบรรทัดสถานะแสดงแค่ค่า OBV และเส้นเฉลี่ยThe Smoothing MA is a moving average of OBV (EMA 14 by default). Since OBV's level shifts with the history loaded, its position against its own average is the one reading that does not depend on the level. Deviation bands can be switched on: bands the chosen number of OBV standard deviations above and below the average, showing how far OBV is stretched against its own recent range. The status line shows OBV and the average only.

2อ่านบนกราฟยังไงReading it on the chart

  • เส้น OBV เขียวอมฟ้า สูงกว่าแท่งก่อน แดง ไม่สูงกว่าแท่งก่อน หนา 2 พิกเซลThe OBV line teal, above the previous bar red, not above it; 2 px wide
  • เส้นเฉลี่ย เส้นสีขาวโปร่งแสงบาง ค่าบนแกนขวาเป็นสีเทาThe average the thin translucent white line
  • ปิดไว้ตามค่าเริ่มต้น Deviation bandsOff by default: Deviation bands

3ปรับแล้วได้อะไรWhat each setting changes

เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.

OBV Lineสีของเส้นLine colour1
Modulesสวิตช์ของเส้นเฉลี่ยThe average's switches2
Smoothing MAเส้นเฉลี่ยและแถบAverage and bands2

4ทดลองปรับค่าเองTry it

  1. เส้นเฉลี่ยแบบอื่นAnother average

    เปลี่ยนเป็น SMA แล้ว 28 แท่ง เส้นจะช้าลงและ OBV ตัดผ่านน้อยลงSwitch to SMA, then 28 bars: the line slows and OBV crosses it less often.

  2. OBV ยืดแค่ไหนHow stretched OBV is

    เปิดแถบ 2σ แล้วดูว่า OBV แตะขอบแถบบ่อยแค่ไหนSwitch the 2σ bands on and see how often OBV reaches their edges.

5จุดที่มักเข้าใจผิดCommon pitfalls

  • ค่า OBV ไม่ตรงกับกราฟของคุณOBV does not match your chart's number

    ระดับของ OBV ขึ้นกับประวัติที่โหลด กราฟตัวอย่างเริ่มนับจากข้อมูลชุดของมันเอง ตัวเลขจึงต่างจากบน TradingView ได้ แต่รูปทรงเหมือนกันOBV's level depends on the history loaded. The demo counts from its own data set, so the number can differ from TradingView's while the shape is the same.

  • เส้นเฉลี่ยมองไม่เห็นบนพื้นสว่างThe average is hard to see on a light chart

    เส้นเฉลี่ยเป็นสีขาวโปร่งแสง ถ้าใช้ธีมสว่าง เปลี่ยนสีได้ที่แท็บ StyleThe average is translucent white; on a light theme change its colour in the Style tab.

  • ตัดเส้นเฉลี่ยบ่อยในช่วงออกข้างMany crosses in a sideways stretch

    ตอน OBV เดินออกข้าง เส้นจะตัดเส้นเฉลี่ยไปมาหลายครั้ง กรอบ Consolidation สรุปช่วงนั้นเป็นการเบรกครั้งเดียวWhile OBV moves sideways it crosses its average again and again; the Consolidation box sums that stretch up as one break.

ส่วนที่ 2Part 2

กรอบ ConsolidationConsolidation boxes

1โมดูลนี้คืออะไรWhat it is

โมดูลนี้ตีกรอบช่วงที่ OBV เดินออกข้างแคบกว่าปกติของสินทรัพย์นี้ในช่วงหลัง ทุกแท่ง อินดิเคเตอร์ดูช่วงกว้างของ OBV ใน Window ล่าสุด (ค่าเริ่มต้น 50 แท่ง) เทียบกับค่าเฉลี่ยของช่วงกว้างในกรอบเวลาเดียวกันย้อนหลัง Lookback แท่ง (100) ถ้าแคบกว่าค่าเฉลี่ยคูณ Tightness (0.6) ถือว่าแคบ แล้วเปิดกรอบโดยใช้ OBV สูงสุดและต่ำสุดของ Window นั้นเป็นขอบ ขอบคงที่ตั้งแต่ตอนเปิดกรอบ ไม่ขยายตาม OBV เพราะถ้าขยายตามทุกครั้ง OBV จะไม่มีวันหลุดออก ไม่มีช่องตั้งความกว้าง การวัดเป็นสัดส่วนกับพฤติกรรมของ OBV เอง จึงใช้ได้กับทุกสินทรัพย์This module boxes the stretches where OBV moves sideways, tight for this instrument lately. On every bar it takes OBV's range over the last Window (50 bars by default) and compares it with the average range of such windows over the last Lookback bars (100); below that average times Tightness (0.6) counts as tight, and a box opens with the window's highest and lowest OBV as its edges. The edges are fixed when the box opens and do not follow OBV, because if they did OBV could never leave. There is no width setting: the test is a ratio against OBV's own behaviour, so it means the same on any instrument.

กรอบจะวาดและส่ง alert ได้ก็ต่อเมื่อมีอายุครบ Minimum bars (40) เมื่อ OBV ปิดนอกกรอบ กรอบจะหยุดไว้ชั่วคราว ถ้า OBV กลับเข้ามาภายใน Grace bars (6) กรอบจะเปิดต่อและขยายให้ครอบส่วนที่ออกไป (เบรกล้มเหลว) การเบรกจะยืนยันเมื่อครบ Grace bars แล้ว OBV ยังอยู่นอกกรอบ หรือเร็วกว่านั้นถ้า OBV ออกไปไกลกว่าขอบเกิน Confirm (0.75) OBV step หนึ่ง OBV step คือขนาดเฉลี่ยของการเปลี่ยนแปลงของ OBV ต่อแท่ง ประมาณ volume เฉลี่ยต่อแท่ง เบรกที่ยืนยันแล้วกรอบจะกลายเป็นกรอบที่จบแล้ว เก็บไว้ดูย้อนหลังได้ถึง Boxes retained (30)A box draws and can raise alerts only once it has lasted Minimum bars (40). When OBV closes outside, the box freezes provisionally; if OBV comes back inside within Grace bars (6) the box reopens and widens to take in the excursion (a failed break). The break confirms when the grace bars run out with OBV still outside, or sooner if OBV travels more than Confirm (0.75) OBV steps beyond the edge. One OBV step is the average size of one bar's OBV change, roughly the average bar volume. A confirmed break turns the box into a finished one, kept as a record up to Boxes retained (30).

2อ่านบนกราฟยังไงReading it on the chart

  • กรอบที่กำลังก่อตัว สีม่วงอ่อน ขอบบนและล่างเป็นเส้นทึบ เส้นกลางเป็นเส้นประ ขยายไปถึงแท่งล่าสุดA forming box pale purple, solid top and bottom edges, a dashed midline, running to the latest bar
  • กรอบที่จบแล้ว สีเทา จบที่แท่งที่ OBV หลุดออกA finished box grey, ending at the bar OBV left it
  • ป้าย Consolidation อยู่ใต้ขอบบนกลางกรอบ แสดงเฉพาะกรอบที่จุดกึ่งกลางอยู่ภายใน 250 แท่งล่าสุดThe Consolidation label sits under the top edge, mid-box, only on boxes whose middle is within the last 250 bars

3ปรับแล้วได้อะไรWhat each setting changes

เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.

Modulesสวิตช์ของโมดูลModule switches2
ConsolidationการหาและยืนยันกรอบFinding and confirming a box6
ConsolidationการแสดงผลDisplay5

4ทดลองปรับค่าเองTry it

  1. แคบแค่ไหนถึงนับHow tight counts

    ลอง Tightness 0.4 แล้ว 0.8 ดูว่ากรอบน้อยลงหรือมากขึ้นTry Tightness 0.4, then 0.8: see the boxes thin out or multiply.

  2. รวมเป็นโซนMerge into a zone

    เลือก Merge into zone กรอบที่เกิดซ้อนกันหลังเบรกจะรวมเป็นกรอบเดียวPick Merge into zone: boxes that would stack right after a break merge into one.

5จุดที่มักเข้าใจผิดCommon pitfalls

  • เบรกครั้งแรกยังไม่ใช่เบรกThe first close outside is not the break

    ปิดนอกกรอบครั้งแรกเป็นแค่การหยุดชั่วคราว การเบรกยืนยันเมื่อครบ Grace bars หรือออกไปเกิน Confirm alert เบรกจึงมาช้ากว่าแท่งแรกที่หลุดThe first close outside only freezes the box provisionally; the break confirms after the grace bars or beyond Confirm, so the break alert comes after the first bar out.

  • กรอบเปลี่ยนรูปหลังเกิดA box can change shape after it appears

    เบรกที่ล้มเหลวทำให้กรอบเปิดต่อและขยายครอบส่วนที่ออกไป และในโหมด Merge into zone กรอบที่จบแล้วอาจเปิดต่อได้อีกA failed break reopens the box and widens it over the excursion, and with Merge into zone a finished box can reopen too.

  • Minimum bars นับเป็นเวลาMinimum bars counts time

    อายุของกรอบวัดเป็นเวลา ไม่ใช่จำนวนแท่ง กรอบที่คร่อมสุดสัปดาห์จึงครบ Minimum bars เร็วกว่าที่นับแท่งได้A box's age is measured in time, not in bars, so a box spanning a weekend reaches Minimum bars sooner than its bar count says.

ส่วนที่ 3Part 3

Divergence

1โมดูลนี้คืออะไรWhat it is

โมดูลนี้หาจุดกลับตัวของ OBV (ยอดและก้น) แล้วเทียบกับจุดกลับตัวก่อนหน้าชนิดเดียวกัน พร้อมราคาที่แท่งนั้น (Low ของแท่งก้น High ของแท่งยอด) Regular: ราคาทำจุดสุดใหม่แต่ OBV ไม่ทำตาม คือแรงซื้อขายที่จางลงระหว่างการวิ่ง อ่านเป็นสัญญาณอ่อนแรงที่อาจกลับตัว Hidden: ราคายังรักษาโครงสร้างแนวโน้ม แต่ OBV ทำจุดสุดใหม่ อ่านเป็นการย่อที่ถูกดูดซับแล้วไปต่อ ค่าเริ่มต้นเปิดแค่ RegularThis module finds OBV's turns (peaks and troughs) and compares each with the previous turn of the same kind, along with price on that bar (the Low at a trough, the High at a peak). Regular: price makes a new extreme and OBV does not, participation fading into the move, a potential exhaustion read. Hidden: price holds its trend structure while OBV makes the new extreme, a pullback absorbed, a continuation read. Only Regular is on by default.

จุดกลับตัวต้องมีแท่งก่อนหน้าและหลังตามจำนวนที่ตั้ง (ค่าเริ่มต้น 5 / 5) จึงรู้ว่าเป็นจุดกลับตัวได้หลังแท่ง after ปิดครบ ไดเวอร์เจนซ์จึงปรากฏช้ากว่าจุดกลับตัวเท่านั้น และวาดย้อนกลับไปที่จุดกลับตัว นี่คือวิธีหาจุดกลับตัว ไม่ใช่การ repaint สองจุดจะถูกเทียบก็ต่อเมื่อจำนวนแท่งระหว่างแท่งที่ยืนยันทั้งสองอยู่ในช่วง min / max (5 / 60) เส้นเชื่อมสองจุดกลับตัวอยู่ในหน้าต่าง OBV เก็บไว้ 40 อันล่าสุดA turn needs the set bars before and after it (5 / 5 by default), so it is known only once the after-bars have closed: a divergence appears that many bars after the turn and is drawn back at the turn itself. That is how turns are found, not repainting. Two turns are compared only when the bars between their confirmations fall within min / max (5 / 60). A line joins the two turns in the OBV pane; the newest 40 are kept.

2อ่านบนกราฟยังไงReading it on the chart

  • Bull เส้นและป้ายเขียวอมฟ้าใต้ก้นของ OBV: ไดเวอร์เจนซ์ขาขึ้นแบบปกติBull a teal line and tag under OBV's trough: regular bullish divergence
  • Bear เส้นและป้ายแดงเหนือยอดของ OBV: ไดเวอร์เจนซ์ขาลงแบบปกติBear a red line and tag over OBV's peak: regular bearish divergence
  • H สีเดียวกันแต่จางกว่า: ไดเวอร์เจนซ์แบบซ่อนH the same colours, paler: hidden divergence
  • ปิดไว้ตามค่าเริ่มต้น HiddenOff by default: Hidden

3ปรับแล้วได้อะไรWhat each setting changes

เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.

Modulesสวิตช์ของโมดูลModule switches2
DivergenceชนิดและจุดกลับตัวKinds and turns3

4ทดลองปรับค่าเองTry it

  1. ไดเวอร์เจนซ์แบบซ่อนHidden divergence

    เปิด Hidden แล้วดูป้าย H ที่จางกว่าSwitch Hidden on and look for the paler H tags.

  2. จุดกลับตัวที่ชัดขึ้นClearer turns

    ตั้ง before 8 เหลือเฉพาะจุดกลับตัวที่เด่นกว่าSet Before to 8: only the more prominent turns remain.

5จุดที่มักเข้าใจผิดCommon pitfalls

  • ไดเวอร์เจนซ์มาช้าA divergence arrives late

    จุดกลับตัวรู้ได้หลังแท่ง after ปิดครบ เส้นจึงวาดย้อนหลังไปที่จุดกลับตัว และ alert ส่งตอนยืนยัน ไม่ใช่ตอนจุดกลับตัวA turn is known only after its after-bars close, so the line is drawn back at the turn and the alert fires at the confirmation, not at the turn.

  • จุดกลับตัวก่อนหน้าเปลี่ยนเสมอThe previous turn always moves on

    ทุกจุดกลับตัวใหม่แทนที่จุดก่อนหน้า แม้คู่นั้นจะถูกข้ามเพราะห่างเกินช่วง จึงเทียบได้แค่จุดที่ติดกันEach new turn replaces the previous one even when the pair was skipped for its distance, so only consecutive turns are compared.

ส่วนที่ 4Part 4

Alerts

1โมดูลนี้คืออะไรWhat it is

สร้าง alert บน TradingView ตัวเดียว ตั้ง Condition เป็นอินดิเคเตอร์นี้ → Any alert() function call แล้วเลือกเหตุการณ์ในกลุ่ม Alerts · … ต้องเปิด Enable alerts ก่อน (ปิดไว้ตามค่าเริ่มต้น) ถ้าปิดอยู่ ไม่มีเหตุการณ์ไหนส่งเลย ไม่ว่าจะติ๊กอะไรไว้ ค่าเริ่มต้นติ๊กไว้แค่ Broke above และ Broke belowCreate one TradingView alert with Condition set to this indicator → Any alert() function call, then pick the events in the Alerts · … groups. Enable alerts must be on first (off by default); off, nothing fires whatever is ticked. Only Broke above and Broke below are ticked by default.

ทุกเหตุการณ์ที่ติ๊กไว้และเกิดในแท่งเดียวกัน มาในข้อความเดียว คั่นด้วย · ในรูปแบบ OBV Zones · XAUUSD 5m — OBV broke above its consolidation box @ 3958.120 ไทม์เฟรมเขียนพร้อมหน่วย (5m, 1h, 1D) ราคาหลัง @ คือราคาปิดของแท่ง alert ตามการซ่อนของโมดูลด้วย: โมดูลที่ปิดหรือถูกซ่อนด้วย Hide above จะไม่ส่งEvery ticked event raised on one bar arrives in one message, joined with ·, in the form OBV Zones · XAUUSD 5m — OBV broke above its consolidation box @ 3958.120. The timeframe carries its unit (5m, 1h, 1D); the price after @ is the bar's close. Alerts follow module visibility: a module that is off or hidden with Hide above sends nothing.

2อ่านบนกราฟยังไงReading it on the chart

  • จุดสีส้มเหนือแท่งราคาคือแท่งที่มี alert ▲ ขาขึ้น ▼ ขาลง • ไม่มีทิศ บันทึกใต้กราฟเป็นข้อความที่จะได้รับ กดเพื่อไปที่แท่งนั้นAn orange dot over a price bar marks an alert: ▲ up, ▼ down, • no direction. The log under the chart shows the messages; press one to go to its bar.
  • กราฟนี้เปิด Enable alerts ไว้ให้ (เฉพาะการ์ดนี้)This card has Enable alerts on (this card only).

3ปรับแล้วได้อะไรWhat each setting changes

เรียงตามหน้าตั้งค่าบน TradingView ปุ่มสีทองในแต่ละข้อจะเปลี่ยนค่าบนกราฟด้านบนให้ดูทันทีIn the order TradingView lists them. The gold buttons change the chart above so you can see the effect.

Alertsสวิตช์หลักMaster switch2
Alerts · ConsolidationกรอบBoxes3
Alerts · DivergenceDivergence1
Alerts · Smoothing MASmoothing MA1

4ทดลองปรับค่าเองTry it

  1. หลายเหตุการณ์ในข้อความเดียวSeveral events in one message

    เปิดทุกเหตุการณ์ของกรอบและ Regular divergence แล้วหาแท่งที่มีมากกว่าหนึ่งเหตุการณ์ในบันทึกSwitch every box event and regular divergence on, then look in the log for a bar with more than one event.

5จุดที่มักเข้าใจผิดCommon pitfalls

  • ติ๊กแล้วไม่มี alertTicked, but nothing arrives

    ต้องเปิด Enable alerts และสร้าง alert บน TradingView แบบ Any alert() function call โมดูลของเหตุการณ์นั้นต้องเปิดและไม่ถูกซ่อนบนไทม์เฟรมนั้นEnable alerts must be on and a TradingView alert set to Any alert() function call must exist; the event's module must be on and not hidden on that timeframe.

  • alert ส่งได้ครั้งเดียวต่อแท่งOne alert per bar

    alert() ใช้ความถี่ once per bar ถ้าปิด Fire on bar close only แล้วมีเหตุการณ์ระหว่างแท่ง ข้อความแรกของแท่งเท่านั้นที่ส่งalert() runs once per bar: with Fire on bar close only off, only the first message within a bar is sent.

อ้างอิงReference

การตั้งค่าทั้งหมดAll settings

ทุกช่องตั้งค่าของโค้ด v1.0.0 เรียงตามหน้าตั้งค่าบน TradingView ช่องที่มีจุดทอง เปลี่ยนแล้วกราฟเปลี่ยนตาม กด (i) เพื่ออ่านคำอธิบายของช่องนั้นEvery input of v1.0.0, in the order TradingView shows them. Inputs with a gold dot change the chart; press (i) for an input’s description.