Weis Wave Volume indicator (WWV)
betaDescription
Weis Wave Volume indicator (WWV)
Direction and volume shown on basis of IsRising / IsFalling regarding used lookback value
(So far not made as custom command, but you are welcome to make it better and share an update)
HaasScript
-- Author of haasscript version: Bunka
-- Weis Wave Volume - WWV
--original by LazyBear (TV)
--study("Weis Wave Volume [LazyBear]", shorttitle="WWV_LB")
trendDetectionLength = Input("trend Detection Length",2,"2 or more consecutive bars in a direction will trigger trend direction change")
c = ClosePrices()
v = GetVolume()
mov = Load("mov", HNC(2,0))
mov = ArrayUnshift(mov, IfElseIf(c[1] > c[2], c[1] < c[2], 1, -1, 0))
mov = ArrayPop(mov)
trend = Load("trend",HNC(2,0))
trend = ArrayUnshift(trend, IfElse(NotEquals(mov, 0), ArrayGet(mov,1), ArrayGet(trend,1)))
trend = ArrayPop(trend)
isTrending = IsRising(c, trendDetectionLength) or IsFalling(c, trendDetectionLength)
wave = Load("wave",HNC(2,0))
wave = ArrayUnshift(wave,IfElse(NotEquals(ArrayGet(trend,1), ArrayGet(wave,1)) and isTrending, ArrayGet(trend,1), ArrayGet(wave,1)))
wave = ArrayPop(wave)
vol = Load("vol",HNC(2,0))
vol = ArrayUnshift(vol,IfElse(wave[1] == wave[2], ArrayGet(vol,1) + ArrayGet(v,1), ArrayGet(v,1)))
vol = ArrayPop(vol)
up = IfElse(wave == 1, ArrayGet(vol,1), 0)
dn = IfElseIf(wave == 1, wave == -0, 0, -ArrayGet(vol,1),ArrayGet(vol,1))
ups = Plot(1,"up",up,{color=Green, linewidth=3})
PlotHistogram(ups,Red,true)
dns = Plot(1,"dn",dn,{color=Red, linewidth=3})
PlotHistogram(dns,Green,true)
--[[
if wave == 1 then
PlotShape(0,ShapeDiamond,Green,10)
elseif wave == -1 then
PlotShape(0,ShapeDiamond,Red,10)
elseif wave == 0 then
PlotShape(0,ShapeDiamond,Yellow,10)
end
]]
0 Comments
Sign in to leave a comment.
No comments yet. Be the first!