@jon this looked interesting, not sure if it was the same scripts/code in this thread, but I quickly ported it. I added a 50 line to it, and quick observations on lower time frames, you can trade this with high probably, crossing from OB or OS to the 50 line, quick intraday trading.
Ruby:
#On Balance Volume RSI (OBV RSI) by @robswc
#An RSI, using OBV as the source, use to find divergence in the OBV to indicate reversals.
#Tutorial on youtube: https://youtu.be/klC8U2XLovs
#
# 2019.11.24 1.0 @diazlaz - Original Port
#
declare lower;
input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input src = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
#net volume of positive and negative volume
def obv = if (src - src[1]) > 0 then volume else
if (src - src[1]) < 0 then -volume else 0 * volume;
def cnv = TotalSum(obv); #cumulative net volume
def price = cnv;
def NetChgAvg = MovingAverage(averageType, price - price[1], length);
def TotChgAvg = MovingAverage(averageType, AbsValue(price - price[1]), length);
def ChgRatio = if TotChgAvg != 0 then NetChgAvg / TotChgAvg else 0;
plot RSI = 50 * (ChgRatio + 1);
plot OverSold = over_Sold;
plot OverBought = over_Bought;
plot UpSignal = if RSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI crosses below OverBought then OverBought else Double.NaN;
plot mid = 50;
mid.SetPaintingStrategy(paintingStrategy = PaintingStrategy.DASHES);
mid.AssignValueColor(COLOR.DARK_GRAY);
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", GetColor(7));
RSI.DefineColor("OverSold", GetColor(1));
RSI.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else
if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
AddCloud(over_Bought, Over_Sold, Color.Light_Gray, Color.Light_Gray);
#END OF OBV RSI
Last edited: