@whats up Take a look at this article https://www.investopedia.com/terms/v/vwap.asp
#[email protected]
#version 7.29.2020
#modded by theLEMband to use with TOS scan tab
declare lower;
def NA = Double.NaN;
input thresh =50;
input threshWk = 50;
input threshMnth = 50;
def o = open;
def h = high;
def l = low;
def c = close;
#VWAP Daily, Weekly, and Monthly
input tframe = {default "DAY", "WEEK", "MONTH"};
def VWAPDAY = reference VWAP("time frame" = tframe);
#VWAP UpperBand and LowerBand values
def VWAPDAYLB = reference VWAP("num dev dn" = -4.0, "time frame" = "DAY")."LowerBand";
def VWAPDAYHB = reference VWAP("num dev up" = 4.0, "time frame" = "DAY")."UpperBand";
#VWAP Deviation Bands
def VWAPUB = reference VWAP("num dev up" = 4.0, "time frame" = "DAY")."UpperBand";
def VWAPLB = reference VWAP("num dev dn" = -4.0, "time frame" = "DAY")."LowerBand";
input price = close;
input avgType = AverageType.HULL;
input avgLength = 5;
def VWDayBP = c - VWAPLB;
def VWDaySP = VWAPUB - c;
def VWDayBPh= h - VWAPLB;
def VWDaySPh = VWAPUB - h;
def VWDayBPl = l - VWAPLB;
def VWDaySPl = VWAPUB - l;
def VWDayRange = VWAPUB - VWAPLB;
#VWDayRange.Hide();
def VWDayBandWidthU = ((VWAPUB - VWAPLB)/VWAPDAY)*1000;
def VWDayBandWidthD = ((VWAPLB - VWAPUB)/VWAPDAY)*1000;
def VWAPDayZh1 = MovingAverage(avgType,(((VWDayBPh - VWDaySPh)/(VWDayRange))*100),avgLength);
def VWAPDayZl1 = MovingAverage(avgType,(((VWDayBPl - VWDaySPl)/(VWDayRange))*100),avgLength);
def VWAPDayZc1 = MovingAverage(avgType,(((VWDayBP - VWDaySP)/(VWDayRange))*100),avgLength);
def VWAPDayZh = if AbsValue(VWAPDayZh1) > 120 then NA else VWAPDayZh1;
def VWAPDayZl = if AbsValue(VWAPDayZl1) > 120 then NA else VWAPDayZl1;
plot VWAPDayZc = if AbsValue(VWAPDayZc1) > 120 then NA else VWAPDayZc1;
VWAPDayZc.Hide();
def bb = VWAPDayZc > VWAPDayZc[1];
plot VWAPDaytopsig = if VWAPDayZc >= threshWk then 100 else NA;
plot VWAPDaybotsig = if VWAPDayZc <= -threshWk then -100 else NA;
It's a translation of the script from Tradingview. The math itself is to find the z-score. It then changes to moving average of the z-scores for the period. I may not be saying it correctly, have yet to hit the coffee. But yeah, it's out right Stat 101 mathematical calculation of z-score in the bars and then an MA on top of that to show proximity.@megahead34 I think VicD has done some crazy math calculations and is coming up with some sort of 20 bar average of the VWAP, it is not a Z score of the VWAP. Your description of a Z score as far as I understand is correct.
#posted by @bp805
#edited by @mjlinhle
declare lower;
input anchorDate = 20200820;
input barsGoBack = 120;
#Zero
input showStopLabelZero = yes;
input devStopZero = {default Zero};# {default One, Two, Three, Zero, NegOne, NegTwo, NegThree, Custom}
#One
input showStopLabelOne = yes;
input devStopOne = {default One};
#Two
input showStopLabelTwo = yes;
input devStopTwo = {default Two};
#Three
input showStopLabelThree = yes;
input devStopThree = {default Three};
#NegOne
input showStopLabelNegOne = yes;
input devStopNegOne = {default NegOne};
#NegTwo
input showStopLabelNegTwo = yes;
input devStopNegTwo = {default NegTwo};
#***NegThree
input showStopLabelNegThree = yes;
input devStopNegThree = {default NegThree};
#***custom
input showStopLabelCustom = yes;
input devStopCustom = {default Custom};
input customDev = 0.15;
def postAnchorDate = if GetYYYYMMDD() >= anchorDate then 1 else 0;
def yyyyMmDd = GetYYYYMMDD();
def periodIndx = if GetAggregationPeriod() < AggregationPeriod.HOUR then yyyyMmDd else postAnchorDate;
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 VScore = if (((price - close) * (-1)) / deviation) > 5 or (((price - close) * (-1)) / deviation) < -5 then 0 else (((price - close) * (-1)) / (deviation));
plot zero = 0;
plot one = 1;
plot two = 2;
plot three = 3;
plot negOne = -1;
plot negTwo = -2;
plot negThree = -3;
plot posInt = 0.3;
plot negInt = -0.3;
#Zero
def stopPriceZero = (0) * (deviation) + (price);
AddLabel(showStopLabelZero, "Price at [" + 0 + "] SD: " + AsPrice(Round(stopPriceZero, 2)), Color.WHITE);
#One
def stopPriceOne = (1) * (deviation) + (price);
AddLabel(showStopLabelOne, "Price at [" + 1 + "] SD: " + AsPrice(Round(stopPriceOne, 2)), Color.WHITE);
#Two
def stopPriceTwo = (2) * (deviation) + (price);
AddLabel(showStopLabelTwo, "Price at [" + 2 + "] SD: " + AsPrice(Round(stopPriceTwo, 2)), Color.WHITE);
#Three
def stopPriceThree = (3) * (deviation) + (price);
AddLabel(showStopLabelThree, "Price at [" + 3 + "] SD: " + AsPrice(Round(stopPriceThree, 2)), Color.WHITE);
#NegOne
def stopPriceNegOne = (-1) * (deviation) + (price);
AddLabel(showStopLabelNegOne, "Price at [" + -1 + "] SD: " + AsPrice(Round(stopPriceNegOne, 2)), Color.WHITE);
#NegTwo
def stopPriceNegTwo = (-2) * (deviation) + (price);
AddLabel(showStopLabelNegTwo, "Price at [" + -2 + "] SD: " + AsPrice(Round(stopPriceNegTwo, 2)), Color.WHITE);
#NegThree
def stopPriceNegThree = (-3) * (deviation) + (price);
AddLabel(showStopLabelNegThree, "Price at [" + -3 + "] SD: " + AsPrice(Round(stopPriceNegThree, 2)), Color.WHITE);
def zeroAndOne = if VScore > zero and VScore <= one then 1 else 0;
def oneAndTwo = if VScore > one and VScore <= two then 1 else 0;
def twoAndThree = if VScore > two and VScore <= three then 1 else 0;
def negZeroAndOne = if VScore > negOne and VScore < zero then 1 else 0;
def negOneAndTwo = if VScore > negTwo and VScore <= negOne then 1 else 0;
def negTwoAndThree = if VScore > negThree and VScore <= negTwo then 1 else 0;
def cloud1;
def cloud2;
if Sum(zeroAndOne, barsGoBack) > Sum(oneAndTwo, barsGoBack) and Sum(zeroAndOne, barsGoBack) > Sum(twoAndThree, barsGoBack) and Sum(zeroAndOne, barsGoBack) > Sum(negZeroAndOne, barsGoBack) and Sum(zeroAndOne, barsGoBack) > Sum(negOneAndTwo, barsGoBack) and Sum(zeroAndOne, barsGoBack) > Sum(negTwoAndThree, barsGoBack) {
cloud1 = zero;
cloud2 = one;
}
else if Sum(oneAndTwo, barsGoBack) > Sum(zeroAndOne, barsGoBack) and Sum(oneAndTwo, barsGoBack) > Sum(twoAndThree, barsGoBack) and Sum(oneAndTwo, barsGoBack) > Sum(negZeroAndOne, barsGoBack) and Sum(oneAndTwo, barsGoBack) > Sum(negOneAndTwo, barsGoBack) and Sum(oneAndTwo, barsGoBack) > Sum(negTwoAndThree, barsGoBack) {
cloud1 = one;
cloud2 = two;
}
else if Sum(twoAndThree, barsGoBack) > Sum(zeroAndOne, barsGoBack) and Sum(twoAndThree, barsGoBack) > Sum(oneAndTwo, barsGoBack) and Sum(twoAndThree, barsGoBack) > Sum(negZeroAndOne, barsGoBack) and Sum(twoAndThree, barsGoBack) > Sum(negOneAndTwo, barsGoBack) and Sum(twoAndThree, barsGoBack) > Sum(negTwoAndThree, barsGoBack) {
cloud1 = two;
cloud2 = three;
}
else if Sum(negZeroAndOne, barsGoBack) > Sum(zeroAndOne, barsGoBack) and Sum(negZeroAndOne, barsGoBack) > Sum(oneAndTwo, barsGoBack) and Sum(negZeroAndOne, barsGoBack) > Sum(twoAndThree, barsGoBack) and Sum(negZeroAndOne, barsGoBack) > Sum(negOneAndTwo, barsGoBack) and Sum(negZeroAndOne, barsGoBack) > Sum(negTwoAndThree, barsGoBack) {
cloud1 = zero;
cloud2 = negOne;
}
else if Sum(negOneAndTwo, barsGoBack) > Sum(zeroAndOne, barsGoBack) and Sum(negOneAndTwo, barsGoBack) > Sum(oneAndTwo, barsGoBack) and Sum(negOneAndTwo, barsGoBack) > Sum(twoAndThree, barsGoBack) and Sum(negOneAndTwo, barsGoBack) > Sum(negZeroAndOne, barsGoBack) and Sum(negOneAndTwo, barsGoBack) > Sum(negTwoAndThree, barsGoBack) {
cloud1 = negOne;
cloud2 = negTwo;
}
else if Sum(negTwoAndThree, barsGoBack) > Sum(zeroAndOne, barsGoBack) and Sum(negTwoAndThree, barsGoBack) > Sum(oneAndTwo, barsGoBack) and Sum(negTwoAndThree, barsGoBack) > Sum(twoAndThree, barsGoBack) and Sum(negTwoAndThree, barsGoBack) > Sum(negZeroAndOne, barsGoBack) and Sum(negTwoAndThree, barsGoBack) > Sum(negOneAndTwo, barsGoBack) {
cloud1 = negTwo;
cloud2 = negThree;
}
else {
cloud1 = Double.NaN;
cloud2 = Double.NaN;
}
AddCloud(cloud1, cloud2, Color.LIGHT_RED, Color.LIGHT_GREEN);
plot BullSignal = if (cloud1 == one or cloud2 == one or cloud1 == two or cloud2 == two or cloud1 == three or cloud2 == three) and (VScore <= 0.3 and VScore[1] > 0) and CCI() > -100 then -2 else Double.NaN;
plot BearSignal = if (cloud1 == negOne or cloud2 == negOne or cloud1 == negTwo or cloud2 == negTwo or cloud1 == negThree or cloud2 == negThree) and (VScore >= 0.3 and VScore[1] < 0) and CCI() < 100 then 2 else Double.NaN;
BullSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
BearSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
BullSignal.SetLineWeight(3);
BearSignal.SetLineWeight(3);
input soundAlertsOn = no;
Alert((cloud1 == one or cloud2 == one or cloud1 == two or cloud2 == two or cloud1 == three or cloud2 == three) and (VScore <= 0 and VScore[1] > 0) and (soundAlertsOn), "Bullish VScore Entry", Alert.BAR);
Alert((cloud1 == negOne or cloud2 == negOne or cloud1 == negTwo or cloud2 == negTwo or cloud1 == negThree or cloud2 == negThree) and (VScore >= 0 and VScore[1] < 0) and (soundAlertsOn), "Bearish VScore Entry", Alert.BAR);
Welkin, could you please share the chart above with a link above? It seems that the code above shows the difference result from your chart in a lower study. Thank you very much.Just saw this thread. I don't know about the easycator's vwap strat or zscore indicator but I've made something similar that I've based on the vwap deviations indicator that I use. I guess you could consider this a companion to that indicator. I look for daily VWAP 2nd devs to be outside of weekly 2nd deviations and weekly 2nd deviations to be outside of the monthly 2nd deviations. I've found when price is outside of these boundaries there can be a high probability to make a large push back towards the weekly/monthly vwaps. I made this a while ago but come back to it every now and then to make some tweaks. Maybe this can give you some ideas.
A few notes:
this is best used with extended trading hours turned on
the candles are hull MAs based on the high/low/close position relative to the daily VWAP deviations
the orange and red lines are hull MA's based on the close position relative to the weekly/monthy VWAP deviations
0 = VWAP for daily(candles)/weekly(orange line)/monthly(red line)
+/- 25 is = 1st deviation
+/- 50 is = 2nd deviation
+/- 75 is = 3rd deviation
+/- 100 is = 4th deviation
when price is below or above 2nd deviations (+/- 50) a magenta dot (daily) orange dot(weekly) or red dot (monthly) will plot at the top or bottom.
when price touches the daily/weekly/monthly vwap a magenta/orange/red dot will plot on the 0 line
if daily vwap is above or below 2nd deviations dark gray vertical lines will plot
Code:#[email protected] #version 7.29.2020 declare lower; def NA = Double.NaN; input thresh =50; input threshWk = 50; input threshMnth = 50; def o = open; def h = high; def l = low; def c = close; DefineGlobalColor("Bullish", CreateColor(0,100,200)); DefineGlobalColor("Bearish", Color.YELLOW); #VWAP Daily, Weekly, and Monthly def VWAPDAY = reference VWAP("time frame" = "DAY"); def VWAPWK = reference VWAP("time frame" = "WEEK"); def VWAPMNTH = reference VWAP("time frame" = "MONTH"); #VWAP UpperBand and LowerBand values def VWAPDAYLB = reference VWAP("num dev dn" = -4.0, "time frame" = "DAY")."LowerBand"; def VWAPWKLB = reference VWAP("num dev dn" = -4.0, "time frame" = "WEEK")."LowerBand"; def VWAPMNTHLB = reference VWAP("num dev dn" = -4.0, "time frame" = "MONTH")."LowerBand"; def VWAPDAYHB = reference VWAP("num dev up" = 4.0, "time frame" = "DAY")."UpperBand"; def VWAPWKHB = reference VWAP("num dev up" = 4.0, "time frame" = "WEEK")."UpperBand"; def VWAPMNTHHB = reference VWAP("num dev up" = 4.0, "time frame" = "MONTH")."UpperBand"; #VWAP Deviation Bands def VWAPUB = reference VWAP("num dev up" = 4.0, "time frame" = "DAY")."UpperBand"; def VWAPLB = reference VWAP("num dev dn" = -4.0, "time frame" = "DAY")."LowerBand"; ############################## input price = close; input avgType = AverageType.HULL; input avgLength = 5; def VWDayBP = c - VWAPLB; def VWDaySP = VWAPUB - c; def VWDayBPh= h - VWAPLB; def VWDaySPh = VWAPUB - h; def VWDayBPl = l - VWAPLB; def VWDaySPl = VWAPUB - l; def VWDayRange = VWAPUB - VWAPLB; #VWDayRange.Hide(); def VWDayBandWidthU = ((VWAPUB - VWAPLB)/VWAPDAY)*1000; def VWDayBandWidthD = ((VWAPLB - VWAPUB)/VWAPDAY)*1000; def VWWkBP = c - VWAPWKLB; def VWWkSP = VWAPWKHB - c; def VWWkBPh = h - VWAPWKLB; def VWWkSPh = VWAPWKHB - h; def VWWkBPl = l - VWAPWKLB; def VWWkSPl = VWAPWKHB - l; def VWWkRange = VWAPWKHB - VWAPWKLB; def VWMnthBP = c - VWAPMNTHLB; def VWMnthSP = VWAPMNTHHB - c; def VWMnthBPh = h - VWAPMNTHLB; def VWMnthSPh = VWAPMNTHHB - h; def VWMnthBPl = l - VWAPMNTHLB; def VWMnthSPl = VWAPMNTHHB - l; def VWMnthRange = VWAPMNTHHB - VWAPMNTHLB; def VWAPDayZh1 = MovingAverage(avgType,(((VWDayBPh - VWDaySPh)/(VWDayRange))*100),avgLength); def VWAPDayZl1 = MovingAverage(avgType,(((VWDayBPl - VWDaySPl)/(VWDayRange))*100),avgLength); def VWAPDayZc1 = MovingAverage(avgType,(((VWDayBP - VWDaySP)/(VWDayRange))*100),avgLength); def VWAPDayZh = if AbsValue(VWAPDayZh1) > 120 then NA else VWAPDayZh1; def VWAPDayZl = if AbsValue(VWAPDayZl1) > 120 then NA else VWAPDayZl1; plot VWAPDayZc = if AbsValue(VWAPDayZc1) > 120 then NA else VWAPDayZc1; VWAPDayZc.Hide(); def bb = VWAPDayZc > VWAPDayZc[1]; def VWAPWkZ1 = MovingAverage(avgType,(((VWWkBP - VWWkSP)/(VWWkRange))*100),avgLength); plot VWAPWkZ = if AbsValue(VWAPWkZ1) > 120 then NA else VWAPWkZ1; def VWAPWkZh1 = MovingAverage(avgType,(((VWWkBPh - VWWkSPh)/(VWWkRange))*100),avgLength); def VWAPWkZl1 = MovingAverage(avgType,(((VWWkBPl - VWWkSPl)/(VWWkRange))*100),avgLength); def VWAPWkZh = if AbsValue(VWAPWkZh1) > 120 then NA else VWAPWkZh1; def VWAPWkZl = if AbsValue(VWAPWkZl1) > 120 then NA else VWAPWkZl1; def VWAPMnthZ1 = MovingAverage(avgType,(((VWMnthBP - VWMnthSP)/(VWMnthRange))*100),avgLength); plot VWAPMnthZ = if AbsValue(VWAPMnthZ1) > 120 then NA else VWAPMnthZ1; def VWAPMnthZh1 = MovingAverage(avgType,(((VWMnthBPh - VWMnthSPh)/(VWMnthRange))*100),avgLength); def VWAPMnthZl1 = MovingAverage(avgType,(((VWMnthBPl - VWMnthSPl)/(VWMnthRange))*100),avgLength); def VWAPMnthZh = if AbsValue(VWAPMnthZh1) > 120 then NA else VWAPMnthZh1; def VWAPMnthZl = if AbsValue(VWAPMnthZl1) > 120 then NA else VWAPMnthZl1; VWAPWkZ.SetHiding(VWAPWkZ == VWAPDayZc); AddChart(VWAPDayZh,VWAPDayZl,if bb then VWAPDayZl else NA,VWAPDayZc,ChartType.CANDLE, GlobalColor("Bullish")); AddChart(VWAPDayZh,VWAPDayZl,if !bb then VWAPDayZh else NA,VWAPDayZc,ChartType.CANDLE, GlobalColor("Bearish")); AddVerticalLine((AbsValue(VWAPDayZh) >= thresh) or (AbsValue(VWAPDayZl) >= thresh) or (AbsValue(VWAPDayZc) >= thresh),"", Color.DARK_GRAY, Curve.POINTS); plot VWAPDaytopsig = if VWAPDayZc >= threshWk then 100 else NA; plot VWAPDaybotsig = if VWAPDayZc <= -threshWk then -100 else NA; plot VWAPWktopsig = if VWAPWkZ >= threshWk then 100 else NA; plot VWAPWkbotsig = if VWAPWkZ <= -threshWk then -100 else NA; plot VWAPMnthtopsig = if VWAPMnthZ >= threshMnth then 100 else NA; plot VWAPMnthbotsig = if VWAPMnthZ <= -threshMnth then -100 else NA; plot Dev1Pos = 25; plot Dev1Neg = -25; plot Dev2Pos = 50; plot Dev2Neg = -50; plot Dev3Pos = 75; plot Dev3Neg = -75; plot Dev4Pos = 100; plot Dev4Neg = -100; plot zero = 0; zero.SetLineWeight(3); zero.SetDefaultColor(Color.BLUE); def VWAPtestD = VWAPDayZl <= 0 and VWAPDayZh >= 0; def VWAPtestW = VWAPWkZl <= 0 and VWAPWkZh >= 0; def VWAPtestM = VWAPMnthZl <= 0 and VWAPMnthZh >= 0; plot VWAPztestD = if VWAPtestD then 0 else NA; plot VWAPztestW = if VWAPtestW then 0 else NA; plot VWAPztestM = if VWAPtestM then 0 else NA; def VWAPDev1PosTest = VWAPDayZl <= Dev1Pos and VWAPDayZh >= Dev1Pos; def VWAPDev1NegTest = VWAPDayZl <= Dev1Neg and VWAPDayZh >= Dev1Neg; def VWAPDev2PosTest = VWAPDayZl <= Dev2Pos and VWAPDayZh >= Dev2Pos; def VWAPDev2NegTest = VWAPDayZl <= Dev2Neg and VWAPDayZh >= Dev2Neg; def VWAPDev3PosTest = VWAPDayZl <= Dev3Pos and VWAPDayZh >= Dev3Pos; def VWAPDev3NegTest = VWAPDayZl <= Dev3Neg and VWAPDayZh >= Dev3Neg; def VWAPDev4PosTest = VWAPDayZl <= Dev4Pos and VWAPDayZh >= Dev4Pos; def VWAPDev4NegTest = VWAPDayZl <= Dev4Neg and VWAPDayZh >= Dev4Neg; zero.SetDefaultColor(Color.BLUE); VWAPztestD.SetDefaultColor(Color.MAGENTA); VWAPztestW.SetDefaultColor(Color.DARK_ORANGE); VWAPztestM.SetDefaultColor(Color.RED); VWAPztestD.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPztestW.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPztestM.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPztestD.SetLineWeight(1); VWAPztestW.SetLineWeight(3); VWAPztestM.SetLineWeight(5); Dev1Pos.SetDefaultColor(Color.DARK_GRAY); Dev1Neg.SetDefaultColor(Color.DARK_GRAY); Dev2Pos.SetDefaultColor(Color.DARK_GRAY); Dev2Neg.SetDefaultColor(Color.DARK_GRAY); Dev3Pos.SetDefaultColor(Color.DARK_GRAY); Dev3Neg.SetDefaultColor(Color.DARK_GRAY); Dev4Pos.SetDefaultColor(Color.RED); Dev4Neg.SetDefaultColor(Color.GREEN); VWAPDayZc.SetDefaultColor(Color.YELLOW); VWAPWkZ.SetDefaultColor(Color.DARK_ORANGE); VWAPWkZ.SetLineWeight(2); VWAPMnthZ.SetDefaultColor(Color.RED); VWAPMnthZ.SetLineWeight(2); #VWDayBandWidthU.SetDefaultColor(Color.GRAY); #VWDayBandWidthD.SetDefaultColor(Color.GRAY); VWAPDaytopsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPDaybotsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPDaytopsig.SetDefaultColor(Color.MAGENTA); VWAPDaybotsig.SetDefaultColor(Color.MAGENTA); VWAPWktopsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPWkbotsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPWktopsig.SetDefaultColor(Color.DARK_ORANGE); VWAPWkbotsig.SetDefaultColor(Color.DARK_ORANGE); VWAPWktopsig.SetLineWeight(3); VWAPWkbotsig.SetLineWeight(3); VWAPMnthtopsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPMnthbotsig.SetPaintingStrategy(PaintingStrategy.POINTS); VWAPMnthtopsig.SetDefaultColor(Color.RED); VWAPMnthbotsig.SetDefaultColor(Color.RED); VWAPMnthtopsig.SetLineWeight(5); VWAPMnthbotsig.SetLineWeight(5);
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @Welkin has not been seen in a long while.Welkin, could you please share the chart above with a link above? It seems that the code above shows the difference result from your chart in a lower study. Thank you very much.
@Harleym2009 Not really an indicator setup. Just a few examples to show deviation from the VWAP as someone had asked about VWAP deviation.
Each study is a different way to show basically the same info. That is deviation of price from the VWAP. The idea would be a larger deviation may result in a reversion. In any deviation from the mean two things can happen, reversion to the mean or mean catches up to the deviation. So price moves back to the VWAP or the VWAP catches up with the price. Nothing is ever certain except at some point the two will come together. So just look those over and see if any can be useful to you. Ask questions about any particular one if you have any.
def VScore = if (((price - close)(-1))/deviation) > 5 or (((price - close)(-1))/deviation) < -5
then 0
else (((price - close)*(-1))/(deviation));
The "VScore" definition was not complete in that post, so it has been taken down.Hi, I pasted this in the thinkScript editor of the custom study filter and am getting an error on the following block of code:
Ruby:def VScore = if (((price - close)(-1))/deviation) > 5 or (((price - close)(-1))/deviation) < -5 then 0 else (((price - close)*(-1))/(deviation));
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Z-Score Probability Indicator for ThinkOrSwim | Indicators | 26 | ||
Z-Score Upper Indicator for ThinkorSwim | Indicators | 43 | ||
Trend Score Indicator for ThinkorSwim | Indicators | 21 | ||
RSI (or MACD) with VWAP & MA & div for ThinkOrSwim | Indicators | 11 | ||
J | High/Low Anchored VWAP For ThinkOrSwim | Indicators | 16 |
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.