RSI Levels For ThinkOrSwim

New Release Version 1.3! 08-08-23 https://usethinkscript.com/threads/rsi-levels-for-thinkorswim.15867/post-129692



I hope you enjoy this one. The changes aren't dramatic but still very helpful. I look forward to everyone's feedback.
  1. Customizable Inputs: The indicator allows users to customize the RSI length, SMA length, overbought level, and oversold level. This flexibility enables users to adapt the indicator to different trading strategies and market conditions.
  2. RSI and SMA Plotting: The indicator plots the RSI line and the lagging 9-period Simple Moving Average (SMA) line. The RSI line represents the calculated RSI values, while the SMA line provides a smoothed version of the RSI.
  3. Overbought and Oversold Levels: The indicator plots the overbought and oversold levels as horizontal lines. These levels indicate potential reversal points or extreme market conditions. The default levels are set at 85 for overbought and 15 for oversold, but they can be customized.
  4. Enhanced Overbought/Oversold Levels: The indicator also includes additional enhanced overbought/oversold levels to provide more nuanced information. These levels include moderately overbought/oversold levels (70 and 30), heavily overbought/oversold levels (85 and 15), and extremely overbought/oversold levels (100 and 1).
  5. Visual Customization: The indicator allows for the customization of colors and line weights for the plotted lines, making it visually adaptable to individual preferences.
Overall, this indicator provides information about the RSI and its relationship with overbought and oversold conditions. It can assist traders in identifying potential trend reversals and extreme market conditions.
Ruby:
# RSI Levels Indicator version 1.0 created by Trader4TOS 06/21/2023
# In this slightly enhanced version of RSI. Then 9 SMA has been added in conjunction with the RSI line to give you foresight of trend changes upon crossing each other. Also added three levels of oversold and overbought graded color codes. I added a customization menu for all the features.


input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.SetDefaultColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);

# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);

# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;

# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);
 
Last edited:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

This is just a slight visual enhancement as I added a midpoint line at the 50. Very useful as it shows the break of trend or consolidation periods on the daily chart .
Ruby:
# RSI Levels Indicator version 1.0 created by Trader4TOS 06/21/2023
# In this slightly enhanced version of RSI. Then 9 SMA has been added in conjunction with the RSI line to give you foresight of trend changes upon crossing each other. Also added three levels of oversold and overbought graded color codes. I added a customizations menu for all the features.

input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.SetDefaultColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);

# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);

# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;
def midLine = 50;

#Plot ZeroLine
plot MLine = MidLine;
MLine.setDefaultColor(Color.GRAY);
MLine.SetLineWeight(2);

# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);
 
Last edited:
New added feature " Market Correlation Tracking"

The script calculates the price action for each ticker based on the previous closing prices and compares them to the previous high and low prices. If the current closing price is higher than the previous high or lower than the previous low, it indicates a trend using labels and will be color coded.
By using this feature, you can quickly compare the momentum for each ticker based on the selected criteria. It helps to identify the correlation within the VIX, Bonds, Gold, and Oil Futures. In conjunction with the overall market. This complements the Mega Moving Average 1.3 version really well with its "Trend Continuation" feature. Very simplistic but helps out greatly. All these strategies work best with a multi screen set up. I'll be awaiting your feed back. Happy trading!



#RSI Levels Version 1.2 created by Trader4TOS 07/14/23

#Customizable Inputs: The script allows you to customize various inputs, including RSI length, SMA length, overbought level, and oversold level. By enabling the enableCustomInputs parameter, you can modify the values of customRsiLength, customSmaLength, customOverboughtLevel, and customOversoldLevel to suit your preferences. Adjusting these inputs can help you fine-tune the indicator based on your trading strategy and preferred parameter values.

#RSI Calculation: The script calculates the RSI (Relative Strength Index) using the Wilder's moving average method. It calculates the net change average (netChgAvg) and total change average (totChgAvg) based on the price data. These values are then used to calculate the RSI value (rsiValue). The RSI is a widely used momentum oscillator that helps identify overbought and oversold conditions in a security.

#SMA Calculation: The script calculates a lagging 9-period Simple Moving Average (SMA) of the RSI values. The SMA helps smooth out the RSI line and provides additional insights into the trend and momentum of the security.

#Overbought and Oversold Levels: The script plots horizontal lines (overbought and oversold) to represent the overbought and oversold levels, respectively. By default, the overbought level is set to 85 and the oversold level is set to 15. These levels can be adjusted using the customOverboughtLevel and customOversoldLevel parameters. Traders often consider securities to be overbought when the RSI crosses above the overbought level, indicating a potential reversal or correction, and oversold when the RSI crosses below the oversold level, suggesting a possible buying opportunity.

#Enhanced Overbought/Oversold Levels: The script includes additional levels (ModeratelyOverbought, ModeratelyOversold, HeavilyOverbought, HeavilyOversold, ExtremelyOverbought, and ExtremelyOversold) to provide more granularity in identifying different degrees of overbought and oversold conditions. These levels can be used to identify potentially extreme market conditions based on the RSI value.

