Welkin
Active member
The author of the study isn't available on the forum to provide answers to questions. So this thread has been locked.
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[1] / VWAP,
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.
Code:
#[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;
TUG1.Hide();
TUG2.Hide();
TUG3.Hide();
plot TUGAVG = (TUG1 + TUG2 + TUG3) / 3;
zeroline.SetDefaultColor(Color.Gray);
TUGAVG.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TUGAVG.SetLineWeight(2);
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);
TUG1.SetDefaultColor(Color.White);
TUG2.SetDefaultColor(Color.Dark_Orange);
TUG3.SetDefaultColor(Color.Red);
Last edited by a moderator: