liw0

Time Segmented Volume

Time Segmented Volume
an indicator I was asked to port by sunnyd76

CREDITS: quant.stackexchange....ime-segmented-volume

If you like it I would also be happy about a small donation
BTC 1GyfGTBsVHMbPovFGFeipe7b7ET1aebGx5

Questions or Comments? Just send me a PM!

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//      Written by liw0 active on https://www.tradingview.com/u/liw0
 
//      If you decide to use my script in your published charts,
//      please keep this header as it is now and leave the name unchanged!
//      It would make me happy to see my script put to use in other charts :)
 
//      If you like it I would also be happy about a small donation
//      BTC 1GyfGTBsVHMbPovFGFeipe7b7ET1aebGx5
 
//      Questions or Comments? Just send me a PM!

//      CREDITS: http://quant.stackexchange.com/questions/2816/how-to-calculate-time-segmented-volume

study("Time Segmented Volume")

l  = input(13, title="Length")
l_ma = input(7, title="MA Length")

t = sum(close>close[1]?volume*close-close[1]:close<close[1]?(volume*-1)*close-close:0,l)
m = sma(t ,l_ma )

plot(t, color=red, style=histogram)
plot(m, color=green)