#Zero Line: The script plots a horizontal line (MLine) at the value of 50, representing the neutral zone. When the RSI crosses above 50, it is often considered a bullish signal, while a cross below 50 may be seen as bearish.

#Market Correlation Tracking: The script includes code to track the trends of various market indicators such as 20Y Treasury Bonds (TLT), U.S. Dollar Index ($DXY), Volatility Index (VIX), Oil Futures (/CL), and Gold Futures (/GC). It detects new highs and lows for these indicators and assigns labels with color codes based on the trend. This feature can help you monitor the correlation between the security being analyzed and other market indicators.

# The plotted lines, levels, and labels will provide visual cues and insights into the RSI and market correlation trends.

#Please note that understanding and interpreting these features require familiarity with technical analysis concepts and indicators. It's recommended to further research and study these indicators to use them effectively in your trading decisions.
Ruby:
input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.AssignValueColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);
########################################################################################
# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);
########################################################################################
# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;
def midLine = 50;
########################################################################################
# Plot ZeroLine
plot MLine = midLine;
MLine.setDefaultColor(Color.GRAY);
MLine.SetLineWeight(2);
########################################################################################
# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);

######################## Market Correlation Tracking #####################################

input enableMCT = yes;

# Calculate trend continuation for each ticker
def tltHigherHigh = if enableMCT and close("TLT") > high("TLT")[1] then 1 else 0;
def tltLowerLow = if enableMCT and close("TLT") < low("TLT")[1] then 1 else 0;
def tltMCT = tltHigherHigh or tltLowerLow;

def dxyHigherHigh = if enableMCT and close("$DXY") > high("$DXY")[1] then 1 else 0;
def dxyLowerLow = if enableMCT and close("$DXY") < low("$DXY")[1] then 1 else 0;
def dxyMCT = dxyHigherHigh or dxyLowerLow;

def vixHigherHigh = if enableMCT and close("VIX") > high("VIX")[1] then 1 else 0;
def vixLowerLow = if enableMCT and close("VIX") < low("VIX")[1] then 1 else 0;
def vixMCT = vixHigherHigh or vixLowerLow;

def clHigherHigh = if enableMCT and close("/CL") > high("/CL")[1] then 1 else 0;
def clLowerLow = if enableMCT and close("/CL") < low("/CL")[1] then 1 else 0;
def clMCT = clHigherHigh or clLowerLow;

def gcHigherHigh = if enableMCT and close("/GC") > high("/GC")[1] then 1 else 0;
def gcLowerLow = if enableMCT and close("/GC") < low("/GC")[1] then 1 else 0;
def gcMCT = gcHigherHigh or gcLowerLow;

# Assign colors to labels based on trend continuation
AddLabel(yes, "TLT", if tltMCT == 1 then Color.DARK_GREEN else if tltMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "$DXY", if dxyMCT == 1 then Color.DARK_GREEN else if dxyMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "VIX", if vixMCT == 1 then Color.DARK_GREEN else if vixMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/CL", if clMCT == 1 then Color.DARK_GREEN else if clMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/GC", if gcMCT == 1 then Color.DARK_GREEN else if gcMCT == 0 then Color.RED else Color.GRAY);

#######################################################################################
 
Last edited by a moderator:
RSI Levels version 1.3 08/08/23

This new update brings features that provide possible "breakouts or breakdown" visual cues by percentages via labels, it also shows the current possible price move and a weekly price target with an additional script to add a second price target(PT1 and PT2). All of these features are comprehensive tools for technical analysis in trading, combining various indicators, volume analysis, and potential breakout/breakdown calculations. The breakout and breakdown potential is a Beta feature and is still being worked on. It is an early release. So keep this in mind. It still needs work. Here's an overview of the features and benefits:

Features:​

  1. Moving Averages: Calculations for various simple, exponential, double exponential, and triple exponential moving averages provide trend-following and smoothing capabilities.
  2. Breakout/Breakdown Detection: By calculating bullish and bearish moves, the script can detect potential breakouts and breakdowns. The script also takes into account volatility and volume.
  3. Price Targets (PT1 & PT2): Bullish and bearish price targets are calculated, allowing traders to set specific goals or stop-loss levels.
  4. Average True Range (ATR) & Smoothing: Utilizing ATR with smoothing for volatility, the script provides better context to the current price movement.
  5. Volume Analysis: Relative volume is used to adjust the breakout/breakdown potential, integrating the impact of trading volume on price movement.
  6. Wide Range Candle & ADX Indicators: The incorporation of these indicators adds more complexity and specificity to the buying conditions.
  7. Customizable Inputs: Various input parameters allow users to tailor the script to their needs, including length for moving averages, outlier threshold, and enabling/disabling specific features.
  8. Labels and Alerts: Visual labels provide an easy-to-read summary of key indicators, and alerts can notify users of potential breakout or breakdown events.

