Multi-Day VWAP Indicator for ThinkorSwim


New member
Does anyone have a multi-day VWAP indicator that will show the 1 HR VWAP, multi-day vwap, YTD vwap for instance on any time frame ? I'm looking for the daily VWAP on the 1 min chart and also to add an hourly VWAP or multi-day VWAP. Thanks

Will the Anchored VWAP script work in this case?
Last edited:


Well-known member
VWAP already has day,week, and month. Do not think an hourly is possible. Maybe describe the exact VWAP periods you want and see what might show up. For what purpose ??????



New member
This is pretty good Hourse Rider, what I would like to add is a Hourly VWAP and even 15 min, simply for support and resistance levels intraday, I can use Darvas Boxes but VWAP I think is the "true" price. Thanks Horse Rider


New member
Well it's a "cumulative " indicator. The daily shows the daily thus far based on V and P I'm looking to go back the last 15 min or hr not just the cumulative VWAP for the day. I appreciate your efforts, I'll see what I can come up with. Thanks again Horse Rider


Well-known member
@Stephan908vkt 2 day VWAP

input numDevDn = -2.0;
input numDevUp = 2.0;
input timeFrame = {default TWO_DAY, DAY, THREE_DAY,WEEK, MONTH};
input showbubbles = yes;
input bubbleoffset = 2;

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 TWO_DAY:
    periodIndx = Floor((daysFromDate(first(yyyyMmDd)) + getDayOfWeek(first(yyyyMmDd))) / 2);
    periodIndx = Floor((daysFromDate(first(yyyyMmDd)) + getDayOfWeek(first(yyyyMmDd))) / 3);
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;

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;


def n = BubbleOffset;
def n1 = n + 1;
AddChartBubble(showbubbles and IsNaN(close[n]) and !IsNaN(close[n1]) , price[n1] , "VWAP 2D: " + Round(price[n1] , 2), Color.GREEN);


New member
Hey @horserider, I'm not a consistently profitable trader so I can't really say how successful it is for me, but I took a couple SMB courses a few years ago so the way I'm using the 2-day vwap is look for a continuation move after a directional/trend day, wait for the test of the 2-day vwap and watch for a reversal. I probably didn't explain that very well so here are some screenshots

The purple line is the 2-day vwap. On 8/22, we had a strong down day, on 8/23, the plan would be to wait for a test of the 2-day vwap for a short


Strong up day on 8/9 (Friday) so on Monday I was looking for a pullback to the 2-day vwap for a long opportunity.


Here's a screenshot of the OSTK trade I took. I try not to fade it without a little bit of confirmation so for OSTK, I waited for it to get back above the intraday vwap and also the prior close


Anyway, thank you so much again for sharing your indicator.


New member
hello there,
when i used the below shared file for multiday VWAP, it lies on top of the normal VWAP in TOS , not sure if is meant to be , or is it because it is after hour.
i was expecting to see two line one for VWAP and one for MDVWAP

Similar threads