Decided to give it a shot and see if I could recreate it after recently playing with Pine Script. IMHO I think this indicator has a lot of redundancies, I do not use it to trade. However hopefully this helps somebody here. I hope I gave proper credit where due and wrote it out simply enough for people to modify as they see fit. Just for practice I added a bunch of customizable options for people as well.
@Lummox @astro_phx
Code:
### Adapted for UseThinkscript.com by TTsMikeC 5/6/2022
# Volume Weighted RSI
# idea from Lummox reference RedK Vol Weighted RSI on trading view:
#https://www.tradingview.com/script/BaTELgMy-RedK-Vol-Weighted-RSI-Extending-the-power-of-the-classic-RSI/
#
#hint Long_Rsi_Type: This setting adjusts the way the long RSI length is calculated. Setting this to Auto will use "sentiment" to determine long RSI length.
#hint Long_Rsi_Sentiment: The factor for determining long RSI length. Setting Long_Rsi_Type to "manual" will ignore this setting.
#hint Long_RSI_Length: This setting is ignored if "Long RSI Type" is set to "Auto".
#hint Long_Rsi_Step: Reduces long RSI plot readings to visualy show longer term conviction in place of actual reading. Setting this to "1" will disply longer RSI actual.
declare lower;
input Price = close;
input RSI_Length = 10;
input Smoothing = 3;
input Avg_Type = AverageType.EXPONENTIAL;
input Long_Rsi_Type = {default "Manual" ,"Auto"};
input Long_Rsi_Sentiment = 3;
input Long_RSI_Length = 21;
input Long_Rsi_Step = .8;
input over_bought = 40;
input over_sold = -40;
## Short RSI Calc
def ShortUp = MovingAverage(averagetype = Avg_Type, if Price > Price[1] then Price * volume else 0, RSI_Length);
def ShortDown = MovingAverage(averagetype = Avg_Type, if Price < Price[1] then Price * volume else 0, RSI_Length);
def ShortRSI_Calc = 100 - (100 / (1 + ShortUp / ShortDown));
def ShortRSI_Fix = ShortRSI_Calc * 2 - 100;
## Long RSI
def Lrsi;
Switch (Long_Rsi_Type) {
case Manual: Lrsi = Long_Rsi_Length;
case Auto: Lrsi = RSI_Length * Long_Rsi_Sentiment;}
def LongUp = MovingAverage(averagetype = Avg_Type, if Price > Price[1] then Price * volume else 0, Lrsi);
def LongDown = MovingAverage(averagetype = Avg_Type, if Price < Price[1] then Price * volume else 0, Lrsi);
def LongRSI_Calc = 100 - (100 / (1 + LongUp / LongDown));
def LongRSI_Fix = LongRSI_Calc * 2 - 100;
plot ShortRSI = MovingAverage(averagetype = Avg_Type, ShortRSI_Fix, Smoothing);
plot LongRSI = MovingAverage(averagetype = Avg_Type, LongRSI_Fix * Long_Rsi_Step, Smoothing);
ShortRSI.DefineColor("Positive", Color.CYAN);
ShortRSI.DefineColor("Negative", Color.ORANGE);
ShortRSI.AssignValueColor(if ShortRSI > 0 then ShortRSI.Color("Positive") else ShortRSI.Color("Negative"));
ShortRSI.setLineWeight(2);
LongRSI.DefineColor("Positive", Color.GREEN);
LongRSI.DefineColor("Negative", Color.RED);
LongRSI.AssignValueColor(if LongRSI > 0 then LongRSI.Color("Positive") else LongRSI.Color("Negative"));
LongRSI.setLineWeight(2);
AddCloud(LongRSI,0, color.green, color.red);
## Arrows
plot UpArrow = if ShortRSI > 0 and ShortRSI[1] < 0 then Over_sold else double.NaN;
plot DownArrow = if ShortRSI < 0 and ShortRSI[1] > 0 then Over_bought else double.NaN;
UpArrow.setPaintingStrategy(paintingStrategy.ARROW_UP);
UpArrow.setDefaultColor(color.GREEN);
DownArrow.setPaintingStrategy(paintingStrategy.ARROW_DOWN);
DownArrow.setDefaultColor(color.RED);
## scale/field
plot OverBought = over_bought;
plot MiddleLine = 0;
plot OverSold = over_sold;
OverBought.SetDefaultColor(color.GREEN);
OverBought.SetStyle(Curve.SHORT_DASH);
MiddleLine.SetDefaultColor(color.yellow);
MiddleLine.SetStyle(Curve.LONG_DASH);
OverSold.SetDefaultColor(color.RED);
OverSold.SetStyle(Curve.SHORT_DASH);
#END