Benefits:​

  1. Comprehensive Analysis: By combining a wide range of indicators and calculations, this script offers a thorough view of market conditions.
  2. Customization: Traders can adjust the parameters to suit their trading style, time frame, or asset class.
  3. Trade Planning: The breakout/breakdown potential and price targets can guide traders in planning entry, exit, and risk management strategies.
  4. Integration of Volume and Volatility: By considering volume and volatility, the script provides a more nuanced view of market dynamics.
  5. Visual and Auditory Feedback: The labels and alerts help traders stay aware of market changes without constantly watching the charts.
  6. Potential Strategy Implementation: This script could be a part of a larger trading system or strategy by serving as a basis for trading signals.
  7. Versatility: The combination of features makes this script suitable for different market conditions and various trading styles, including swing trading, day trading, or trend-following strategies.

Conclusion:​

This multifaceted tool can help traders analyze market conditions, detect potential opportunities, and plan trades more effectively. Its combination of volume analysis, trend-following indicators, and potential breakout/breakdown detection makes it a valuable addition to a trader's toolkit. By allowing customization and providing real-time feedback, it is adaptable to different trading styles and market environments.



#RSI Levels Version 1.3 created by Trader4TOS 08/08/23
#Breakout/Breakdown Potential by percentage, Current Price Move for the day and Weekly Swing PT1. PT2(Price Targets) is an optional feature which can be added by the user. The script is at the bottom, just copy and paste. (New feature)
###########################################################################################
#Customizable Inputs: The script allows you to customize various inputs, including RSI length, SMA length, overbought level, and oversold level. By enabling the enableCustomInputs parameter, you can modify the values of customRsiLength, customSmaLength, customOverboughtLevel, and customOversoldLevel to suit your preferences. Adjusting these inputs can help you fine-tune the indicator based on your trading strategy and preferred parameter values.

#RSI Calculation: The script calculates the RSI (Relative Strength Index) using the Wilder's moving average method. It calculates the net change average (netChgAvg) and total change average (totChgAvg) based on the price data. These values are then used to calculate the RSI value (rsiValue). The RSI is a widely used momentum oscillator that helps identify overbought and oversold conditions in a security.

#SMA Calculation: The script calculates a lagging 9-period Simple Moving Average (SMA) of the RSI values. The SMA helps smooth out the RSI line and provides additional insights into the trend and momentum of the security.

#Overbought and Oversold Levels: The script plots horizontal lines (overbought and oversold) to represent the overbought and oversold levels, respectively. By default, the overbought level is set to 85 and the oversold level is set to 15. These levels can be adjusted using the customOverboughtLevel and customOversoldLevel parameters. Traders often consider securities to be overbought when the RSI crosses above the overbought level, indicating a potential reversal or correction, and oversold when the RSI crosses below the oversold level, suggesting a possible buying opportunity.

#Enhanced Overbought/Oversold Levels: The script includes additional levels (ModeratelyOverbought, ModeratelyOversold, HeavilyOverbought, HeavilyOversold, ExtremelyOverbought, and ExtremelyOversold) to provide more granularity in identifying different degrees of overbought and oversold conditions. These levels can be used to identify potentially extreme market conditions based on the RSI value.

#Zero Line: The script plots a horizontal line (Midpoint Line) at the value of 50, representing the neutral zone. When the RSI crosses above 50, it is often considered a bullish signal, while a cross below 50 may be seen as bearish.

#Market Correlation Tracking: The script includes code to track the trends of various market indicators such as 20Y Treasury Bonds (TLT), U.S. Dollar Index ($DXY), Volatility Index (VIX), Oil Futures (/CL), and Gold Futures (/GC). It detects new highs and lows for these indicators and assigns labels with color codes based on the trend. This feature can help you monitor the correlation between the security being analyzed and other market indicators.

# The plotted lines, levels, and labels will provide visual cues and insights into the RSI and market correlation trends.

#Please note that understanding and interpreting these features require familiarity with technical analysis concepts and indicators. It's recommended to further research and study these indicators to use them effectively in your trading decisions.
Ruby:
input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.AssignValueColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);
########################################################################################
# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);
########################################################################################
# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;
def midLine = 50;
########################################################################################
# Plot ZeroLine
plot MLine = midLine;
MLine.setDefaultColor(Color.GRAY);
MLine.SetLineWeight(2);
########################################################################################
# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);

######################## Market Correlation Tracking #####################################

input enableMCT = yes;

# Calculate trend continuation for each ticker
input enabletltMCT = yes;
def tltHigherHigh = if enableMCT and close("TLT") > high("TLT")[1] then 1 else 0;
def tltLowerLow = if enableMCT and close("TLT") < low("TLT")[1] then 1 else 0;
def tltMCT = tltHigherHigh or tltLowerLow;

input enabledxyMCT = yes;
def dxyHigherHigh = if enableMCT and close("$DXY") > high("$DXY")[1] then 1 else 0;
def dxyLowerLow = if enableMCT and close("$DXY") < low("$DXY")[1] then 1 else 0;
def dxyMCT = dxyHigherHigh or dxyLowerLow;

