Harrocop

OBV 1min Volume Squeeze

In the vast realm of trading strategies, few terms evoke as much intrigue as the word "squeeze." It conjures images of pent-up energy, ready to burst forth in a sudden and decisive move. In this blog post, we'll delve into a new trading idea titled the "OBV 1-Minute Volume Squeeze" which aims to catch bigger market movements by fetching 1 minute OBV data on higher time charts.

The Essence of Squeeze
In trading parlance, a "squeeze" typically denotes a scenario where volatility contracts, and prices consolidate within a narrow range. Translating this concept to volume dynamics, a "volume squeeze" suggests a period of compressed volume activity. It is unclear if the Bulls or the Bears are at winning hand and price is thus consolidating. The script calculates buying and selling pressure by fetching 1 min data. The total volume presure is the sum of absolute values of the buying and selling pressure added up. By deviding the Buying volume by the total volume we know the Buying Pressure.

The trading theory suggest that when the buying pressure exceeds a certain value eg. 50% (default value in the script is 55%) it is likely the trend will continue to go up for a longer period of time. Vice Versa when selling pressure is higher, the trend is likely to continue down. In the script you can adjust the sensitivity in such way a higher "Volume Pressure %" result in less trading signals.

Fetching 1 min data
The OBV is a wonderful indicator to measure the buying and selling pressure. A disadvantage of the script is that the total volume pressure is presented as a positive (buying) or negative value (selling) value in the Oscillator. It does not offset the Bulls power against the Bears power at given time. The script aims to do measure the directional volume power by defining a volume pressure % (oulier value) by fetching 1 min OBV data on higher time frame charts comparing the Bulls power against the Bears Power. The code is included below:

// Fetch Lower Timeframe Data in an array
// nV = ZeroValue, sV = Selling Volume, bV = Buying Volume, tV = Total Volume
[nV, sV, bV, tV] = request.security_lower_tf(syminfo.tickerid, '1', [close == open ? volume : 0, close < open ? volume : 0, close > open ? volume : 0, volume])

sum_bV_Lengthbars = array.sum(bV)
sum_sV_Lengthbars = array.sum(sV)
sum_tV_Lengthbars = sum_bV_Lengthbars + sum_sV_Lengthbars // Combine buying and selling volumes to get total volume

// Calculate buying and selling volume as percentage of the total volume, but ensure the denominator isn't zero.
buying_percentage = sum_tV_Lengthbars != 0 ? sum_bV_Lengthbars / sum_tV_Lengthbars * 100 : na
selling_percentage = sum_tV_Lengthbars != 0 ? -(sum_sV_Lengthbars / sum_tV_Lengthbars * 100) : na

OBV Oscillator Explanation
The On Balance Volume (OBV) indicator is a technical analysis tool used to measure buying and selling pressure in the market. It does this by keeping a running total of volume flows. OBV is typically calculated by adding the volume on a candle when the price closes higher than the previous candle's close and subtracting the volume on candles when the price closes lower than the previous candles close. If the price closes unchanged from the previous candle, the volume is not added to or subtracted from the OBV. The OBV can be presented as an oscillator. Positve value is the buying pressure and negative values is the selling pressure. In the settings the OBV is calculated based on 1 min data and comes with the following input options for visualization on the chart:
  • Higher Time Frame Settings (make sure the HTF is higher than the chart you have open)
  • Type of MA being: EMA, DEMA, TEMA, SMA, WMA, HMA, McGinley
  • Volume Pressure % (outlier value)
  • Length of number of bars (of the choosen HTF settings)
  • Smoothing of number candles of hte opened timechart. Note that higher number of bars to smoothen the indicator results in less signals, but lag of the indicator increases.

The Oscilator contains 3 main lines which are used to determin the entry signals:
  • Orange Line = the Outlier value in settings described as "Volume Pressure %"
  • Green Line = Total Buying Pressure OBV
  • Red Line = Total Selling Pressure OBV
If the Green or Red line is in between the zero line and the orange line the volume is squeezed and waiting for a directional break out.

If the Green line crosses over the orange line the buying pressure is > 55% and triggers a long entry position (green dot). If the Red line crosses under the orange line the selling pressure is > 55% and triggers an short entry (red dot). In the strategy settings this option is called: "Wait for total volume to increase?".

Alternative Strategy Options
In order to play around with different settings users can opt for two more strategy entry settings, called:
  1. "Wait for total volume to deacrease?" --> Only gives a signal when total volume is declining, but buying or selling pressure maintains and crosses % threshold.
  2. "Wait for Pull Back?" --> After a pullback occured and opposite buy/sell pressure gets lower than threshold (direction is shifting)

Turning on all options will logically result into more signals. Note these strategy ideas are experimental and can best be used in confirmation with other indicators.

Moving Average Filter (HTF)
The Oscillator has a horizontal line at the bottom. The line is green when the moving average is in a uptrend and red when the moving average is in a downtrend. The MA Filter comes with the following settings:
  • Higher Time Frame Setting
  • Type of MA being: EMA, DEMA, TEMA, SMA, WMA, HMA, McGinley
  • Length of number of bars (of the choosen HTF settings)

At last I hope you like this volume trading idea and if you have any comments let me know!




สคริปต์โอเพนซอร์ซ

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

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

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

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