forked from foorbar/tradingview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pp-vwma.txt
47 lines (39 loc) · 2.19 KB
/
pp-vwma.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//@version=3
//The files in this repository are created by me and provided under the MIT License
//located at https://github.com/yield65/tradingview/blob/master/LICENSE
//If you find them useful please consider making a donation, thank you.
//Bitcoin: 3F636VrPCdnbfrdP5kS4C6fHWVBffXNKCu
//Litecoin: M9MBLWAC4puDxuqs4KfgSa216q1chLuaps
//contact: [email protected]
study(title="PP-VWMA", precision=2)
shortlen = input(8, minval=1, title="Short Lenght")
longlen = input(34, minval=1, title="Long Lenght")
signallen = input(13, minval=1, title="Signal (ALMA)")
smooth = input(0, title="ALMA smooth", minval=0, maxval=5, step=1)
showhist = input(false, type=bool, title="Show Histogram?")
showxo = input(false, title="Show crossings?")
hullma(_src, _length)=>
_return = wma((2 * wma(_src, _length / 2)) - wma(_src, _length), round(sqrt(_length)))
price = close
offset = 0.85
sigma = 6
short = vwma(price, shortlen)
long = vwma(price, longlen)
osc_line = 100 * (short - long) / long
osc = smooth > 0 ? alma(osc_line, smooth, offset, sigma) : osc_line
osc_signal = alma(osc, signallen, offset, sigma)
osc_hist = osc - osc_signal
forestgreen = #228B22
crimson = #DC143C
darkorange = #FF8C00
belowsignal = osc <= osc_signal
ppocolorh = belowsignal and osc_hist >= osc_hist[1] ? maroon : belowsignal and osc_hist < osc_hist[1] ? crimson : osc_hist < osc_hist[1] ? forestgreen : lime
osc_color = belowsignal ? crimson : forestgreen
crossing_u = crossover(osc, osc_signal)
crossing_d = crossunder(osc, osc_signal)
plot(showhist ? osc_hist : na, color=ppocolorh, style=histogram, linewidth=4, transp=0, editable=false, title="Histogram")
hline(0, 'Zero', linestyle=dashed, linewidth=1, color=#7B68EE, editable=false)
plot(osc, color=osc_color, linewidth=2, transp=0, style=line, editable=true, title="PP-VWMA")
plot(osc_signal, color=darkorange, linewidth=2, transp=0, style=line, editable=true, title="PP-VWMA Signal")
plotshape(showxo ? crossing_u : na, title="Dot mark Up", style=shape.arrowup, location=location.top, color=forestgreen, transp=0, size=size.tiny, editable=false)
plotshape(showxo ? crossing_d : na, title="Dot mark Down", style=shape.arrowdown, location=location.bottom, color=crimson, transp=0, size=size.tiny, editable=false)