input enablevixMTC = yes;
def vixHigherHigh = if enableMCT and close("VIX") > high("VIX")[1] then 1 else 0;
def vixLowerLow = if enableMCT and close("VIX") < low("VIX")[1] then 1 else 0;
def vixMCT = vixHigherHigh or vixLowerLow;

input enableclMCT = yes;
def clHigherHigh = if enableMCT and close("/CL") > high("/CL")[1] then 1 else 0;
def clLowerLow = if enableMCT and close("/CL") < low("/CL")[1] then 1 else 0;
def clMCT = clHigherHigh or clLowerLow;


input enablegcMCT = yes;
def gcHigherHigh = if enableMCT and close("/GC") > high("/GC")[1] then 1 else 0;
def gcLowerLow = if enableMCT and close("/GC") < low("/GC")[1] then 1 else 0;
def gcMCT = gcHigherHigh or gcLowerLow;

# Assign colors to labels based on trend continuation
AddLabel(yes, "TLT", if tltMCT == 1 then Color.DARK_GREEN else if tltMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "$DXY", if dxyMCT == 1 then Color.DARK_GREEN else if dxyMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "VIX", if vixMCT == 1 then Color.DARK_GREEN else if vixMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/CL", if clMCT == 1 then Color.DARK_GREEN else if clMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/GC", if gcMCT == 1 then Color.DARK_GREEN else if gcMCT == 0 then Color.RED else Color.GRAY);

#######################################################################################


#Breakout/Breakdown Potential by%, Current Price Move and Weekly Swing PT1 and PT2(Price Targets) in Version 1.3

# Inputs
input length = 14;
input averageLength = 100;
input wideRangeCandle = yes;
input volumeIncrease = yes;
input highestLength = 15;
input adxLength = 14;
input adxLevel = 40.0;
input enablebullishbreakout = yes;
input enablebearishbreakout = yes;
input enableVolatility = yes;
input atrLength = 14;
input volLength = 20;
input smoothingLength = 5; # Smoothing parameter
input outlierThreshold = 20; # Outlier threshold
input maxPercentChange = 2.0;

# Definitions
def atrRaw = ATR(length = atrLength);
def atr = Average(atrRaw, smoothingLength); # Smoothing the ATR
def atrMultiplier = if enableVolatility then atr else 1;
def move = high - low;

# Adjusted Move for bullish and bearish case
def bullishMove = close - low;
def bearishMove = high - close;
def adjustedBullishMove = bullishMove * atrMultiplier;
def adjustedBearishMove = bearishMove * atrMultiplier;

def bodyHeight = close - open;

# Buy conditions
def buy1 = atr == Highest(atr, length) and close crosses above Average(close, averageLength) and if wideRangeCandle then bodyHeight > Average(bodyHeight, length) else yes and if volumeIncrease then volume > volume[1] else yes;
def adx = ADX(length = adxLength);
def dailyHigh = high(period = AggregationPeriod.DAY);
def isNewHigh = dailyHigh == Highest(high(period = AggregationPeriod.DAY), highestLength);
def buy2 = adx crosses above adxLevel and isNewHigh;

# Breakouts
def bullishBreakout = buy1 and !buy1[1];
def bearishBreakdown = buy2 and !buy2[1];
def breakoutOccurred = if enablebullishbreakout then bullishBreakout else no;
def breakdownOccurred = if enablebearishbreakout then bearishBreakdown else no;

# Potential calculations
def breakoutPotential = high - close;
def breakdownPotential = close - low;
def breakoutPotentialPercent = breakoutPotential / close * 100;
def breakdownPotentialPercent = breakdownPotential / close * 100;

# Calculate moving averages for volume and ATR
def avgVol = Average(volume, volLength);
def avgATR = Average(atr, volLength);

# Calculate relative volume and volatility
def relVol = volume / avgVol;
def relATR = atr / avgATR;

# Adjust the potential calculations based on relative volume and volatility
def breakoutPotentialAdj = (high - close) * relVol * relATR;
def breakdownPotentialAdj = (close - low) * relVol * relATR;

# Calculate adjusted potential percentages with outlier exclusion
def breakoutPotentialPercentAdj = if AbsValue(breakoutPotentialAdj / close * 100) < outlierThreshold then breakoutPotentialAdj / close * 100 else 0;
def breakdownPotentialPercentAdj = if AbsValue(breakdownPotentialAdj / close * 100) < outlierThreshold then breakdownPotentialAdj / close * 100 else 0;

# Moving Averages
def ma21 = Average(close, 21);
def ma50 = Average(close, 50);
def ma100 = Average(close, 100);
def ma200 = Average(close, 200);
def ma300 = Average(close, 300);
def ma9 = Average(close, 9);

# Exponential Moving Averages
def ema21 = ExpAverage(close, 21);
def ema50 = ExpAverage(close, 50);
def ema100 = ExpAverage(close, 100);
def ema200 = ExpAverage(close, 200);
def ema300 = ExpAverage(close, 300);

