Relative Vigor Index (RVI) for ThinkorSwim

BenTen

BenTen

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



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:
 
J

Jwatt7

New member
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

BenTen

Administrative
Staff
VIP
@Jwatt7 You need to define the condition for up and down arrows first.
 

Similar threads

Top