Moving volume weighted average price (MVWAP) thinkscript

jordan

New member
Can someone please share the thinkscript to create a moving volume weighted average price (MVWAP) indicator? Thanks
 

jordan

New member
Thanks for your reply but I thought the VWMA (volume weighted moving average) was different from the MVWAP (moving volume weighted average price) in that vwma is a moving average that takes volume into account where as mvwap is a moving average based on the end of day vwap values. I tried to do a search for MVWAP but couldn't find any results.

Here is a link that talks about the mvwap indicator I'm referring to-
https://www.investopedia.com/articles/trading/11/trading-with-vwap-mvwap.asp
 

jordan

New member
Is there a way to turn this into a multi-timeframe indicator, so that I can look at the daily values plotted onto any intraday charts without changing the values? for example I found this thinkscript that allows me to plot the values from a daily simple moving average onto any intraday charts without changing the values.

input Period = aggregationPeriod.day;
input AvgType = averageType.SIMPLE;
input Length = 9;
input priceclose = close;

plot AVG = MovingAverage(AvgType, close(period = Period), Length);
AVG.setdefaultcolor(color.white);plot Data = close;

I tried copying and altering some of this script onto the MVWAP script but I'm still new and couldn't find a way to get it to work. Thank you
 

MerryDay

Administrative
Staff member
Staff
VIP
@jordan Normally, you would be on the right track and kudos for figuring out the logic. But MVWAP is a custom definition. Multi-timeframe logic can only constructed on built-in TOS definitions. So we would need to perform the MTF calculation on the underlying VWAP definition. But we can't do that in this case because the VWAP is already defined by time. It is limited to (Daily Weekly Monthly).
I did change the logic on the MVWAP so that you can choose (daily, weekly, or monthly) but those are the only choices available.
 

jordan

New member
In that case is there a way to apply the MTF calculation on the VWMA instead? I moved some of the thinkscript over from the first example in combination with some VWMA thinkscript and it looks like it works correctly on the chart, I just wanted to confirm that it makes sense from someone more knowledgeable. Thank you.

input Period = AggregationPeriod.DAY;
input length = 9;

def vwma = Sum(volume * close(period = Period), length) / Sum(volume, length);

plot Value = vwma;
 

ThinkStudy

New member
In that case is there a way to apply the MTF calculation on the VWMA instead? I moved some of the thinkscript over from the first example in combination with some VWMA thinkscript and it looks like it works correctly on the chart, I just wanted to confirm that it makes sense from someone more knowledgeable. Thank you.

input Period = AggregationPeriod.DAY;
input length = 9;

def vwma = Sum(volume * close(period = Period), length) / Sum(volume, length);

plot Value = vwma;
The MTF doesnt work on this. Ive been looking for a way to get it to work but i still havent been able to figure it out. I guess its like MerryDay said "Multi-timeframe logic can only be constructed on built-in TOS definitions." but i dont wanna believe it.
 

ThinkStudy

New member
In that case is there a way to apply the MTF calculation on the VWMA instead? I moved some of the thinkscript over from the first example in combination with some VWMA thinkscript and it looks like it works correctly on the chart, I just wanted to confirm that it makes sense from someone more knowledgeable. Thank you.

input Period = AggregationPeriod.DAY;
input length = 9;

def vwma = Sum(volume * close(period = Period), length) / Sum(volume, length);

plot Value = vwma;
TOS MTF VWMA - Here it is - https://usethinkscript.com/threads/mtf-vwma.7410/#post-71528
 

Similar threads

Top