# Double Exponential Moving Average
def dema200 = 2 * ema200 - ExpAverage(ema200, 200);

# Triple Exponential Moving Average
def tema200 = 3 * ema200 - 3 * ExpAverage(ema200, 200) + ExpAverage(ExpAverage(ema200, 200), 200);

# Max Moving Average
def max1 = Max(ma50, ma21);
def max2 = Max(max1, ma100);
def max3 = Max(max2, ma300);
def max4 = Max(max3, ma9);
def max5 = Max(max4, ema21);
def max6 = Max(max5, ema50);
def max7 = Max(max6, ema100);
def max8 = Max(max7, ema200);
def max9 = Max(max8, ema300);
def max10 = Max(max9, dema200);
def maxAll = Max(max10, tema200);

# Maximum change limit
def maxChange = close * maxPercentChange / 100;
def pt1BullishRaw = close + (maxAll / 100) * close;
def pt2BullishRaw = close + (maxAll / 100) * close;
def pt1BearishRaw = close - (maxAll / 100) * close;
def pt2BearishRaw = close - (maxAll / 100) * close;
def pt1Bullish = if pt1BullishRaw - close > maxChange then close + maxChange else pt1BullishRaw;
def pt2Bullish = if pt2BullishRaw - close > maxChange then close + maxChange else pt2BullishRaw;
def pt1Bearish = if close - pt1BearishRaw > maxChange then close - maxChange else pt1BearishRaw;
def pt2Bearish = if close - pt2BearishRaw > maxChange then close - maxChange else pt2BearishRaw;

# Labels and alerts
AddLabel(yes, "🍠: " + AsPercent(breakoutPotentialPercentAdj), Color.GREEN);
AddLabel(yes, "🐃Move: " + AsDollars(adjustedBullishMove), Color.GREEN);
AddLabel(yes, "💀︎︎️: " + AsPercent(breakdownPotentialPercentAdj), Color.RED);
AddLabel(yes, "🐻Move: " + AsDollars(adjustedBearishMove), Color.RED);
AddLabel(yes, "Swing\nPT: " + AsDollars(pt1Bullish), Color.GREEN);
AddLabel(yes, "Swing\nPT: " + AsDollars(pt1Bearish), Color.RED);
Alert(breakoutOccurred, "Adj. Breakout\nPotential: " + AsPercent(breakoutPotentialPercentAdj), Alert.BAR, Sound.Ding);
Alert(breakdownOccurred, "Adj. Breakdown\nPotential: " + AsPercent(breakdownPotentialPercentAdj), Alert.BAR, Sound.Ding);
#Optional pt2Bearish and pt1Bearish bullishBreakout for add label
###########################
#Here is the replacing script if you want to add a second price target(PT2): AddLabel(yes, "Swing\nPT1: " + AsDollars(pt1Bullish) + " \nPT2: " + AsDollars(pt2Bullish), Color.GREEN);
#AddLabel(yes, "Swing\nPT1: " + AsDollars(pt1Bearish) + " \nPT2: " + AsDollars(pt2Bearish), Color.RED);
 
Last edited:
New Release Version 1.3! 08-08-23 https://usethinkscript.com/threads/rsi-levels-for-thinkorswim.15867/post-129692



I hope you enjoy this one. The changes aren't dramatic but still very helpful. I look forward to everyone's feedback.
  1. Customizable Inputs: The indicator allows users to customize the RSI length, SMA length, overbought level, and oversold level. This flexibility enables users to adapt the indicator to different trading strategies and market conditions.
  2. RSI and SMA Plotting: The indicator plots the RSI line and the lagging 9-period Simple Moving Average (SMA) line. The RSI line represents the calculated RSI values, while the SMA line provides a smoothed version of the RSI.
  3. Overbought and Oversold Levels: The indicator plots the overbought and oversold levels as horizontal lines. These levels indicate potential reversal points or extreme market conditions. The default levels are set at 85 for overbought and 15 for oversold, but they can be customized.
  4. Enhanced Overbought/Oversold Levels: The indicator also includes additional enhanced overbought/oversold levels to provide more nuanced information. These levels include moderately overbought/oversold levels (70 and 30), heavily overbought/oversold levels (85 and 15), and extremely overbought/oversold levels (100 and 1).
  5. Visual Customization: The indicator allows for the customization of colors and line weights for the plotted lines, making it visually adaptable to individual preferences.
Overall, this indicator provides information about the RSI and its relationship with overbought and oversold conditions. It can assist traders in identifying potential trend reversals and extreme market conditions.
Ruby:
# RSI Levels Indicator version 1.0 created by Trader4TOS 06/21/2023
# In this slightly enhanced version of RSI. Then 9 SMA has been added in conjunction with the RSI line to give you foresight of trend changes upon crossing each other. Also added three levels of oversold and overbought graded color codes. I added a customization menu for all the features.


input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.SetDefaultColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);

# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);

# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;

# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);
New added feature " Market Correlation Tracking"

