Hello French82, Could you explain further into detail by what you mean when you said "changed it to 1D"? Thank you I'm having the same problem and would like for it to work on all time frames.
Hey
@Quantum33 ,
I added additional aggregation periods to make it work in all time frames.. to make it easy here is the script. Happy Trading!
#/@seoco
#indicator('CryptoSignalScanner - RSI Overbought/Oversold + Divergence Indicator',
# Converted by Sam4Cok@Samer800 -02/2023
declare lower;
input rsiShowInput = yes; # 'Show RSI', group='Show/Hide Settings')
input maShowInput = no; # 'Show MA', group='Show/Hide Settings')
input showRSIMAInput = yes; # 'Show RSIMA Cloud'
input rsiBandShowInput = yes; # 'Show Oversold/Overbought Lines'
input rsiBandExtShowInput = yes; # 'Show Oversold/Overbought Extended Lines'
input rsiHighlightShowInput = yes; # 'Show Oversold/Overbought Highlight Lines'
input DivergenceShowInput = yes; # 'Show RSI Divergence Labels'
#//--- RSI Input Settings
input rsiSourceInput = close; # 'Source'
input rsiLengthInput = 14; # 'RSI Length'
input rsiUpperBandExtInput = 80; # 'RSI Overbought Extended Line'
input rsiUpperBandInput = 70; # 'RSI Overbought Line'
input rsiLowerBandInput = 30; # 'RSI Oversold Line'
input rsiLowerBandExtInput = 20; # 'RSI Oversold Extended Line'
#//--- MA Input Settings
input maTypeInput = {"SMA", "Bollinger Bands", default "EMA", "SMMA (RMA)", "WMA", "VWMA"}; # "MA Type"
input maLengthInput = 14; # "MA Length"
#//--- Divergence Input Settings
input lbrInput = 2; # "Pivot Lookback Right"
input lblInput = 2; # "Pivot Lookback Left"
input lbRangeMaxInput = 10; # "Max of Lookback Range"
input lbRangeMinInput = 2; # "Min of Lookback Range"
input plotBullInput = yes; # "Plot Bullish"
input plotHiddenBullInput = yes; # "Plot Hidden Bullish"
input plotBearInput = yes; # "Plot Bearish"
input plotHiddenBearInput = yes; # "Plot Hidden Bearish"
#//--- Stoch RSI Settings + Calculation
input showStochRSI = no; # "Show Stochastic RSI"
input smoothK = 3; # "Stochastic K"
input smoothD = 4; # "Stochastic D"
input lengthRSI = 14; # "Stochastic RSI Lenght"
input lengthStoch = 14; # "Stochastic Lenght"
input label = yes; # "#--- Labels"
def na = Double.NaN;
def pos = Double.POSITIVE_INFINITY;
def neg = Double.NEGATIVE_INFINITY;
def isBB = maTypeInput == maTypeInput."Bollinger Bands";
#--- Color
DefineGlobalColor("Green" , CreateColor(38,166,154));
DefineGlobalColor("Red" , CreateColor(239,83,79));
DefineGlobalColor("Gray" , CreateColor(42,42,42));
#//--- RSI Calculation
def close15 = close(Period = AggregationPeriod.FIFTEEN_MIN);
def close1h = close(Period = AggregationPeriod.HOUR);
def close4h = close(Period = AggregationPeriod.FOUR_HOURS);
def close1d = close(Period = AggregationPeriod.DAY);
def rsi = RSI(PRICE = rsiSourceInput, LENGTH = rsiLengthInput);
def up15 = WildersAverage(Max((close15 - close15[1]), 0), rsiLengthInput);
def down15 = WildersAverage(-Min((close15 - close15[1]), 0), rsiLengthInput);
def rsi15 = if down15 == 0 then 100 else if up15 == 0 then 0 else 100 - (100 / (1 + up15 / down15));
def up1h = WildersAverage(Max((close1h - close1h[1]), 0), rsiLengthInput);
def down1h = WildersAverage(-Min((close1h - close1h[1]), 0), rsiLengthInput);
def rsi1h = if down1h == 0 then 100 else if up1h == 0 then 0 else 100 - (100 / (1 + up1h / down1h));
def up4h = WildersAverage(Max((close4h - close4h[1]), 0), rsiLengthInput);
def down4h = WildersAverage(-Min((close4h - close4h[1]), 0), rsiLengthInput);
def rsi4h = if down4h == 0 then 100 else if up4h == 0 then 0 else 100 - (100 / (1 + up4h / down4h));
def up1d = WildersAverage(Max((close1d - close1d[1]), 0), rsiLengthInput);
def down1d = WildersAverage(-Min((close1d - close1d[1]), 0), rsiLengthInput);
def rsi1d = if down1d == 0 then 100 else if up1d == 0 then 0 else 100 - (100 / (1 + up1d / down1d));
#//--- MA Calculation
# stoch(source, high, low, length) =>
script stoch {
input src = close;
input h = high;
input l = low;
input len = 0;
def stoch = 100 * (src - lowest(l, len)) / (highest(h, len) - lowest(l, len));
plot return = stoch;
}
#ma(source, length, type) =>
script ma {
input source = close;
input length = 14;
input type = "EMA";
def ma =
if type == "SMA" then SimpleMovingAvg(source, length) else
if type == "Bollinger Bands" then SimpleMovingAvg(source, length) else
if type == "EMA" then ExpAverage(source, length) else
if type == "SMMA (RMA)" then WildersAverage(source, length) else
if type == "WMA" then WMA(source, length) else
if type == "VWMA" then SimpleMovingAvg(source * volume, length) / SimpleMovingAvg(volume, length) else source;
plot return = ma;
}
def rsiMA = ma(rsi, maLengthInput, maTypeInput);
def rsi1 = RSI(Price=close1d, LENGTH=lengthRSI);
def k = SimpleMovingAvg(stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK);
def d = SimpleMovingAvg(k, smoothD);
def osc = rsi;
def rsiColor = rsi >= rsiMA;
#//--- Plot Lines
plot maPlot = if maShowInput then rsiMA else na;
maPlot.SetDefaultColor(Color.YELLOW);
def rsiMAPlot = if showRSIMAInput then rsiMA else na;
plot rsiPlot = if rsiShowInput then rsi else na;
rsiPlot.AssignValueColor(if rsiColor then GlobalColor("Green") else GlobalColor("Red"));
AddCloud(rsiPlot, rsiMAPlot, GlobalColor("Green"), GlobalColor("Red"));
plot StochK = if showStochRSI then k else na;
StochK.SetDefaultColor(Color.WHITE);
plot StockD = if showStochRSI then d else na;
StockD.SetDefaultColor(Color.MAGENTA);
plot bbUpperBand = if isBB then rsiMA + stdev(rsi, maLengthInput) * 2 else na; # "Upper Bollinger Band"
bbUpperBand.SetDefaultColor(Color.GRAY);
plot bbLowerBand = if isBB then rsiMA - stdev(rsi, maLengthInput) * 2 else na; # "Lower Bollinger Band"
bbLowerBand.SetDefaultColor(Color.GRAY);
AddCloud(bbUpperBand, bbLowerBand, GlobalColor("Gray"));
plot midLine = 50;
midLine.SetDefaultColor(Color.DARK_GRAY);
plot rsiUpBandExt = if rsiBandExtShowInput then rsiUpperBandExtInput else na;
rsiUpBandExt.SetStyle(Curve.SHORT_DASH);
rsiUpBandExt.SetDefaultColor(Color.RED);
plot rsiUpBand = if rsiBandShowInput then rsiUpperBandInput else na;
rsiUpBand.SetStyle(Curve.SHORT_DASH);
rsiUpBand.SetDefaultColor(Color.DARK_RED);
plot rsiLoBand = if rsiBandShowInput then rsiLowerBandInput else na;
rsiLoBand.SetStyle(Curve.SHORT_DASH);
rsiLoBand.SetDefaultColor(Color.DARK_GREEN);