Relative Vigor Index (RVI) for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
This indicator is called Relative Vigor Index or known as RVI. I didn't get much out of it but maybe someone else can.

yqGYmOT.png


thinkScript Code

Code:
# Relative Vigor Index
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/0pbCZxRN-Relative-Vigour-Index-RVI-Ehlers/

declare lower;

input p = 14;

def CO = close - open;
def HL = high - low;

def value1 = (CO + 2 * CO[1] + 2 * CO[2] + CO[3]) / 6;
def value2 = (HL + 2 * HL[1] + 2 * HL[2] + HL[3]) / 6;

def num = sum(value1, p);
def denom = sum(value2, p);

def RVI = if denom != 0 then num / denom else 0;

def RVIsig = (RVI + 2 * RVI[1] + 2 * RVI[2] + RVI[3]) / 6;

plot line1 = RVI;
plot line2 = RVIsig;

line1.setDefaultColor(getColor(0));
line2.setDefaultColor(getColor(1));

Shareable Link

https://tos.mx/YwXRJPc
A few resources to help you learn more about the RVI:
 

Attachments

  • yqGYmOT.png
    yqGYmOT.png
    99.5 KB · Views: 147

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

BenTen, I'm testing your RVI with a few stocks. I like it very much. I added a zero line to your code and would like to also add arrows and an alert. Something like the below code. Any ideas?


UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Alert(UpSignal == ZeroLine, "Up Arrow Alert", Alert.BAR, Sound.RING);
Alert(DownSignal == ZeroLine, "Down Arrow Alert", Alert.BAR, Sound.RING);
 
BenTen, I'm testing your RVI with a few stocks. I like it very much. I added a zero line to your code and would like to also add arrows and an alert. Something like the below code. Any ideas?


UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Alert(UpSignal == ZeroLine, "Up Arrow Alert", Alert.BAR, Sound.RING);
Alert(DownSignal == ZeroLine, "Down Arrow Alert", Alert.BAR, Sound.RING);
I'm trying it out as an exit indicator.

Here's a zeroline



Code:
plot zeroline = 0;
 
Last edited:
Can someone help me fix the arrows not plotting

Code:
declare lower;

input p = 14;

def CO = close - open;
def HL = high - low;

def value1 = (CO + 2 * CO[1] + 2 * CO[2] + CO[3]) / 6;
def value2 = (HL + 2 * HL[1] + 2 * HL[2] + HL[3]) / 6;

def num = sum(value1, p);
def denom = sum(value2, p);

def RVI = if denom != 0 then num / denom else 0;

def RVIsig = (RVI + 2 * RVI[1] + 2 * RVI[2] + RVI[3]) / 6;

plot line1 = RVI;
plot line2 = RVIsig;

line1.setDefaultColor(getColor(0));
line2.setDefaultColor(getColor(1));

plot arrowUp = if line1 > line2 and line1[1] <= line2[1] then line1 else double.nan;
arrowUp.setDefaultColor(color.green);

plot arrowDown = if line1 < line2 and line1[1] >= line2[1] then line1 else double.nan;
arrowDown.setDefaultColor(color.red);

#plot line = 0;
line.setDefaultColor(color.white);
 
Last edited by a moderator:
Can someone help me fix the arrows not plotting

Code:
declare lower;

input p = 14;

def CO = close - open;
def HL = high - low;

def value1 = (CO + 2 * CO[1] + 2 * CO[2] + CO[3]) / 6;
def value2 = (HL + 2 * HL[1] + 2 * HL[2] + HL[3]) / 6;

def num = sum(value1, p);
def denom = sum(value2, p);

def RVI = if denom != 0 then num / denom else 0;

def RVIsig = (RVI + 2 * RVI[1] + 2 * RVI[2] + RVI[3]) / 6;

plot line1 = RVI;
plot line2 = RVIsig;

line1.setDefaultColor(getColor(0));
line2.setDefaultColor(getColor(1));

plot arrowUp = if line1 > line2 and line1[1] <= line2[1] then line1 else double.nan;
arrowUp.setDefaultColor(color.green);

plot arrowDown = if line1 < line2 and line1[1] >= line2[1] then line1 else double.nan;
arrowDown.setDefaultColor(color.red);

#plot line = 0;
line.setDefaultColor(color.white);
Try this:
Code:
# Relative Vigor Index
# Assembled by BenTen at useThinkScript.com
# Converted from https://www.tradingview.com/script/0pbCZxRN-Relative-Vigour-Index-RVI-Ehlers/

declare lower;

input p = 14;

def CO = close - open;
def HL = high - low;

def value1 = (CO + 2 * CO[1] + 2 * CO[2] + CO[3]) / 6;
def value2 = (HL + 2 * HL[1] + 2 * HL[2] + HL[3]) / 6;

def num = sum(value1, p);
def denom = sum(value2, p);

def RVI = if denom != 0 then num / denom else 0;

def RVIsig = (RVI + 2 * RVI[1] + 2 * RVI[2] + RVI[3]) / 6;

plot line1 = RVI;
plot line2 = RVIsig;

line1.setDefaultColor(Color.GREEN);
line2.setDefaultColor(Color.RED);

AddCloud(line1, line2, Color.GREEN, Color.RED);

plot UpSignal = if line1 crosses above line2 then line2 else Double.Nan;
UpSignal.SetDefaultColor(Color.GREEN);
UpSignal.SetLineWeight(5);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

plot DownSignal = if line1 crosses below line2 then line2 else Double.Nan;
Downsignal.SetDefaultColor(Color.RED);
DownSignal.SetLineWeight(5);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

BTW...if you think the RVI is good...try the HULL indicator:
https://usethinkscript.com/threads/hull-turning-points-concavity-for-thinkorswim.7847/
 
Last edited by a moderator:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
319 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