The script calculates the price action for each ticker based on the previous closing prices and compares them to the previous high and low prices. If the current closing price is higher than the previous high or lower than the previous low, it indicates a trend using labels and will be color coded.
By using this feature, you can quickly compare the momentum for each ticker based on the selected criteria. It helps to identify the correlation within the VIX, Bonds, Gold, and Oil Futures. In conjunction with the overall market. This complements the Mega Moving Average 1.3 version really well with its "Trend Continuation" feature. Very simplistic but helps out greatly. All these strategies work best with a multi screen set up. I'll be awaiting your feed back. Happy trading!



#RSI Levels Version 1.2 created by Trader4TOS 07/14/23

#Customizable Inputs: The script allows you to customize various inputs, including RSI length, SMA length, overbought level, and oversold level. By enabling the enableCustomInputs parameter, you can modify the values of customRsiLength, customSmaLength, customOverboughtLevel, and customOversoldLevel to suit your preferences. Adjusting these inputs can help you fine-tune the indicator based on your trading strategy and preferred parameter values.

#RSI Calculation: The script calculates the RSI (Relative Strength Index) using the Wilder's moving average method. It calculates the net change average (netChgAvg) and total change average (totChgAvg) based on the price data. These values are then used to calculate the RSI value (rsiValue). The RSI is a widely used momentum oscillator that helps identify overbought and oversold conditions in a security.

#SMA Calculation: The script calculates a lagging 9-period Simple Moving Average (SMA) of the RSI values. The SMA helps smooth out the RSI line and provides additional insights into the trend and momentum of the security.

#Overbought and Oversold Levels: The script plots horizontal lines (overbought and oversold) to represent the overbought and oversold levels, respectively. By default, the overbought level is set to 85 and the oversold level is set to 15. These levels can be adjusted using the customOverboughtLevel and customOversoldLevel parameters. Traders often consider securities to be overbought when the RSI crosses above the overbought level, indicating a potential reversal or correction, and oversold when the RSI crosses below the oversold level, suggesting a possible buying opportunity.

#Enhanced Overbought/Oversold Levels: The script includes additional levels (ModeratelyOverbought, ModeratelyOversold, HeavilyOverbought, HeavilyOversold, ExtremelyOverbought, and ExtremelyOversold) to provide more granularity in identifying different degrees of overbought and oversold conditions. These levels can be used to identify potentially extreme market conditions based on the RSI value.

#Zero Line: The script plots a horizontal line (MLine) at the value of 50, representing the neutral zone. When the RSI crosses above 50, it is often considered a bullish signal, while a cross below 50 may be seen as bearish.

#Market Correlation Tracking: The script includes code to track the trends of various market indicators such as 20Y Treasury Bonds (TLT), U.S. Dollar Index ($DXY), Volatility Index (VIX), Oil Futures (/CL), and Gold Futures (/GC). It detects new highs and lows for these indicators and assigns labels with color codes based on the trend. This feature can help you monitor the correlation between the security being analyzed and other market indicators.

# The plotted lines, levels, and labels will provide visual cues and insights into the RSI and market correlation trends.

#Please note that understanding and interpreting these features require familiarity with technical analysis concepts and indicators. It's recommended to further research and study these indicators to use them effectively in your trading decisions.
Ruby:
input price = close;
input rsiLength = 14;
input smaLength = 9;
input overboughtLevel = 85;
input oversoldLevel = 15;

# Customizable Inputs
def enableCustomInputs = yes;
def customRsiLength = if enableCustomInputs then 14 else rsiLength;
def customSmaLength = if enableCustomInputs then 9 else smaLength;
def customOverboughtLevel = if enableCustomInputs then 85 else overboughtLevel;
def customOversoldLevel = if enableCustomInputs then 15 else oversoldLevel;

# Calculate RSI
def netChgAvg = MovingAverage(AverageType.WILDERS, price - price[1], customRsiLength);
def totChgAvg = MovingAverage(AverageType.WILDERS, AbsValue(price - price[1]), customRsiLength);
def chgRatio = if totChgAvg != 0 then netChgAvg / totChgAvg else 0;
def rsiValue = Round(50 * (chgRatio + 1), 0);

# Calculate lagging 9-period SMA
def smaValue = reference SimpleMovingAvg(rsiValue, customSmaLength);

# Plot RSI and SMA
plot rsiLine = rsiValue;
rsiLine.AssignValueColor(Color.YELLOW);
rsiLine.SetLineWeight(2);

plot smaLine = smaValue;
smaLine.SetDefaultColor(Color.BLUE);
smaLine.SetLineWeight(2);
########################################################################################
# Plot overbought and oversold levels
plot overbought = customOverboughtLevel;
overbought.SetDefaultColor(Color.RED);
overbought.SetLineWeight(2);

