OPEN-SOURCE SCRIPT
Volume Spike Accumulation [forexobroker]

Volume Spike Accumulation [forexobroker] reads volume spikes through where the bar closed in its own range. A spike that closes in the upper part of the range is demand absorbing supply (accumulation); a spike closing in the lower part is supply (distribution). Accumulation arms a long bias and distribution a short bias, and entries time off an EMA reclaim in the bias direction so signals are frequent rather than one-per-spike.
🔶 ALGORITHM
1. Compute ATR and an SMA of volume over the volume-MA length as the baseline.
2. Flag a volume spike when volume >= k x its moving average.
3. Close-position classification: clsPos = (close - low) / (high - low). A spike with clsPos >= the close-position threshold is accumulation; clsPos <= 1 - threshold is distribution.
4. Relative volume = volume / volume-MA for the dashboard.
5. Accumulation arms a persistent long bias and distribution a persistent short bias, holding until the opposite classified spike fires.
6. Entry timing: an EMA reclaim (close crossing the entry-reclaim EMA in the bias direction), or strictly the classified spike bar in Spike-Only Mode.
🔶 SIGNAL LOGIC
- Buy: bias == long (last classified spike was accumulation) AND close crosses over the reclaim EMA (or an accumulation spike bar in Spike-Only Mode), in session, with no active long, cooldown elapsed, and barstate.isconfirmed; position locks long.
- Sell: bias == short (last classified spike was distribution) AND close crosses under the reclaim EMA (or a distribution spike bar in Spike-Only Mode), in session, with no active short, cooldown elapsed, and barstate.isconfirmed; position locks short.
Only fires while the persistent spike bias agrees with the entry direction.
🔶 INPUTS
- Volume group: volume MA length for the spike baseline (default 20).
- Volume group: spike multiple of the volume MA (default 1.8).
- Volume group: close-position threshold for accumulation vs distribution (default 0.66).
- Volume group: ATR length (default 14).
- Signal Logic group: entry reclaim EMA length (default 9).
- Signal Logic group: Spike-Only Mode toggle (default off) and cooldown bars (default 5).
- Filters group: restrict-to-session toggle and session window (default 0000-2400).
- Visual group: show dashboard, 3-layer glow, and reclaim EMA (all default on).
- Visual group: buy color, sell color, and dashboard background.
🔶 ALERTS
VSA Buy, VSA Sell, VSA Any Signal, VSA Accumulation, VSA Distribution, VSA Volume Spike, VSA Classified, VSA EMA Up, VSA EMA Down, VSA Bias Bull, VSA Bias Bear, VSA Spike Tick, VSA Webhook JSON.
🔶 LIMITATIONS
- Volume-based: needs a real volume feed; forex volume is tick-volume, which only approximates traded size.
- Needs warm-up bars for the volume MA and ATR before spikes are valid.
- The spike multiple default is tuned for liquid instruments; quiet or thin symbols may need it retuned.
- The persistent bias holds until an opposite classified spike fires, so it can stay stale through quiet periods.
- Signals confirm on bar close; close-position and bias can change intrabar before the bar finishes.
🔶 ALGORITHM
1. Compute ATR and an SMA of volume over the volume-MA length as the baseline.
2. Flag a volume spike when volume >= k x its moving average.
3. Close-position classification: clsPos = (close - low) / (high - low). A spike with clsPos >= the close-position threshold is accumulation; clsPos <= 1 - threshold is distribution.
4. Relative volume = volume / volume-MA for the dashboard.
5. Accumulation arms a persistent long bias and distribution a persistent short bias, holding until the opposite classified spike fires.
6. Entry timing: an EMA reclaim (close crossing the entry-reclaim EMA in the bias direction), or strictly the classified spike bar in Spike-Only Mode.
🔶 SIGNAL LOGIC
- Buy: bias == long (last classified spike was accumulation) AND close crosses over the reclaim EMA (or an accumulation spike bar in Spike-Only Mode), in session, with no active long, cooldown elapsed, and barstate.isconfirmed; position locks long.
- Sell: bias == short (last classified spike was distribution) AND close crosses under the reclaim EMA (or a distribution spike bar in Spike-Only Mode), in session, with no active short, cooldown elapsed, and barstate.isconfirmed; position locks short.
Only fires while the persistent spike bias agrees with the entry direction.
🔶 INPUTS
- Volume group: volume MA length for the spike baseline (default 20).
- Volume group: spike multiple of the volume MA (default 1.8).
- Volume group: close-position threshold for accumulation vs distribution (default 0.66).
- Volume group: ATR length (default 14).
- Signal Logic group: entry reclaim EMA length (default 9).
- Signal Logic group: Spike-Only Mode toggle (default off) and cooldown bars (default 5).
- Filters group: restrict-to-session toggle and session window (default 0000-2400).
- Visual group: show dashboard, 3-layer glow, and reclaim EMA (all default on).
- Visual group: buy color, sell color, and dashboard background.
🔶 ALERTS
VSA Buy, VSA Sell, VSA Any Signal, VSA Accumulation, VSA Distribution, VSA Volume Spike, VSA Classified, VSA EMA Up, VSA EMA Down, VSA Bias Bull, VSA Bias Bear, VSA Spike Tick, VSA Webhook JSON.
🔶 LIMITATIONS
- Volume-based: needs a real volume feed; forex volume is tick-volume, which only approximates traded size.
- Needs warm-up bars for the volume MA and ATR before spikes are valid.
- The spike multiple default is tuned for liquid instruments; quiet or thin symbols may need it retuned.
- The persistent bias holds until an opposite classified spike fires, so it can stay stale through quiet periods.
- Signals confirm on bar close; close-position and bias can change intrabar before the bar finishes.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
🔵Gain access to our powerful tools : kestutisbalciunas.com/tradingview/
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
🔵Join our free telegram for updates : t.me/algotradingedge
All scripts & content provided by Forexobroker are for informational & educational purposes only.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.