I have been using and improving the standard TOS RSI indicator for well over a year for my own personal use and have finally decided to release RSI_Extreme to the usethinkscript community... I use it on virtually every underlying chart while scalping options, in one variation or another...
As the name implies, it is RSI_Extreme due its overall versatility... So, what makes it "Extreme"...???
Please Note:
As currently coded, the RSI Overbought and Oversold dots work differently than the breakouts in a standard RSI indicator... How they differ is that in a default indicator the "breakouts" fire when the RSI line crosses back over the overbought/oversold line after having previously crossed... In my indicator the breakouts fire and remain fired as long as RSI is beyond the breakout levels... I find it more important to know that entire event as it is happening rather than only after it has happened and is no longer happening...
Update History:
RSI_Extreme as both Upper and Lower indicators with all features enabled...
RSI_Extreme as both Upper and Lower indicators with midlines and average line disabled in the Upper and RSI horizontal line and chart label disabled in the Lower...
As the name implies, it is RSI_Extreme due its overall versatility... So, what makes it "Extreme"...???
- It can work just like the standard TOS RSI indicator if that is all you require...
- You can drag the indicator into the upper chart panel for on-chart display (I use this feature a lot)...
- You can enable/disable midlines which display at 40, 50, and 60...
- You can enable/disable the standard 70/30 breakout signals (dots by default)...
- You can enable/disable the standard RSI line...
- You can enable/disable a horizontal RSI line that displays across the entire chart, similar to how a PriceLine works, complete with overbought/oversold markings (triangles by default)...
- You can enable/disable a trend colored average line...
- You can enable/disable vertical lines at Start and End trading times of your choice...
Please Note:
As currently coded, the RSI Overbought and Oversold dots work differently than the breakouts in a standard RSI indicator... How they differ is that in a default indicator the "breakouts" fire when the RSI line crosses back over the overbought/oversold line after having previously crossed... In my indicator the breakouts fire and remain fired as long as RSI is beyond the breakout levels... I find it more important to know that entire event as it is happening rather than only after it has happened and is no longer happening...
Update History:
- # v1.0 : 2020-09-01 : Original code with midlines
- # v1.1 : 2020-09-15 : Modified settings for personal preference
- # v1.2 : 2021-01-22 : Added option to plot vertical lines at Start and End times
- # v1.3 : 2021-03-15 : Added option to plot horizontal rsiLine across chart at current RSI level
- # v1.4 : 2021-03-29 : Added option to plot trending color average line
- # v1.5 : 2021-03-29 : Added code to eliminate vertical lines for AggregationPeriods above Four_Hours
- # v1.6 : 2021-03-29 : Added option to adjust RSI chart label decimal rounding
Ruby:
# RSI_Extreme
# Based on TOS standard RSI
# By: rad14733 on usethinkscript.com
# Can be used as either an upper or lower indicator. Drag into upper chart panel for on-chart display.
# v1.0 : 2020-09-01 : Original code with midlines
# v1.1 : 2020-09-15 : Modified settings for personal preference
# v1.2 : 2021-01-22 : Added option to plot vertical lines at Start and End times
# v1.3 : 2021-03-15 : Added option to plot horizontal rsiLine across chart at current RSI level
# v1.4 : 2021-03-29 : Added option to plot trending color average line
# v1.5 : 2021-03-29 : Added code to eliminate vertical lines for AggregationPeriods above Four_Hours
# v1.6 : 2021-03-29 : Added option to adjust RSI chart label decimal rounding
declare lower;
input length = 13;
input over_Bought = 70;
input over_Sold = 30;
input price = close;
input averageType = AverageType.WILDERS;
input showBreakoutSignals = yes;
input showRSI = yes;
input showMidLines = yes;
input showRsiChartLabel = yes;
input rsiLabelDecimals = 4;
input showStartTimeLine = yes;
input showEndTimeLine = yes;
input startTime = 0930;
input endTime = 1600;
input showHorRsiLine = yes;
input showAvgRsi = yes;
input avgRsiLength = 3;
input avgRsiAverageType = AverageType.WILDERS;
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 <= OverSold then OverSold else Double.NaN;
plot DownSignal = if RSI >= OverBought then OverBought else Double.NaN;
plot forty = if showMidLines then 40 else Double.NaN;
forty.SetDefaultColor(Color.LIGHT_GRAY);
forty.SetPaintingStrategy(PaintingStrategy.DASHES);
forty.SetLineWeight(1);
plot fifty = if showMidLines then 50 else Double.NaN;
fifty.SetDefaultColor(Color.ORANGE);
fifty.SetPaintingStrategy(PaintingStrategy.DASHES);
fifty.SetLineWeight(1);
plot sixty = if showMidLines then 60 else Double.NaN;
sixty.SetDefaultColor(Color.LIGHT_GRAY);
sixty.SetPaintingStrategy(PaintingStrategy.DASHES);
sixty.SetLineWeight(1);
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"));
RSI.SetHiding(!showRSI);
OverSold.SetDefaultColor(GetColor(8));
OverBought.SetDefaultColor(GetColor(8));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
UpSignal.SetLineWeight(5);
UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.POINTS);
DownSignal.SetLineWeight(5);
DownSignal.SetHiding(!showBreakoutSignals);
#Place vertical lines at start and end times
def startTimeValue = SecondsFromTime(StartTime) == 0;
def endTimeValue = SecondsFromTime(endTime) == 0;
def aggOk = if GetAggregationPeriod() < AggregationPeriod.DAY then 1 else Double.NaN;
AddVerticalLine(aggOk and showStartTimeLine and startTimeValue,"Start",Color.GREEN,Curve.SHORT_DASH);
AddVerticalLine(aggOk and showEndTimeLine and endTimeValue,"End",Color.RED,Curve.SHORT_DASH);
#Display RSI Chart Label
AddLabel(showRsiChartLabel, "RSI: " + Round(rsi, rsiLabelDecimals), if rsi < over_Sold then RSI.color("OverSold") else if rsi > over_Bought then RSI.color("OverBought") else RSI.color("Normal"));
#Plot moving rsiLine across chart at current RSI level
plot rsiLine = if showHorRsiLine then HighestAll(if !IsNaN(RSI) and IsNaN(RSI[-1]) then RSI else Double.NaN) else Double.NaN;
rsiLine.SetDefaultColor(Color.BLACK);
rsiLine.AssignValueColor(if RSI > over_Bought then RSI.color("OverBought") else if RSI < over_Sold then RSI.color("OverSold") else RSI.color("Normal"));
rsiLine.SetPaintingStrategy(PaintingStrategy.LINE_VS_TRIANGLES);
rsiLine.SetLineWeight(1);
#Trending Color Average Line
plot avgRsi = if showAvgRsi then MovingAverage(avgRsiAverageType, RSI, avgRsiLength) else Double.NaN;
avgRsi.DefineColor("UpTrend", Color.GREEN);
avgRsi.DefineColor("DownTrend", Color.RED);
avgRsi.SetLineWeight(2);
avgRsi.SetPaintingStrategy(PaintingStrategy.LINE);
avgRsi.SetStyle(Curve.FIRM);
avgRsi.AssignValueColor(if avgRsi > avgRsi[1] then avgRsi.Color("UpTrend") else avgRsi.Color("DownTrend"));
#END - RSI_Extreme
RSI_Extreme as both Upper and Lower indicators with all features enabled...
RSI_Extreme as both Upper and Lower indicators with midlines and average line disabled in the Upper and RSI horizontal line and chart label disabled in the Lower...
Last edited: