germanburrito
Active member
i didnt know what to call this so i gave it this name, basically the point of this indicator is to tell you when the stock is trading based on the vwap of the last 50 bars, you can choose 21, 9, or whatever bars you want to look back, the cool thing about this indicator is that as time goes on its constantly moving with the current last 50 bars. the thing to keep in mind is that since price is moving and so is the wvap looking back will not help you to much i believe, the accurate thing that this will show you is the current price with the set current vwap with a lookback period. give it a try, or comment on what could be fixed about this indicator. i think the best ideas is when people share ideas.
Code:
#
# TD Ameritrade IP Company, Inc. (c) 2007-2020
#German_Burrito
declare lower;
input slowLength = 4;
input MACDLength = 9;
input BarsBack = 50;
input averageType = AverageType.EXPONENTIAL;
input showBreakoutSignals = no;
def currentBar = if isnan(close[-1]) and !isnan(close)
then barnumber()
else currentBar[1];
def barCount = if barnumber()== 1
then highestall(currentBar)
else if barCount[1] > 1
then barCount[1] - 1
else 0;
plot count = if barCount == BarsBack then barCount else double.nan;
count.SetPaintingStrategy(PaintingStrategy.Values_Below);
plot Number1 = if barCount == barsBack then low - (3* TickSize()) else double.nan;
Number1.SetStyle(Curve.Points);
Number1.SetLineWeight(5);
Number1.SetDefaultColor(Color.Pink);
def LocH = (hl2) * volume;
def LocL = (hl2) * volume;
rec PH;
rec VH;
if count {
PH = LocH;
VH = volume;
} else {
PH = compoundValue(1, LocH + PH[1], Double.NaN);
VH = compoundValue(1, volume + VH[1], Double.NaN);
}
DEF Vw = PH / VH;
plot Value = MovingAverage(averageType, close, slowLength)-vw;
plot Avg = MovingAverage(averageType, Value, MACDLength);
plot Diff =50* (Value - Avg);
plot ZeroLine = 0;
plot UpSignal = if Diff crosses above ZeroLine then ZeroLine else Double.NaN;
plot DownSignal = if Diff crosses below ZeroLine then ZeroLine else Double.NaN;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
Value.SetDefaultColor(GetColor(1));
Avg.SetDefaultColor(GetColor(8));
Diff.SetDefaultColor(GetColor(5));
Diff.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Diff.SetLineWeight(3);
Diff.DefineColor("Positive and Up", Color.GREEN);
Diff.DefineColor("Positive and Down", Color.DARK_GREEN);
Diff.DefineColor("Negative and Down", Color.RED);
Diff.DefineColor("Negative and Up", Color.DARK_RED);
Diff.AssignValueColor(if Diff >= 0 then if Diff > Diff[1] then Diff.Color("Positive and Up") else Diff.Color("Positive and Down") else if Diff < Diff[1] then Diff.Color("Negative and Down") else Diff.Color("Negative and Up"));
ZeroLine.SetDefaultColor(GetColor(0));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
COUNT.Hide();
NUMBER1.Hide();
VALUE.Hide();