HabibiBudo

Movement based on Buying/Selling Volume

Description:
The "Buying Selling Volume" indicator calculates buying and selling volumes based on price movements within a specified lookback period. It then computes exponential moving averages (EMAs) of these volumes to determine trend direction. The indicator visually represents trend direction on the chart.

Volume Calculation and Normalization (Lines #1 - #12):
The indicator first computes the buying volume (BV) and selling volume (SV) based on price movements within the specified lookback period. These volumes are calculated proportionally to the distance between the closing price and the high and low of each candle.
To ensure consistent behavior and prevent division by zero, the volumes are normalized using a conditional statement to handle cases where the high and low are equal, which implies a lack of price movement.
Additionally, the volume (vol) is normalized to ensure non-zero division in subsequent calculations.

Total Volume and Proportional Volume Calculation (Lines #13 - #20):
The total volume (TP) is computed by summing the buying and selling volumes.
The proportional buying volume (BPV) and selling volume (SPV) are then calculated based on their respective contributions to the total volume.
These proportional volumes are scaled by the total volume to ensure accurate representation relative to market activity.

Evaluating Buying and Selling Pressure (Lines #21 - #24):
The code segment assigns positive or negative values to represent buying and selling pressure, respectively, based on the comparison between BPV and SPV. This step involves determining whether the buying pressure exceeds the selling pressure or vice versa.
The calculated values, denoted as BPc1 and SPc1, encapsulate the relative strength of buying and selling forces within the market.

EMA Calculation and Trend Identification (Lines #25 - #32):

The BPc1 and SPc1 values are subjected to exponential moving average (EMA) calculations using the specified lookback period (LookbackL). This process involves smoothing out the buying and selling pressure data to reveal underlying trends.
The resulting EMAs, represented by ema1B and ema1S, serve as crucial indicators of trend direction. A bullish trend is indicated when ema1B exceeds ema1S, while a bearish trend is signaled when ema1B falls below ema1S.
Secondary Volume Analysis and Trend Confirmation (Lines #33 - #42):
A similar volume analysis and EMA calculation process is repeated in this segment, using a different lookback period (LookbackL2). This allows for a secondary assessment of market dynamics and trend direction.
The resulting EMAs, denoted as ema1B2 and ema1S2, are compared to validate the trend direction identified in the primary analysis.

Visual Representation and Trend Display (Lines #43 - #46):
Finally, the indicator visualizes the identified trends on the chart by plotting colored shapes based on the comparison between the primary and secondary trend directions.
A green color indicates alignment in bullish trends, a red color signifies alignment in bearish trends, while a neutral color (gray) represents no clear consensus between the primary and secondary analyses.

Ideal Usage:
1. **Trend Confirmation:** Traders can use this indicator to confirm trend direction before entering trades.
2. **Reversal Signals:** Changes in trend direction, indicated by shifts in plotted shape colors, can signal potential market reversals.

Warnings:
1. **False Signals:** Like any technical indicator, false signals may occur, especially during low-volume or choppy market conditions. Additional analysis and risk management techniques are essential to mitigate potential losses.
2. **Parameter Sensitivity:** Adjusting lookback periods can impact the indicator's sensitivity to price movements. Traders should test different parameter settings and consider market conditions when using the indicator.
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?