Hi there, I am looking for a floating (short line) anchored VWAP for 1D 2D 3D and weekly, similar to the picture showing below. The idea is to use 1D 2D and 3D to stay in the trade and use weekly as a possible pin level for Friday. I believe Alpha Trend may have something along the line. I would appreciate it a great deal if someone can help to assemble them. the FLOATING red dotted line, green line, and blue line are 1D 2D 3D Anchored VWAP
See if this helps. The code will display anchored Daily VWAPs as shown. Enter input lookback = 0 to display today's and the previous 2 day's anchored vwaps. TOS vwap's as well as data appear to be slightly different than that used in your Stockchart's display. The chart below also has SVEPIvots displayed to try to match your chart example.
Code:
#VWAP Anchored
#20210522 Sleepyz - Usethinkscript request
script v {
input lookback = 1;
def anchor = GetDay() >= GetLastDay() - lookback;
def volumeSum = if anchor then CompoundValue(1, volumeSum[1] + volume, volume) else 0;
def volumeVwapSum = if anchor then CompoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap) else 0;
def volumeVwap2Sum = if anchor then CompoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap)) else 0;
def price = volumeVwapSum / volumeSum;
def deviation = Sqrt(Max(volumeVwap2Sum / volumeSum - Sqr(price), 0));
plot VWAP = price;
}
#Day Separator
input show_day_separator = yes;
AddVerticalLine(show_day_separator and SecondsFromTime(0930) == 0, "", Color.BLUE, stroke = Curve.FIRM);
input lookback = 0;
plot v1 = v(lookback);
plot v2 = v(lookback + 1);
plot v3 = v(lookback + 2);
v1.SetDefaultColor(Color.CYAN);
v2.SetDefaultColor(Color.GREEN);
v3.SetDefaultColor(Color.RED);
v1.SetLineWeight(3);
v2.SetLineWeight(3);
v3.SetLineWeight(3);
v3.SetStyle(Curve.LONG_DASH);
Last edited: