vwap is a volume based indicator. renko don't depend on volume.I found that the VWAP indicator can not show up on Renko chart in thinkorswim. Anyone know the reason ? @BenTen
vwap is a volume based indicator. renko don't depend on volume.I found that the VWAP indicator can not show up on Renko chart in thinkorswim. Anyone know the reason ? @BenTen
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
It works in Ninjatrader. Odd that TOS can't do it.vwap is a volume based indicator. renko don't depend on volume.
# VWAP Anchored to Date
# Mobius
# V01.01.2020
input date = 20220410;
input price = close;
def start = GetYYYYMMDD() >= date;
def sumV;
def sumCV;
if start and !start[1]
{
sumV = volume;
sumCV = close * volume;
}
else if start
{
sumV = sumV[1] + volume;
sumCV = sumCV[1] + (close * volume);
}
else
{
sumV = sumV[1];
sumCV = sumCV[1];
}
plot VWAP = sumCV / sumV;
Almost nothing on this forum are gonna be for range or renko. Pretty much everything is gonna be time or tick based only. In the case of a vwap, the point of the system is to find the precise price/volume equilibrium over the specified length of time, if you remove any of those variables by looking at a "Range" of anything...it doesn't work and has no useI'm using code from Mobius to plot an Anchored VWAP on Renko and Range Bar charts but am unable to get any cose for the deviation bands to work with these types of charts. it seems to be failing to calculate the deviation using this line of code, having defined volumevwap2sum, volumesum and price earlier.
deviation = Sqrt(Max(volumevwap2sum / volumesum - Sqr(price), 0));
Is that just a problem with using Renko and Range Bar charts?
Any help would be appreciated.
the AVWAP code I am using is
Code:# VWAP Anchored to Date # Mobius # V01.01.2020 input date = 20220410; input price = close; def start = GetYYYYMMDD() >= date; def sumV; def sumCV; if start and !start[1] { sumV = volume; sumCV = close * volume; } else if start { sumV = sumV[1] + volume; sumCV = sumCV[1] + (close * volume); } else { sumV = sumV[1]; sumCV = sumCV[1]; } plot VWAP = sumCV / sumV;
Thank you for your input, I agree that the VWAP is used primarily for time based charts, however I do disagree with your statement that it "does not work and has no use" on Renko or Range bar charts. It is my understanding that VWAP is calculated on a per bar basis irrespective of what type of bar that is, as it only uses the volume of that bar, the cumulative volume since the start of the current plot, and the price. Time is not a variable included in the basic calculation.Almost nothing on this forum are gonna be for range or renko. Pretty much everything is gonna be time or tick based only. In the case of a vwap, the point of the system is to find the precise price/volume equilibrium over the specified length of time, if you remove any of those variables by looking at a "Range" of anything...it doesn't work and has no use
Renko is not based on Time, but Renko bricks do have Volume. I'm using this code successfully on Renko charts. The only problem is that you have to manually update the date every day. If you want to "anchor" to different times of the day, you need to search posts on this forum on "Anchored VWAP to Date and Time". I am using one of those for multiple timeframe VWAPS on my Renko charts.Good to know. Thanks. @Alex.
# VWAP Anchored to Date
# Mobius
# V01.01.2020
input date = 20220410;
input price = close;
def start = GetYYYYMMDD() >= date;
def sumV;
def sumCV;
if start and !start[1]
{
sumV = volume;
sumCV = close * volume;
}
else if start
{
sumV = sumV[1] + volume;
sumCV = sumCV[1] + (close * volume);
}
else
{
sumV = sumV[1];
sumCV = sumCV[1];
}
plot VWAP = sumCV / sumV;
Thank you for your input, I agree that the VWAP is used primarily for time based charts, however I do disagree with your statement that it "does not work and has no use" on Renko or Range bar charts. It is my understanding that VWAP is calculated on a per bar basis irrespective of what type of bar that is, as it only uses the volume of that bar, the cumulative volume since the start of the current plot, and the price. Time is not a variable included in the basic calculation.
So as not to confuse anybody who may read this thread, the standard VWAP indicator on ToS will not work on Renko or Range bar charts, but several of the Anchored VWAP examples I have found on this forum that are "anchored " to a specific time of day, do work quite successfully for me on both Renko and Range bar charts. The only thing that I am having a problem with are the VWAP bands, which work on Time and Tick based charts, but I hav
Ruby:# # TD Ameritrade IP Company, Inc. (c) 2011-2022 # # Adjusted VWAP indicator to use price as close instead of vwap so that this approximate version of the VWAP indicator will plot on Range charts. input numDevDn = -2.0; input numDevUp = 2.0; input timeFrame = {default DAY, WEEK, MONTH}; def cap = GetAggregationPeriod(); def errorInAggregation = timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH; Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period"); def yyyyMmDd = GetYYYYMMDD(); def periodIndx; switch (timeFrame) { case DAY: periodIndx = yyyyMmDd; case WEEK: periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7); case MONTH: periodIndx = RoundDown(yyyyMmDd / 100, 0); } def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes); def volumeSum; def volumeVwapSum; def volumeVwap2Sum; def vwap = close; if (isPeriodRolled) { volumeSum = volume; volumeVwapSum = volume * vwap; volumeVwap2Sum = volume * Sqr(vwap); } else { volumeSum = CompoundValue(1, volumeSum[1] + volume, volume); volumeVwapSum = CompoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap); volumeVwap2Sum = CompoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap)); } def price = volumeVwapSum / volumeSum; def deviation = Sqrt(Max(volumeVwap2Sum / volumeSum - Sqr(price), 0)); plot VWAP_ = price; plot UpperBand = price + numDevUp * deviation; plot LowerBand = price + numDevDn * deviation; VWAP_.SetDefaultColor(GetColor(0)); UpperBand.SetDefaultColor(GetColor(2)); LowerBand.SetDefaultColor(GetColor(4));
Thanks, I appreciate it. I'll try that.If you can work with changing within the VWAP indicator the use of close rather than vwap within the volumesum... definitions then the following code will plot a possibly acceptable version of the VWAP indicator.
The upper panel is a range chart with the code below. The lower panels is both the standard VWAP indicator and also the revised version on a time based chart.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
L | Anchored VWAP for Previous Day | Questions | 1 | |
![]() |
Twap-Vwap Difference | Questions | 1 | |
R | plot VWAP like BollingerPercentB | Questions | 1 | |
B | Anchor VWAP to specific time of day | Questions | 2 | |
M | Anchored VWAP Premarket previous days | Questions | 1 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.