dieptong85
New member
Hello Everyone!
Can someone please help me add a horizontal line to the RSI indicator for me? I mean a current value of RSI. Thank you so much!
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#
declare lower;
input linearRegCh50 =50;
input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
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 RSI50 = linearRegCh50;
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;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", Color.YELLOW);
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(Color.VIOLET);
OverBought.SetDefaultColor(Color.VIOLET);
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Look like this indicator for price bellow:
# Horizontal Price Line
# Mobius
# 2.20.2018
plot priceLine = highestAll(if isNaN(close[-1])
then if high >= close(period = AggregationPeriod.day) then close else double.nan
else Double.NaN);
priceline.SetPaintingStrategy(PaintingStrategy.line);
priceLine.SetLineWeight(1);
priceLine.SetDefaultColor(CreateColor(50,250,150));
priceline.HideTitle();
Can someone please help me add a horizontal line to the RSI indicator for me? I mean a current value of RSI. Thank you so much!
#
# TD Ameritrade IP Company, Inc. (c) 2007-2022
#
declare lower;
input linearRegCh50 =50;
input length = 14;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = no;
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 RSI50 = linearRegCh50;
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;
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);
RSI.DefineColor("OverBought", GetColor(5));
RSI.DefineColor("Normal", Color.YELLOW);
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(Color.VIOLET);
OverBought.SetDefaultColor(Color.VIOLET);
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
Look like this indicator for price bellow:
# Horizontal Price Line
# Mobius
# 2.20.2018
plot priceLine = highestAll(if isNaN(close[-1])
then if high >= close(period = AggregationPeriod.day) then close else double.nan
else Double.NaN);
priceline.SetPaintingStrategy(PaintingStrategy.line);
priceLine.SetLineWeight(1);
priceLine.SetDefaultColor(CreateColor(50,250,150));
priceline.HideTitle();