This is a derivation of the On Balance Volume Indicator.

The idea behind it is that volume consists of two parts. The driving theory is the basic law of supply and demand.

Part 1: Volume consists of shares traded at an equilibrium price. An equal number of buyers and sellers are present during this volume. This area is displayed as the upper and lower shadows on a single candlestick. For this indicator, volume traded in equilibrium is not included in the display.

Part 2: Volume consists of shares that are not traded at an equilibrium price, driving price up or down for the time period. In this volume, buyers or sellers are not present in equal numbers. This area is displayed as the body of the candlestick. This indicator focuses on this part of volume.

VPT_OBV plots only the volume that occurs at the difference in price between the open and the close. To achieve this, volume is divided by the difference between the high and the low (in pennies). Next, the difference between the open and close is calculated (in pennies). Volume is then divided by the difference in the high and low, to get the amount of volume needed to move the asset up or down by $0.01 during the time period. This number is then multiplied by the difference between the open and close.

VPT_OBV plots the outcome as a cumulative total. A simple moving average of the VPT_OBV is thrown in to provide smoothing.
สคริปต์โอเพนซอร์ซ

ด้วยจิตวิญญาณของ TradingView อย่างแท้จริง ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้ผู้ค้าสามารถเข้าใจและตรวจสอบได้ ไชโยให้กับผู้เขียน! คุณสามารถใช้ได้ฟรี แต่การใช้รหัสนี้ซ้ำในสิ่งพิมพ์อยู่ภายใต้กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ เงื่อนไขการใช้บริการ

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?
study("VPT_OBV")

length = input(20, minval=1, title="SMA Length")

hilow = ((high - low)*100)
openclose = ((close - open)*100)
vol = (volume / hilow)
spreadvol = (openclose * vol)


VPT = spreadvol + cum(spreadvol)
SMA = sma(VPT,length)


plot(VPT, color=green, style=line, linewidth=1 )
plot(SMA, color=blue, style=line, linewidth=2)