# Your code:
AddLabel(yes, "VWAP EXP Cross", if avgexp > vwap then Color.GREEN else color.RED);
input showBreakoutSignals = no;
plot UpSignal = avgexp crosses above vwap;
plot DownSignal = avgexp crosses below vwap;
# ##############################################################
# Replacement code:
AddLabel(yes, "VWAP Close Cross", if close > vwap then Color.GREEN else color.RED);
input showBreakoutSignals = no;
plot UpSignal = close crosses above vwap;
plot DownSignal = close crosses below vwap;
# HL3 or HL2 can be used instead of close. Play with it and see
Ignore the alerts code....
i am trying to draw a VWAP OPEN line(from 9:30am) ..this does the job but the line is not getting drawn at right point of open...but almost close.
is there anything wrong with this script.... THANKS IN ADVANCE
I want to use this on MTF if possible..mostly using this code on 5m TF
declare hide_on_daily;
input DaysBack = 2;
def days = getday() >= getlastday() - daysback;
def marketOpen = SecondsTillTime(930) == 0;
def vw = if marketOpen then reference vwap() else vw[1];
plot vwap = if days then vw else double.nan;
vwap.setpaintingstrategy(paintingstrategy.horizontal);
AddChartBubble(SecondsTillTime(0930) == 0, vwap, "Open_VWAP", color.white, yes);
Alert(close crosses below vw, "Nearing VWAP OPEN Support", Alert.Bar, Sound.bell);
Alert(close crosses above vw, "Nearing VWAP OPEN Resistance", Alert.Bar, Sound.bell);
Code:script v { input daysback = 2; def ymd = GetYYYYMMDD(); def ok = !IsNaN(close); def capture = ok and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); plot thisDay = (HighestAll(dayCount) - dayCount) ; def marketOpen = SecondsTillTime(930) == 0; def vo = CompoundValue(1, if thisDay == daysback then reference VWAP() else vo[1] , reference VWAP()); def vonan = if IsNaN(close) then vonan[1] else vo; plot voplot = if thisDay <= daysback then vonan else Double.NaN; } def thisday = v().thisday; plot vwap1 = if thisday > 0 or SecondsTillTime(0930) > 0 then Double.NaN else v(1).voplot; vwap1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); plot vwap2 = if thisday > 0 or SecondsTillTime(0930) > 0 then Double.NaN else v(2).voplot; vwap2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); plot vwap3 = if thisday > 0 or SecondsTillTime(0930) > 0 then Double.NaN else v(3).voplot; vwap3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); input bubblemover = 5; def n = bubblemover; def n1 = n + 1; AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap1, "Open\nVWAP1", Color.WHITE, yes); Alert(close crosses below vwap1, "Nearing VWAP1 OPEN Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap1, "Nearing VWAP1 OPEN Resistance", Alert.BAR, Sound.Bell); AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap2, "Open\nVWAP2", Color.WHITE, yes); Alert(close crosses below vwap2, "Nearing VWAP2 OPEN Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap2, "Nearing VWAP1 OPEN Resistance", Alert.BAR, Sound.Bell); AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap3, "Open\nVWAP3", Color.WHITE, yes); Alert(close crosses below vwap3, "Nearing VWAP OPEN3 Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap3, "Nearing VWAP OPEN3 Resistance", Alert.BAR, Sound.Bell);
Thank you so much..tested your script and working perfectly...but can we draw a line from market open time (9:30) instead of getting the line drawn from 4am.. i wanted to test which one is really useful...one from 4am or one from 9:30am for that day.Your code is well scripted. It picks up the vwap where it is on the opening candle, and I seem to think you wanted the vwap open at the start of the day. Also, since you were looking at 'daysback', I assume you wanted those plotted on the current day.
The following code extended each days vwap from the vwap open for the day to the current day and plotted these starting at market open on the current day, extended to the right edge. I plotted the vwap so that you could test that the lines are what you wanted.
Here is the code for the 'Open". The only change to the 'DAY' code posted above is the change to the bubble labeling 'DAY'
Code:script v { input daysback = 2; def ymd = GetYYYYMMDD(); def ok = !IsNaN(close); def capture = ok and ymd != ymd[1]; def dayCount = CompoundValue(1, if capture then dayCount[1] + 1 else dayCount[1], 0); plot thisDay = (HighestAll(dayCount) - dayCount) ; def marketOpen = SecondsTillTime(930) == 0; def vo = CompoundValue(1, if thisDay == daysback and marketopen then reference VWAP() else vo[1] , reference VWAP()); def vonan = if IsNaN(close) then vonan[1] else vo; plot voplot = if thisDay <= daysback then vonan else Double.NaN; } def thisday = v().thisday; plot vwap1 = if thisday == 0 and SecondsTillTime(0930) > 0 then Double.NaN else v(0).voplot; vwap1.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); plot vwap2 = if thisday == 1 and SecondsTillTime(0930) > 0 then Double.NaN else v(1).voplot; vwap2.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); plot vwap3 = if thisday == 2 and SecondsTillTime(0930) > 0 then Double.NaN else v(2).voplot; vwap3.SetPaintingStrategy(PaintingStrategy.HORIZONTAL); input bubblemover = 5; def n = bubblemover; def n1 = n + 1; AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap1, "Open\nVWAP1", Color.WHITE, yes); Alert(close crosses below vwap1, "Nearing VWAP1 OPEN Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap1, "Nearing VWAP1 OPEN Resistance", Alert.BAR, Sound.Bell); AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap2, "Open\nVWAP2", Color.WHITE, yes); Alert(close crosses below vwap2, "Nearing VWAP2 OPEN Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap2, "Nearing VWAP1 OPEN Resistance", Alert.BAR, Sound.Bell); AddChartBubble(IsNaN(close[n]) and !IsNaN(close[n1]), vwap3, "Open\nVWAP3", Color.WHITE, yes); Alert(close crosses below vwap3, "Nearing VWAP OPEN3 Support", Alert.BAR, Sound.Bell); Alert(close crosses above vwap3, "Nearing VWAP OPEN3 Resistance", Alert.BAR, Sound.Bell);
You the MAN...Thanks...will checkSure, since I was interested in your idea, I did both. I have renamed the bubbles to 'DAY' for the lines on the current day based upon the vwap at the start of the days and 'Open" for the vwaps based upon the 0930 bar.
I am not aware of how one would determine with accuracy, the touch value. The best I can recommend is changing the following. I will leave it to you to test to determine whether it will work for you.You the MAN...Thanks...will check
Update: just tested the OPEN VWAP line,...not 100% correct ...if you take nvda today, the line is supposed to be drawn when vwap touched 9:30am ( price was 791:28), but i see the line at 789.21 on 5mins chart....please correct me if I wrong in any sense.
Code:def vo = CompoundValue(1, if thisDay == daysback and marketopen then (reference vwap() + reference vwap()[1])/2 else vo[1] , reference VWAP());
thats fine..but your script also helps A LOT...used that on fridayI am not aware of how one would determine with accuracy, the touch value. The best I can recommend is changing the following. I will leave it to you to test to determine whether it will work for you.
On one of volume label it tells you current volume for that bar . There may be other volume script on here which might work better for what you looking for.Hello my friend s1111,
Thank you very much for the script! It works excellent but...
In the labels of volume, I dont see the total volume per each volume bar
I dont know how to thank you but your/our script is printing money for me for last 3 daysI am not aware of how one would determine with accuracy, the touch value. The best I can recommend is changing the following. I will leave it to you to test to determine whether it will work for you.
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
RSI (or MACD) with VWAP & MA & div for ThinkOrSwim | Indicators | 11 | ||
J | High/Low Anchored VWAP For ThinkOrSwim | Indicators | 16 | |
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.