Create custom RSI with range from 100 to minus 100


Category:
0
0

hello, is it possible to make the rsi have a zero line and range between -100 and 100 instead of 1 to 100… what would i need to do it the calculations to make it range like this?  thanks for any assistance

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on July 20, 2021 4:30 am
77 views
0
Sorry but I don't have any math skills above the level of basic algebra. I don't have a clue how to perform that math to accomplish what you requested. I am approving your question for the forum in case one of our viewers can explain how to do that math. I also updated the title of your question to make it more clear as what you are requesting.
( at July 20, 2021 7:15 am)
0
Private answer

#
# TD Ameritrade IP Company, Inc. (c) 2007-2021
#

declare lower;

input length = 14;
input over_Bought = 50;
input over_Sold = -50;
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 RSI = 100 * (ChgRatio + 0);
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", 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);

Attachments:
Marked as spam
Posted by (Questions: 8, Answers: 23)
Answered on July 20, 2021 12:15 pm