plot oversold = customOversoldLevel;
oversold.SetDefaultColor(Color.GREEN);
oversold.SetLineWeight(2);
########################################################################################
# Enhanced Overbought/Oversold Levels
def moderatelyOverboughtLevel = 70;
def moderatelyOversoldLevel = 30;
def heavilyOverboughtLevel = 85;
def heavilyOversoldLevel = 15;
def extremelyOverboughtLevel = 100;
def extremelyOversoldLevel = 1;
def midLine = 50;
########################################################################################
# Plot ZeroLine
plot MLine = midLine;
MLine.setDefaultColor(Color.GRAY);
MLine.SetLineWeight(2);
########################################################################################
# Plot enhanced levels
plot ModeratelyOverbought = moderatelyOverboughtLevel;
ModeratelyOverbought.SetDefaultColor(Color.DARK_ORANGE);
ModeratelyOverbought.SetLineWeight(2);

plot ModeratelyOversold = moderatelyOversoldLevel;
ModeratelyOversold.SetDefaultColor(Color.LIGHT_GREEN);
ModeratelyOversold.SetLineWeight(2);

plot HeavilyOverbought = heavilyOverboughtLevel;
HeavilyOverbought.SetDefaultColor(Color.RED);
HeavilyOverbought.SetLineWeight(2);

plot HeavilyOversold = heavilyOversoldLevel;
HeavilyOversold.SetDefaultColor(Color.GREEN);
HeavilyOversold.SetLineWeight(2);

plot ExtremelyOverbought = extremelyOverboughtLevel;
ExtremelyOverbought.SetDefaultColor(Color.DARK_RED);
ExtremelyOverbought.SetLineWeight(3);

plot ExtremelyOversold = extremelyOversoldLevel;
ExtremelyOversold.SetDefaultColor(Color.DARK_GREEN);
ExtremelyOversold.SetLineWeight(3);

######################## Market Correlation Tracking #####################################

input enableMCT = yes;

# Calculate trend continuation for each ticker
def tltHigherHigh = if enableMCT and close("TLT") > high("TLT")[1] then 1 else 0;
def tltLowerLow = if enableMCT and close("TLT") < low("TLT")[1] then 1 else 0;
def tltMCT = tltHigherHigh or tltLowerLow;

def dxyHigherHigh = if enableMCT and close("$DXY") > high("$DXY")[1] then 1 else 0;
def dxyLowerLow = if enableMCT and close("$DXY") < low("$DXY")[1] then 1 else 0;
def dxyMCT = dxyHigherHigh or dxyLowerLow;

def vixHigherHigh = if enableMCT and close("VIX") > high("VIX")[1] then 1 else 0;
def vixLowerLow = if enableMCT and close("VIX") < low("VIX")[1] then 1 else 0;
def vixMCT = vixHigherHigh or vixLowerLow;

def clHigherHigh = if enableMCT and close("/CL") > high("/CL")[1] then 1 else 0;
def clLowerLow = if enableMCT and close("/CL") < low("/CL")[1] then 1 else 0;
def clMCT = clHigherHigh or clLowerLow;

def gcHigherHigh = if enableMCT and close("/GC") > high("/GC")[1] then 1 else 0;
def gcLowerLow = if enableMCT and close("/GC") < low("/GC")[1] then 1 else 0;
def gcMCT = gcHigherHigh or gcLowerLow;

