RicardoSantos

[RS]Trade Volume Index V0

As described here:
http://www.investopedia.com/ask/answers/051915/what-trade-volume-index-tvi-formula-and-how-it-calculated.asp
Remove from Favorite Scripts Add to Favorite Scripts
//@version=2
study(title='[RS]Trade Volume Index V0', overlay=false)
smooth = input(title='Signal Smoothness, (<0 to hide):', type=integer, defval=4)
f_tvi()=>
    _min_tick = syminfo.mintick
    _price_change = close-open // can be change(close) if want to include gaps
    _direction = _price_change > _min_tick ? 1 : _price_change < -_min_tick ? -1 : _direction[1] //1=accumulation, -1=distribution
    _return_tvi = na(_return_tvi[1]) ? volume : _direction > 0 ? _return_tvi[1] + volume : _direction < 0 ? _return_tvi[1] - volume : _return_tvi[1]

plot(title='TVI', series=f_tvi(), color=black)
plot(title='Signal', series=smooth <= 0 ? na : sma(f_tvi(), smooth), color=red)
hline(title='0', price=0, color=black)
This is fantastic work! It should compliment much of the other scripts you have shared! Thank you.
Reply
United States
United Kingdom
India
Deutschland
España
France
Việt Nam
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
Malaysia
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing Priority Support Ideas Published Followers Following Private Messages Chat Sign Out