Join useThinkScript to post your question to a community of 21,000+ developers and traders.
input anchorDate = 20190701;
input anchorTime = 0930;
def postAnchorDate = if GetYYYYMMDD() >= anchorDate then 1 else 0;
def postAnchorTime = if SecondsFromTime(anchorTime) >= 0 then 1 else 0;
plot anchoredVWAP = TotalSum(if postAnchorDate and postAnchorTime then ((high+low+close)/3)*(volume) else 0)/TotalSum(if postAnchorDate and postAnchorTime then volume else 0);
anchoredVWAP.setStyle(Curve.Firm);
anchoredVWAP.SetLineWeight(3);
anchoredVWAP.SetDefaultColor(Color.Cyan);
def anchorDATE = lookuphighest(barNumber(),high,252);
def postAnchorDate = if GetYYYYMMDD() >= anchorDATE then 1 else 0;
def anchoredVWAP = TotalSum(if postAnchorDate then ((high + low + close) / 3) * (volume) else 0) / TotalSum(if postAnchorDate then volume else 0);
plot AVWAP = anchoredVWAP;
#yakBro intraday anchoredVWAP excluding extended hours volume 2019
#barbaros stddev channels 05.12.2020
declare hide_on_daily;
def anchorTime = 0930;
def anchorEnd = 1600;
input ShowTodayOnly = yes;
def Today = if GetDay() == GetLastDay() then 1 else 0;
def postAnchorTime = if SecondsFromTime(anchorTime) >= 0 then 1 else 0;
def endAchorTime = if SecondsTillTime(anchorEnd) >= 0 then 1 else 0;
#plot anchorVWAP for intraday
def count = compoundValue(1, if postAnchorTime and endAchorTime then 1 else 0, 1);
def volumeSum = compoundValue(1, if postAnchorTime and endAchorTime then volumeSum[1] + volume else 0, volume);
def volumeVwapSum = compoundValue(1, if postAnchorTime and endAchorTime then volumeVwapSum[1] + volume * vwap else 0, volume * vwap);
plot anchorVWAP = if ShowTodayOnly and !Today then Double.NaN else if anchorTime then volumeVwapSum / volumeSum else Double.NaN;
anchorVWAP.setStyle(Curve.Firm);
anchorVWAP.setDefaultColor(Color.light_ORANGE);
anchorVWAP.setlineWeight(2);
def aVWAP = Average(anchorVWAP);
def sVWAP = fold n = 0 to count with s do Sqr(GetValue(anchorVWAP,n) - aVWAP);
def stdVWAP = Sqrt(sVWAP/count);
AddLabel(yes, stdVWAP, Color.GRAY);
input deviations = 2.0;
plot UpperLine = anchorVWAP + deviations * stdVWAP;
plot LowerLine = anchorVWAP - deviations * stdVWAP;
UpperLine.SetDefaultColor(GetColor(8));
LowerLine.SetDefaultColor(GetColor(8));
@barbaros Thank you but that did not work. The anchor must be 6 pm EST the previous evening. The lines are stuck to each other.
def aVWAP = Average(anchorVWAP);
def sVWAP = fold n = 0 to count with s do Sqr(GetValue(anchorVWAP,n) - aVWAP);
def stdVWAP = Sqrt(sVWAP/count);
AddLabel(yes, stdVWAP, Color.GRAY);
input deviations = 2.0;
plot UpperLine = anchorVWAP + deviations * stdVWAP;
plot LowerLine = anchorVWAP - deviations * stdVWAP;
UpperLine.SetDefaultColor(GetColor(8));
LowerLine.SetDefaultColor(GetColor(8));
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
J | High/Low Anchored VWAP For ThinkOrSwim | Indicators | 16 | |
RSI (or MACD) with VWAP & MA & div for ThinkOrSwim | Indicators | 11 | ||
Opening Range Indicator with Measured Moves and VWAP For ThinkOrSwim | Indicators | 43 | ||
RSI-VWAP Indicator for ThinkorSwim | Indicators | 68 | ||
Squeeze Clouds based on SMA and VWAP | Indicators | 7 |
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.