# Assign colors to labels based on trend continuation
AddLabel(yes, "TLT", if tltMCT == 1 then Color.DARK_GREEN else if tltMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "$DXY", if dxyMCT == 1 then Color.DARK_GREEN else if dxyMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "VIX", if vixMCT == 1 then Color.DARK_GREEN else if vixMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/CL", if clMCT == 1 then Color.DARK_GREEN else if clMCT == 0 then Color.RED else Color.GRAY);
AddLabel(yes, "/GC", if gcMCT == 1 then Color.DARK_GREEN else if gcMCT == 0 then Color.RED else Color.GRAY);

#######################################################################################
I like what you have here, do you have a screenshot of it in action? I added it today on a few different tickets but nothing plotted on 5 minute timeframes
 
Thanks. It should be visible on the 5 min time frame. How many other indicators are you using with the RSI Levels? Also what are your TOS memory settings? This might take a while to load if you dont have sufficient memory to run multiple screen set-ups.
 
Thanks. It should be visible on the 5 min time frame. How many other indicators are you using with the RSI Levels? Also what are your TOS memory settings? This might take a while to load if you dont have sufficient memory to run multiple screen set-ups.
I only draw support and resistance, keep my charts barebone😁 so memory shouldn't be an issue, I'll try to plot it while the market is live maybe that was the issue.

UPDATE:
Oh nevermind I thought it was a top indicator, moved it to lower box I got it now. Thanks looks interesting 😁
 
Last edited by a moderator:
I only draw support and resistance, keep my charts barebone😁 so memory shouldn't be an issue, I'll try to plot it while the market is live maybe that was the issue.

UPDATE:
Oh nevermind I thought it was a top indicator, moved it to lower box I got it now. Thanks looks interesting 😁
lol
 
RSI is one of my favorite indicators. Your work here looks great, I can't wait to test when the market opens. I do have a few mods I have done myself. I have added a MTF feature, a cloud and vertical line to make it easier to see when trend changes.

declare lower;
input agg = AggregationPeriod.DAY;
def o = open(period = agg);
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def v = volume(period = agg);
def price = close(period = agg);

AddCloud(rsiLine, smaLine, Color.Dark_Green, Color.Dark_Red);

input show_vertical_lines = yes;
AddVerticalLine(show_vertical_lines and smaLine crosses below rsiLine, "smaLine", color.green, Curve.Points);
AddVerticalLine(show_vertical_lines and smaLine crosses above rsiLine, "smaLine", color.red, Curve.Points);
 
RSI is one of my favorite indicators. Your work here looks great, I can't wait to test when the market opens. I do have a few mods I have done myself. I have added a MTF feature, a cloud and vertical line to make it easier to see when trend changes.

declare lower;
input agg = AggregationPeriod.DAY;
def o = open(period = agg);
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def v = volume(period = agg);
def price = close(period = agg);

AddCloud(rsiLine, smaLine, Color.Dark_Green, Color.Dark_Red);

input show_vertical_lines = yes;
AddVerticalLine(show_vertical_lines and smaLine crosses below rsiLine, "smaLine", color.green, Curve.Points);
AddVerticalLine(show_vertical_lines and smaLine crosses above rsiLine, "smaLine", color.red, Curve.Points);
Thanks ! Nice work! The RSI Levels is best with a multiple screen set up. Showing various time frames like the 3 minute 5 min, 15 min, 30min, 1 hour, daily and weekly charts to suit your scalping or swinging needs. The trend changes when the SMA line crosses the RSI line and also when they both go below or above the midpoint gray line(50). This will show you the short and long term trends. When it's below the midpoint line it's bearish and when above its bullish. Kind of like the zeroline on the MACD. The SMA line crossing the RSI line is more of a short term trend tracker/pull back/ reversals ect... When viewed in this manner it is easier to track momentum/strength and change of direction/weakness. 👍📈📉📈
 
Last edited:
Thanks ! Nice work! The RSI Levels is best with a multiple screen set up. Showing various time frames like the 3 minute 5 min, 15 min, 30min, 1 hour, daily and weekly charts to suit your scalping or swinging needs. The trend changes when the SMA line crosses the RSI line and also when they both go below or above the midpoint gray line(50). This will show you the short and long term trends. When it's below the midpoint line it's bearish and when above its bullish. Kind of like the zeroline on the MACD. The SMA line crossing the RSI line is more of a short term trend tracker/pull back/ reversals ect... When viewed in this manner it is easier to track momentum/strength and change of direction/weakness. 👍📈📉📈
I was confused with the original script since nothing was appearing on my chart until I dragged the script to the lower study, so adding "declare lower;" was key. I had a similar script as this one but it used an ema line I didn't like due to mixed signals. I feel the smaLine might smooth that out. You could also add a background color to reference the trend change in the smaLine as well. I wasn't going to add it as it might confuse people but here it is:

def frontside = rsiLine > smaLine;
def backside = rsiLine < rsiLine;
DefineGlobalColor("frontsideColor", CreateColor(3, 21, 11));
DefineGlobalColor("backsideColor", CreateColor(44, 10, 10));
AssignBackgroundColor(if frontside then GlobalColor("frontsideColor") else if backside then GlobalColor("backsideColor") else Color.CURRENT);
 
RSI is one of my favorite indicators. Your work here looks great, I can't wait to test when the market opens. I do have a few mods I have done myself. I have added a MTF feature, a cloud and vertical line to make it easier to see when trend changes.

declare lower;
input agg = AggregationPeriod.DAY;
def o = open(period = agg);
def h = high(period = agg);
def l = low(period = agg);
def c = close(period = agg);
def v = volume(period = agg);
def price = close(period = agg);

AddCloud(rsiLine, smaLine, Color.Dark_Green, Color.Dark_Red);

input show_vertical_lines = yes;
AddVerticalLine(show_vertical_lines and smaLine crosses below rsiLine, "smaLine", color.green, Curve.Points);
AddVerticalLine(show_vertical_lines and smaLine crosses above rsiLine, "smaLine", color.red, Curve.Points

I like your concept, when added it has errors do you mind sharing what youve added in one complete code
 
I was confused with the original script since nothing was appearing on my chart until I dragged the script to the lower study, so adding "declare lower;" was key. I had a similar script as this one but it used an ema line I didn't like due to mixed signals. I feel the smaLine might smooth that out. You could also add a background color to reference the trend change in the smaLine as well. I wasn't going to add it as it might confuse people but here it is:

def frontside = rsiLine > smaLine;
def backside = rsiLine < rsiLine;
DefineGlobalColor("frontsideColor", CreateColor(3, 21, 11));
DefineGlobalColor("backsideColor", CreateColor(44, 10, 10));
AssignBackgroundColor(if frontside then GlobalColor("frontsideColor") else if backside then GlobalColor("backsideColor") else Color.CURRENT);
I like the additions you have made. Would you be able to post your modified code? I ran into several errors when modifying it myself.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
295 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top