RicardoSantos

[RS]Trade Volume Index V0

280 1 24
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
Ideas Scripts Chart
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia
日本
한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out