#### script help, coding a Weis Wave

``````//@version=3
study("My Script")
deviation = input(title = "Deviation %", type=float, defval = 0.1)
running_vol = 0.0
running_sum = 0.0
Tup = true
Tdown = false

running_vol := nz(volume[1]) == 0 ? 0 : running_vol[1] + volume
running_sum := nz(volume[1]) == 0 ? 0 : running_sum[1] + (close*volume)

volwap = (running_sum/running_vol)

// flip to downtrend
if (Tup == true) and (Tdown == false) and (close < close[1]) and ((1 - (close/volwap)) > (deviation/100.0))
// reset running_vol and sum to current volume and sum since it's a new trend
running_vol := volume
running_sum := (close*volume)
// flip the trend switches
Tup := false
Tdown := true
// flip to uptrend
if (Tup == false) and (Tdown == true) and (close > close[1]) and (((close/volwap) - 1) > (deviation/100.0))
running_vol := volume
running_sum := (close*volume)
Tup := true
Tdown := false

up = Tup == true ? running_vol : 0
down = Tdown == true ? running_vol : 0

plot(up, style=histogram, color=green, linewidth=3)
plot(down, style=histogram, color=red, linewidth=3)
``````
1 个回复

``````//@version=3
// my impression of the Weis VWAP code by Moreina by Jayy
study("Moreina Weis vwap")
deviation = input(title = "Deviation %", type=float, defval = 0.00000000)
running_vol = 0.0
running_sum = 0.0
Tup = 0

count=1
count:= nz(count[1])+1
running_vol := Tup[1]!=Tup[2] and nz(running_vol[1])==nz(volume[1])? nz(running_vol[1]) + volume:  (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_vol[1]) + volume:na
running_sum := Tup[1]!=Tup[2] and nz(running_sum[1])==nz(close[1]*volume[1])? nz(running_sum[1]) + close*volume: (Tup[1]==1 and Tup[2]==1) or (Tup[1]==-1 and Tup[2]==-1)? nz(running_sum[1]) +close* volume:na

volwap = (running_sum/running_vol)

// flip to downtrend
if ((Tup[1] == 1) or (Tup[1] == 0)) and not ((close > close[1]) or (close/volwap)>1) //

// reset running_vol and sum to current volume and sum since it's a new trend
running_vol := volume
running_sum := (close*volume)
// flip the trend switches
Tup := -1

// flip to uptrend
if ((Tup[1] == -1) or (Tup[1] == 0))  and not ((close < close[1]) or ((close/volwap)) <1) //and (close/volwap) > 1)

running_vol := volume
running_sum := (close*volume)
Tup := 1

Tup:= nz(Tup[0])==1 and count>1?Tup[0]:nz(Tup[0])==-1 and count>1?Tup[0]: count>1 and Tup[0]==0?nz(Tup[1]):na//Tup
up = Tup == 1 ? running_vol : na
down = Tup == -1  ? running_vol : na

plot(up, style=histogram, color=green, linewidth=3)
plot(down, style=histogram, color=red, linewidth=3)
``````
1 需要帮助找出WAVE文件的编码

2014-02-27 15:09:33 1 275   wav/ codec
2 Isim Wave窗口中的VHDL编码

2013-09-01 00:54:07 2 433   vhdl
3 Stata编码帮助

2018-11-14 23:56:33 1 97   r/ stata
4 购物车编码帮助

5 请帮忙编码

2021-04-15 14:43:27 0 25   excel
6 DataWeave Transformer帮助进行编码

7 帮助java编码？

2009-11-08 01:16:08 6 10699   java
8 需要有关R编码的帮助

2013-09-30 20:28:36 1 208   r
9 需要帮助PHP编码

2015-08-26 11:28:19 3 121   php