Volume

ADL

MarketTechnicals.adlFunction
adl(ohlcv; h = :High, l = :Low, c = :Close, v = :Volume)

Accumulation/Distribution Line

Developed by Marc Chaikin.

Formula

\[ADL_t = ADL_{t-1} + 'frac{(Close_t - Low_t) - (High_t - Close_t)}{High_t - Low_t}' 'times Volume_t'\]

References

source
julia> adl(ohlcv)
500×1 TimeArray{Float64,1,Date,Array{Float64,1}} 2000-01-03 to 2001-12-31
│            │ adl               │
├────────────┼───────────────────┤
│ 2000-01-03 │ 4.2882507863e6    │
│ 2000-01-04 │ 984498.0822       │
│ 2000-01-05 │ -4.1263627644e6   │
│ 2000-01-06 │ -1.09832627644e7  │
│ 2000-01-07 │ -9.113399128e6    │
│ 2000-01-10 │ -1.0015299128e7   │
│ 2000-01-11 │ -1.19598612902e7  │
│ 2000-01-12 │ -1.93384766235e7  │
│ 2000-01-13 │ -1.60191326235e7  │
   ⋮
│ 2001-12-19 │ -1.395757822699e8 │
│ 2001-12-20 │ -1.430557822699e8 │
│ 2001-12-21 │ -1.451589119997e8 │
│ 2001-12-24 │ -1.445506992724e8 │
│ 2001-12-26 │ -1.455874044448e8 │
│ 2001-12-27 │ -1.440051089224e8 │
│ 2001-12-28 │ -1.445187146916e8 │
│ 2001-12-31 │ -1.465641074627e8 │

OBV

MarketTechnicals.obvFunction
obv(ohlcv; price = :Close, v = :Volume)

On Balance Volume

Formula

\[\begin{align*} \text{OBV}_t = \text{OBV_{t - 1} + \begin{cases} \text{volume} & \text{if} P^\text{Close}_t > P^\text{Close}_{t-1} \\ 0 & \text{if} P^\text{Close}_t = P^\text{Close}_{t-1} \\ -\text{volume} & \text{if} P^\text{Close}_t < P^\text{Close}_{t-1} \end{cases} \end{align*}\]

source
julia> obv(ohlcv)
500×1 TimeArray{Float64,2,Date,Array{Float64,2}} 2000-01-03 to 2001-12-31
│            │ obv        │
├────────────┼────────────┤
│ 2000-01-03 │ 4.7839e6   │
│ 2000-01-04 │ 209100.0   │
│ 2000-01-05 │ 7.1584e6   │
│ 2000-01-06 │ 301500.0   │
│ 2000-01-07 │ 4.4152e6   │
│ 2000-01-10 │ -94300.0   │
│ 2000-01-11 │ -4.0367e6  │
│ 2000-01-12 │ -1.27516e7 │
│ 2000-01-13 │ -3.5312e6  │
   ⋮
│ 2001-12-19 │ -9.34465e7 │
│ 2001-12-20 │ -9.73905e7 │
│ 2001-12-21 │ -9.28131e7 │
│ 2001-12-24 │ -9.1909e7  │
│ 2001-12-26 │ -8.92947e7 │
│ 2001-12-27 │ -8.58749e7 │
│ 2001-12-28 │ -8.05334e7 │
│ 2001-12-31 │ -8.29938e7 │

VWAP

MarketTechnicals.vwapFunction
vwap(ohlcv, n = 10; price = :Close, v = :Volume)

Volume Weight-Adjusted Price

Formula

\[P = \frac{\sum_j P_j V_j}{\sum_j V_j}\]

source
julia> vwap(ohlcv)
491×1 TimeArray{Float64,1,Date,Array{Float64,1}} 2000-01-14 to 2001-12-31
│            │ vwap     │
├────────────┼──────────┤
│ 2000-01-14 │ 97.9215  │
│ 2000-01-18 │ 97.1709  │
│ 2000-01-19 │ 97.6203  │
│ 2000-01-20 │ 100.8515 │
│ 2000-01-21 │ 102.1978 │
│ 2000-01-24 │ 102.6203 │
│ 2000-01-25 │ 103.6321 │
│ 2000-01-26 │ 104.6497 │
│ 2000-01-27 │ 107.573  │
   ⋮
│ 2001-12-19 │ 21.6524  │
│ 2001-12-20 │ 21.3642  │
│ 2001-12-21 │ 21.2082  │
│ 2001-12-24 │ 21.0995  │
│ 2001-12-26 │ 21.0572  │
│ 2001-12-27 │ 21.1139  │
│ 2001-12-28 │ 21.3165  │
│ 2001-12-31 │ 21.4446  │