Can Someone Check My RVSI(TV) to TOS Conversion?

PocketsofTime

New member
I converted the RVSI Trading View script to Think Script and since I am not proficient, just wanted to check it to see if this was good or a better way. They are close but not an exact match, maybe just the difference in platforms but just wanting someone more experienced to take a look.

Trading View
Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @fract

//@version=4
// Title
study("Relative Volume Strength Index", "RVSI")

// inputs
avl = input(5, "Volume Length")
l1 = input(10, "RVSI")
ma = input(10, "EMA")

// colors
col_grow_above = color.green
col_grow_below = color.blue
col_fall_above = color.orange
col_fall_below = color.red

// function
nv = cum((change(close)) * volume)
av = ema(nv, avl)
RVSI = rsi(av, l1)
x = ema(RVSI, ma)

//plot
band1 = hline(100, "Overbought", color.red, linestyle=hline.style_dotted, linewidth=2)
band2 = hline(0, "Oversold", color.green, linestyle=hline.style_dotted, linewidth=2)
plot(RVSI, title="RVSI", style=plot.style_line, color=(RVSI>=x? (RVSI[1] < RVSI ? col_grow_above : col_fall_above) : (RVSI[1] < RVSI ? col_grow_below : col_fall_below)), transp=0, linewidth=2)
plot(x, color=#000000)
band3 = hline(50, "half", color=color.gray, linestyle=hline.style_dotted)

This is mine for TOS
Code:
declare lower ;
input avl = 5;
input l1 = 10;
input ma = 9;

def change = close - close[1];   #fixed
def nv = totalSum(change  * volume);
def av =  ExpAverage(nv, avl);

plot RVSI = reference RSI("price" = av, "length" = l1);
plot x = ExpAverage(RVSI, ma);

plot overbought = 100;
overbought.AssignValueColor(Color.RED);
plot oversold = 0;
oversold.AssignValueColor(Color.GREEN);

rvsi.AssignValueColor(color = if rvsi >= x then
    if RVSI[1] < RVSI then color.green else color.ORANGE else
    if RVSI[1] < RVSI  then color.red else color.RED);
x.AssignValueColor(Color.WHITE);

Anyone like to review?
 
Last edited by a moderator:
Change should most likely be Close - Close[1], as in the current bar minus one bar ago. Its currently written as one bar into the future minus the current bar. Other than that, it looks good.
 
I converted the RVSI Trading View script to Think Script and since I am not proficient, just wanted to check it to see if this was good or a better way. They are close but not an exact match, maybe just the difference in platforms but just wanting someone more experienced to take a look.

Trading View
Code:
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// @fract

//@version=4
// Title
study("Relative Volume Strength Index", "RVSI")

// inputs
avl = input(5, "Volume Length")
l1 = input(10, "RVSI")
ma = input(10, "EMA")

// colors
col_grow_above = color.green
col_grow_below = color.blue
col_fall_above = color.orange
col_fall_below = color.red

// function
nv = cum((change(close)) * volume)
av = ema(nv, avl)
RVSI = rsi(av, l1)
x = ema(RVSI, ma)

//plot
band1 = hline(100, "Overbought", color.red, linestyle=hline.style_dotted, linewidth=2)
band2 = hline(0, "Oversold", color.green, linestyle=hline.style_dotted, linewidth=2)
plot(RVSI, title="RVSI", style=plot.style_line, color=(RVSI>=x? (RVSI[1] < RVSI ? col_grow_above : col_fall_above) : (RVSI[1] < RVSI ? col_grow_below : col_fall_below)), transp=0, linewidth=2)
plot(x, color=#000000)
band3 = hline(50, "half", color=color.gray, linestyle=hline.style_dotted)

This is mine for TOS
Code:
declare lower ;
input avl = 5;
input l1 = 10;
input ma = 9;

def change = close[-1] - close;
def nv = totalSum(change  * volume);
def av =  ExpAverage(nv, avl);

plot RVSI = reference RSI("price" = av, "length" = l1);
plot x = ExpAverage(RVSI, ma);

plot overbought = 100;
overbought.AssignValueColor(Color.RED);
plot oversold = 0;
oversold.AssignValueColor(Color.GREEN);

rvsi.AssignValueColor(color = if rvsi >= x then
    if RVSI[1] < RVSI then color.green else color.ORANGE else
    if RVSI[1] < RVSI  then color.red else color.RED);
x.AssignValueColor(Color.WHITE);

Anyone like to review?
like it better than the standard TOS script
 

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
390 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top