Thank you! This works totally fine as a set of chart labels. However, what do I actually use in thinkscript editor for the watchlist column to display the current value of, say, daily VWAP 1 SD upper band, since the watchlist column can only display a single value?
Tried single statement in custom column definition:
plot Custom1 = reference VWAP("num dev up" = 1.0, "time frame" = "DAY"); # Where it appears "DAY" has to be a string. AggregationPeriod.DAY, etc. does not work.
(This is typically how I do it, btw. There may be better ways, but if I'm looking for, say, the value of 8 EMA as a custom column, I'd simply say:
plot Custom1 = ExpAverage("data" = close, "length" = 8);
then select the aggregation and whether it's RTH or ETH.
Then tried:
plot Custom1 = reference VWAP("num dev dn" = -1.0, "num dev up" = 1.0, "time frame" = "DAY").UpperBand;
This one looks like it should work. But it simply returns the value of VWAP itself (as in reference VWAP() ), not the value of its 1 SD upper band.
Tried the entire script slightly modified to prevent obvious errors, pasted into custom watchlist column definition:
Code:
#input timeFrame = {default DAY, WEEK, MONTH};
def v = reference VWAP("time frame" = "DAY");
def vub1 = reference VWAP("num dev dn" = -1.0, "num dev up" = 1.0, "time frame" = timeFrame).UpperBand;
def vub2 = reference VWAP("time frame" = timeFrame).UpperBand;
def vlb1 = reference VWAP("num dev dn" = -1.0, "num dev up" = 1.0, "time frame" = timeFrame).LowerBand;
def vlb2 = reference VWAP("time frame" = timeFrame).LowerBand;
# This is what should do the job:
plot Custom1 = vub1;
#AddLabel(1, "UB2: " + AsDollars(vub2) + " | UB1: " + AsDollars(vub1), Color.GREEN);
#AddLabel(1, "Vwap: " + AsDollars(v), Color.WHITE);
#AddLabel(1, "LB1: " + AsDollars(vlb1) + " | LB2: " + AsDollars(vlb2), Color.RED);
Once again returns the value of VWAP itself. I must be missing something simple / obvious.