OK...so I finally got the watchlist column to follow and show when price is above or below the VWAP....
Problem:
The font changes color and background stays black. It's soooo much easier if the background changed colors not the text. I tried to re-program the colors but keep getting errors....
Anyways.....here is the code for the one I have, that so far worked 100% for me showing price above VWAP:
#VWAP_Label
input numDevDn = -2.0;
input numDevUp = 2.0;
input timeFrame = {default DAY, WEEK, MONTH};
input time = yes;
input time_color = {default "magenta", "green", "pink", "cyan", "orange", "red", "blue", "gray", "violet"};
input VWAP_label = yes;
input VWAP_Color = {default "magenta", "green", "pink", "cyan", "orange", "red", "blue", "gray", "violet"};
input Upperbands_label = Yes;
input UpperBand_Color = {default "magenta", "green", "pink", "cyan", "orange", "red", "blue", "gray", "violet"};
input Lowerbands_label = Yes;
input LowerBand_color = {default "magenta", "green", "pink", "cyan", "orange", "red", "blue", "gray", "violet"};
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 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;
UpperBand.hide();
plot LowerBand = price + numDevDn * deviation;
LowerBand.hide();
AddLabel(VWAP_label, " VWAP: " + Round(VWAP, 2), if vwap<close then color.green else color.red);
And here is what I would love to see would look like!!!!! Can't figure it out......Matter of fact, I just want the colored label, preferably no text at all....it's a visual thing...like traffic lights
input fastMALength = 21;
input slowMALength = 55;
input averageTypeFast = AverageType.Exponential;
input averageTypeSlow = AverageType.Exponential;
def fastMA = MovingAverage(averageTypeFast, close, fastMALength);
def slowMA = MovingAverage(averageTypeSlow, close, slowMALength);
def above = close > fastMA and close > slowMA;
def below = close < fastMA and close < slowMA;
AddLabel(1, if above then "Above" else if below then "Below" else "Between",color.black);
AssignBackgroundColor(if above then Color.GREEN else if below then Color.RED else Color.black);
Anybody see this to work? Be fixed?