Elastic Volume Weighted Moving Average & Envelope [LazyBear]

Elastic Volume Weighted Moving Average (eVWMA) is a statistical measure using the volume to define the period of the moving average. The eVWMA can be looked at as an approximation to the average price paid per share. Multiplier is usually the number of shares, but it can be approximated using cumulative sum of volume (Enable it via "Use Cumulative Volume" option) or sum of volume over "n" periods.

I have also added an option to draw eVWMA envelope (eVWMA on HLC).

More info:

List of all my indicators:
- Chart: - GDoc:
從收藏腳本中移除 新增至收藏腳本
// @author LazyBear 
// List of all my indicators:
study("Elastic Volume Weighted Moving Average [LazyBear]", shorttitle="EVWMA_LB", overlay=true)
useCV=input(false, type=bool, title="Use Cumulative Volume")
renderBands=input(false, type=bool, title="Draw Envelope")
nbfs = useCV ? cum(volume) : sum(volume, length)
calc_evwma(price, length, nb_floating_shares) =>
    data = (nz(data[1]) * (nb_floating_shares - volume)/nb_floating_shares) + (volume*price/nb_floating_shares)

m=calc_evwma(medianSrc, length, nbfs)
plot(m, color=maroon, linewidth=2, title="evwma")
plot(renderBands ? calc_evwma(high, length, nbfs): na, color=red  , linewidth=2, title="evwma+")
plot(renderBands ? calc_evwma(low, length, nbfs) : na, color=green, linewidth=2, title="evwma-")
List of my free indicators:
List of my indicators at Appstore:


This IS a VERY useful indicator. If you want to trade in a very simple and smart manner, this indicator will help you massively in your trading efforts. Read up on MIDAS is the best thing you can do to under stand how to implement this tool. In a nutshell, only enter a trade when price converges with the line plotted by this indicator. It signifies a "true" value in price. One caveat, you can only use this tool on instruments where volume is measured. So Spot Forex is not compatible ((typical of Forex, not this indicator)), unfortunate for Forex traders, but perhaps that crowd can use a futures equivalent.

Thanks LazyBear for the addition!!!
+6 回覆
This calculation isn't anything new, it is simply the TRUE calculation of the volume weighted moving average. Trading view calculates the VWMA incorrectly as instructed by their own documentation when you search for the vwma() function.

This formula here shows the step-by-step calculation of the VWMA as an incremental/rolling calculation:, Eq 4-53

U = Un-1 + w / Wn * (x - Un-1)

let Wn = nb_floating_shares (sum of volume (weight) N bars back)
let w = current volume (current weight)
let x = price
let Un-1 = previous MA calculation
let Un = current MA

from line 12 of this script in the calc_evwma function, substituting the above variables:

U = Un-1 * (Wn - w) / Wn + (w * x / Wn)
= Un-1 / Wn * (Wn - w) + w * x / Wn
= Un-1 - Un-1 * w / Wn + w * x / Wn
= Un-1 + w / Wn * (x - Un-1)

This is the exact same formula in the final value in Equation 4-53 above. This is also the same calculation here

The Trading View calculation of vwma is wrong, it should be the above. The elastic volume weighted moving average is simply another form of the normal VWMA formula, it is not a new moving average.
+5 回覆
chrysopoetics mortdiggiddy
@mortdiggiddy, so what you're saying is that this script is the true implementation of the VWMA (using cumulative volume or the sum of the volume over a specified length?) and the code above is the correct implementation of the eVWMA?

Sorry to be extra-dense, but would it be possible for you to script-up the correct implementation of the eVWMA (or whatever it is you've commented above)?

And thank you for sharing those articles. I love when people leave gold in the comments.
xel_arjona mortdiggiddy
@mortdiggiddy, Indeed, If you plot the cumulative sum version (All timeSeries from within it's origin price) side by side with VWAP, you will have quite much the same result. Tony Finch's paper is a jewel, it defines and proofs why this kind of incremental rolling could have better computation performance in their AutoRegressive algorithm model. (EWMA for math-statistics, 1-pole Infinite Impulse Response for math-frequentists). Can't remember name of paper for the computational proof for this, but google is always your friend. ;)
zfadeview mortdiggiddy
@mortdiggiddy, I’m new here, so please correct me if I’m wrong.

According to the definition of eVWMA presented in the paper, “Wn” here should be a constant, i.e. total number of shares, that doesn’t have to do with sum of Wi (which would be the total volumes of interest). With Wn != sum of Wi, the equations above do not check out. Hence, it’s more like a volume weighted “cumulative” average (or a special case of VWMA, where all historical volumes are considered), plus a decaying effect on previous trades. Does it make sense?
Oh, CUMULATIVE volume.
I'll show myself out.
+4 回覆
LazyBear grahvity
+1 回覆
eVWMA looks very useful in my first test. Thanks as always for sharing with us.
+2 回覆
Wonder what is the use of this indicator? Is it for showing oversold/bought conditions, S/R levels?
+1 回覆
LazyBear joe_vijay
This is moving average. You can substitute this in any xMA strategy.
+1 回覆
首頁 股票篩選器 外匯篩選器 加密貨幣篩選器 全球財經日曆 如何運作 圖表功能 價格 推薦朋友 網站規則 幫助中心 網站 & 經紀商解決方案 小工具 圖表解決方案 輕量圖表庫 部落格 & 新聞 推特
概覽 個人資料設定 賬戶和賬單 推薦朋友 我的客服工單 幫助中心 發表的想法 粉絲 正在關注 私人訊息 在線聊天 登出