TheYangGuizi

Percent Difference Between VWAP and Price MTF

Shows the difference between vwap and price in percent.
You can can choose between multiple timeframe vwap . Default is normal daily.
The levels on the indicator can be changed to whatever you want to.

In the chart above we can see eurusd reverting up at 3% below monthly vwap , after the brexit dip, It then turns down again at 1% from monthly and lastly it turns up again at 2% from monthly.

Script is a small modification of this:
Open-source Skript

Ganz im Sinne von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es verstehen und überprüfen können. Ein Hoch auf den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln. Sie können das Skript den Favoriten hinzufügen, um es auf dem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?
study(title="Percent difference between price and vwap")


TimeFrame = input('D')
start = security(tickerid, TimeFrame, time)

newSession = iff(change(start), 1, 0)

vwapsum = iff(newSession, hl2*volume, vwapsum[1]+hl2*volume)
volumesum = iff(newSession, volume, volumesum[1]+volume)
v2sum = iff(newSession, volume*hl2*hl2, v2sum[1]+volume*hl2*hl2)
myvwap = vwapsum/volumesum


src=input(close)
xSMA = myvwap
nRes = abs(src - xSMA) * 100 / src
plot(nRes, color=navy, style=histogram, histbase=0, title="PD MA")

level1=input(1.28)
level2=input(2.1)
level3=input(2.5)
level4=input(3.09)
level5=input(4.1)

hline(0, title="Base Line", color=black, linestyle=solid)
a=hline(level1, title="1", color=lime, linestyle=dotted)
b=hline(level2, title="2", color=orange, linestyle=dotted)
c=hline(level3, title="3", color=orange, linestyle=dotted)
d=hline(level4, title="4", color=red, linestyle=dotted)
e=hline(level5, title="5", color=maroon, linestyle=dotted)

Kommentare

By the way, st the moment the indicator just goes upwards to show % percent difference.

No matter if the price is x% percent above or below vwap.

I'd like to make so it goes downwards if price is below vwap and upwards if price is above. If any coder knows how, please send me a message/post comment :)
+1 Antworten
I was thinking to code this and fortunately came across your script. Saved me some time! Thanks.
Did this help you build any successful strategy?
I am planning to create a good entry strategy in major large cap stocks by using this signal (> 1% downwards) in SPX.
What is your opinion on that?
Antworten