OPEN-SOURCE SCRIPT
Buy/Sell Volume Tracker [wjdtks255]

Indicator Description
Function: Separates buy and sell volume based on candle direction (close ≥ open) and displays the buy−sell difference (hist_val) as a histogram.
Visuals: Buy/sell bars are distinguished by user-selectable colors and opacity; two moving averages (MA1 and MA2) are shown to smooth the flow.
Meaning: A positive histogram indicates buy dominance; a negative histogram indicates sell dominance.
Limitation: The current separation is estimated from candle direction and may differ from execution-side (tick/trade-side) based data.
Trading Rules (Summary)
Conservative trend-following long
Entry: Enter long when hist_val turns above 0 and MA1 crosses MA2 from below.
Stop-loss: Exit if hist_val falls back below 0 or MA1 drops below MA2.
Take-profit: Use a risk:reward of 1:1.5 or set targets based on ATR.
Short-term rebound long
Entry: Enter a short-term long when a large negative histogram region begins to narrow and shows a recovery sign.
Stop-loss: Exit if hist_val drops below the previous low or bearish candles continue.
Take-profit: Prefer quick partial profit-taking.
Short (sell) strategy
Entry: Enter short when hist_val falls below 0 and MA1 crosses MA2 from above.
Stop-loss / Take-profit: Apply the inverse rules of the long strategy.
Filters and risk management
Volume filter: Only accept signals when volume exceeds a fraction of average volume to reduce noise.
Entry strength: Require |hist_val| to exceed a historical average threshold (e.g., avg(|hist_val|, N) × factor) to strengthen signals.
Position sizing: Size positions so that account risk per trade is within limits (e.g., 1–2% of account equity).
Timeframe: Use short timeframes for scalping and 1h+ for swing trading.
Function: Separates buy and sell volume based on candle direction (close ≥ open) and displays the buy−sell difference (hist_val) as a histogram.
Visuals: Buy/sell bars are distinguished by user-selectable colors and opacity; two moving averages (MA1 and MA2) are shown to smooth the flow.
Meaning: A positive histogram indicates buy dominance; a negative histogram indicates sell dominance.
Limitation: The current separation is estimated from candle direction and may differ from execution-side (tick/trade-side) based data.
Trading Rules (Summary)
Conservative trend-following long
Entry: Enter long when hist_val turns above 0 and MA1 crosses MA2 from below.
Stop-loss: Exit if hist_val falls back below 0 or MA1 drops below MA2.
Take-profit: Use a risk:reward of 1:1.5 or set targets based on ATR.
Short-term rebound long
Entry: Enter a short-term long when a large negative histogram region begins to narrow and shows a recovery sign.
Stop-loss: Exit if hist_val drops below the previous low or bearish candles continue.
Take-profit: Prefer quick partial profit-taking.
Short (sell) strategy
Entry: Enter short when hist_val falls below 0 and MA1 crosses MA2 from above.
Stop-loss / Take-profit: Apply the inverse rules of the long strategy.
Filters and risk management
Volume filter: Only accept signals when volume exceeds a fraction of average volume to reduce noise.
Entry strength: Require |hist_val| to exceed a historical average threshold (e.g., avg(|hist_val|, N) × factor) to strengthen signals.
Position sizing: Size positions so that account risk per trade is within limits (e.g., 1–2% of account equity).
Timeframe: Use short timeframes for scalping and 1h+ for swing trading.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.