VWAP Price Tug Histogram for ThinkorSwim


Active member
I didn't know what to name this indicator so I simply called it the VWAP tug. This modeled after something I've noticed in relation to VWAP and strong opens as well as small changes in VWAP over time with trends and the way price "tugs" or pulls the vwap in its direction. What this does is calculates the percentage difference in the VWAP value of the current bar with the prior bar, and repeating this with the next two prior bars so:

VWAP[2] / VWAP[1]
VWAP[3] / VWAP[2]

These are then averaged together and plotted as a histogram. Also added a paintbars feature to it.

#[email protected]

declare lower;

input Paintbars = no;

def VWAP0 = VWAP();

plot TUG1 = 100 - ((VWAP0[1] / VWAP0)*100);
plot TUG2 = 100 - ((VWAP0[2] / VWAP0[1])*100);
plot TUG3 = 100 - ((VWAP0[3] / VWAP0[2])*100);

plot zeroline = 0;


plot TUGAVG = (TUG1 + TUG2 + TUG3) / 3;


TUGAVG.DefineColor("Positive and Up", Color.GREEN);
TUGAVG.DefineColor("Positive and Down", Color.DARK_GREEN);
TUGAVG.DefineColor("Negative and Down", Color.RED);
TUGAVG.DefineColor("Negative and Up", Color.DARK_RED);
TUGAVG.AssignValueColor(if TUGAVG >= 0 then if TUGAVG > TUGAVG[1] then TUGAVG.color("Positive and Up") else TUGAVG.color("Positive and Down") else if TUGAVG < TUGAVG[1] then TUGAVG.color("Negative and Down") else TUGAVG.color("Negative and Up"));

AssignPriceColor(if !paintbars then Color.CURRENT else if TUGAVG >= 0 then if TUGAVG > TUGAVG[1] then color.GREEN else  color.DARK_GREEN else if TUGAVG < TUGAVG[1] then color.RED else  color.DARK_RED);

Last edited:


This is rad! Have you thought about making a Supertrend of the price tug for the candle coloring or is that what you already kind of did?


Active member
This is rad! Have you thought about making a Supertrend of the price tug for the candle coloring or is that what you already kind of did?
I've tried all kinds of indicators for indicating trends and reversals, and I have thought of making some sort of 'supertrend' but i just find myself constantly going back to heiken ashi trend and a 12 period hull moving average, those two seem to be the most consistent trend indicators IMO. This was one of the first scripts I made and figured I'd put it up here incase someone else found some use for it or used it as a building block for something even cooler.


Active member
@Welkin what products and timeframes, do you trade? What are your go to indicators other than the ones you just mentioned?
I am by no means an expert trader, I just pay the bills, not driving a yacht yet.

I used to trade forex, now i just trade stocks and options, focusing on ETF's such as spy, qqq, etc.. or hedge contracts on vix. I like those more than hunting down individual stocks, though i still look for opportunities in those, its not my priority. I primarily day trade on 5 min time frame. Instead of going lower to 1 min/3min/etc.. I'll use a 5 tick range chart to get a better look at patterns forming (wedges, triangles, flags, etc..), better see what the price action is telling me. Its also a nice way to see when volatility strikes because the grid that divides time on the x axis will widen showing bursts of activity with lots of ticks. Of course I also look at 30 min, 195 min, Hour, Daily with monthly vwap deviation bands, and the Weekly so I get an idea of whats happening in the bigger picture.

as for other indicators, like i said above i like using 12 period hull ma and painting candles as heiken ashi for trend. I also like using RSI Laguerre https://tos.mx/fYxPN9H which I found in the onenote archive, combined with the OBV histogram i scripted, they seem to align in the right ways for good signals. MACD with defaults. I also use a market internals indicator such as $tick, $pcall ratio, breadth ratio, and advance decline. https://tos.mx/mSaOjui if you wanna look at that, I threw it together based other indicators I've seen. Though I haven't seen anyone plot $tick the same way. Labels for ATR, ADR, ADX, Implied Volatility, Avg Daily Vol, Day's Volume, Avg Bar Volume.

Sometimes I'll also bring out Volume Profile and mark Points of Control, Value Areas, or Low/High volume nodes.

Oh and fib extensions for those times when there is no chart history to fall back on.

edit: though this isn't an indicator exactly, I consider it important and trade around it, and that is 30 min market intervals. lots of reversals and pivots tend to happen at 30ish min intervals.... just look at spy on a 5 min and put a vertical line every 30 mins from market open going back a few days and you'll see what I mean.
another edit: I also use an indicator that plots the prior day's high low and close onto the current day https://tos.mx/ktysxlZ
Last edited:


Thanks for the info, we have similar styles and use a lot of the same indicators/ideas. Things I use that you don't include the cumulative delta indicator that was posted on this site, and the SMI and TMO studies that have been posted here. (If you feel like normalizing the TMO and plotting cumulative delta on the 50% line as a histogram I would love to see that as one study). I also am trying out various RSI studies with Fractal Pivots and some modified DMI studies. Also been playing around with Diazlaz's CSA (combinded signal approach) study. Let me know if you want to check out any of those if you can't find them on here.

BTW, that internals chart is great!


Great thread, great indicators. Stumbling on stuff like this makes all the time spent digging worth it.


Active member
@Welkin my friend I hope everyone is doing well where you are...
I just now saw this searching your posts. I forget everything you write of course but I am using this with that other constant VWAP you have. I want to better understand when the price is heading to some resistance and the price action becomes more likely to fade back to the original VWAP.

So VWAP tug to VWAP required to move?



New member
Hi, I'm looking for a study to identify stocks trading within a set percentage of VWAP. Is there a study inside of TOS that does this or could someone help me code something that would achieve this?

Similar threads