mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-02 19:37:43 +00:00
24e86d762a
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links. - Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
31 lines
981 B
Plaintext
31 lines
981 B
Plaintext
// The MIT License (MIT)
|
|
// © mihakralj
|
|
//@version=6
|
|
indicator("Volume Accumulation (VA)", "VA", overlay=false)
|
|
|
|
//@function Calculates Volume Accumulation
|
|
//@param h High price series
|
|
//@param l Low price series
|
|
//@param c Close price series
|
|
//@param vol Volume series
|
|
//@returns Cumulative Volume Accumulation value
|
|
//@optimized for performance and dirty data
|
|
va(series float h=high, series float l=low, series float c=close, series float vol=volume) =>
|
|
float high_price = nz(h, close), float low_price = nz(l, close)
|
|
float close_price = nz(c, close), float volume_val = nz(vol, 0.0)
|
|
float midpoint = (high_price + low_price) / 2.0
|
|
float va_period = volume_val * (close_price - midpoint)
|
|
var float va_cumulative = 0.0
|
|
va_cumulative += va_period
|
|
va_cumulative
|
|
|
|
// ---------- Main loop ----------
|
|
|
|
// No inputs required - uses standard OHLC and volume data
|
|
|
|
// Calculation
|
|
va_value = va()
|
|
|
|
// Plot
|
|
plot(va_value, "VA", color=color.yellow, linewidth=2)
|