Repaints MTF version of SVEStochRSI in thinkorswim

Repaints
SVEStochRSI I find this indicator very useful on TOS does anyone have a MultiTimeFrame MTF of this indicator, I have search and no luck, Thanks for your help.
 
@stocksniper
It would be great if you come back and share in what ways you find this useful.
Code:
# TOS SVEStochRSI MTF
declare lower;
# Part I  -- Define AggregationPeriod
input agg  = AggregationPeriod.DAY ;
def cclose = close(period = agg);
# ########################################################
# Part II -- RSI
input length = 14;
def price = cclose;
input averageType = 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;
def RSI = 50 * (ChgRatio + 1);
# ########################################################
# Part III -- Plug it all into SVEStochRSI
input rsiLength = 14;
input stochLength = 5;
input averageLength = 8;
input over_bought = 80;
input over_sold = 20;
input showBreakoutSignals = yes;

def hiRsi = Highest(RSI, stochLength);
def loRsi = Lowest(RSI, stochLength);

plot StochRSI = Average(RSI - loRsi, averageLength) / (0.1 + Average(hiRsi - loRsi, averageLength)) * 100;
plot OverBought = over_bought;
plot OverSold = over_sold;
plot UpSignal = if StochRSI crosses above OverSold then OverSold else Double.NaN;
plot DownSignal = if StochRSI crosses below OverBought then OverBought else Double.NaN;

UpSignal.SetHiding(!showBreakoutSignals);
DownSignal.SetHiding(!showBreakoutSignals);

StochRSI.SetDefaultColor(GetColor(1));
OverBought.SetDefaultColor(GetColor(7));
OverSold.SetDefaultColor(GetColor(7));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
http://tos.mx/cAeMz7v
 
Last edited:

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

It did not work, i can change the time period but nothing happens just stays on the same timeframe. Thanks for helping, and sure once I get it working I'll explain how to use it.
 
So sorry... I am so not a programmer. I am not detail-oriented enough.. I got one word wrong.. Fixed it. The code above is correct now...
L1qgfA0.png
 
Hey thank you so much it works now, ok so i use the 5min RSI timeframe a lot to find reversal points, so if you draw your support and resistance lines and the stock is coming near one of you support lines and the RSI is at the bottom most likely is going to bounce at that support line on the other hand if the stock is coming near one of your support lines and rsi still has room to go down more likely I wont take that trade and wait for another support line to match the RSI very basic but fairly accurate. I will use this 5min RSI on a 1min or 3min charts. Thanks!
 
@stocksniper

Code:
# TOS SVEStochRSI WatchList
input oversold = 10;
input overbought = 90;

plot SVEStochRSI = 
SVEStochRSI("rsi length" = 14, "stoch length" = 5, "average length" = 8, "over bought" = overbought, "over sold" = oversold)."StochRSI" ;

AssignBackgroundColor( 
if SVEStochRSI < oversold then color.violet else
if SVEStochRSI > overbought then color.violet else
if SVEStochRSI crosses above oversold   then color.dark_green else
if SVEStochRSI crosses below overbought then color.dark_red   else
if SVEStochRSI > oversold   and SVEStochRSI>SVEStochRSI[1] then color.light_green else
if SVEStochRSI < overbought and SVEStochRSI<SVEStochRSI[1] then color.pink else 
color.violet);

**New & Improved
 
Last edited:
No the first one you put worked but this one with the arrows doesn't can you also put the oversold and overbought numbers on this one since I usually change them to 90 and 10 thank you so much for helping.
 
@stocksniper I have been observing the watchlist for most of the day and it 'seems' to be working.
It lights up green or red momentarily as it crosses above 20 and below 80.
The way it currently is written, it only lights up when the current candle has an arrow so it is very temporary.

Are you perhaps looking for it to turn green when it crosses above 20 and then have it stay green as long as it is rising?
then when it crosses below 80 stays red as long as it is falling. That is very different from what you ask for
which was to only light up when there is an arrow on the current candle, which is what it does now.
 
Mine are not turning violet when there is no signal they just stay black. Im also asking if there is a way to set the oversold and overbought to 10 and 90 instead of 20 and 80 which are the defaults. Thanks in advance for all your help.
 
@stocksniper

For your viewing pleasure, we have the new and approved SVEStochRSI watchlist.

aaa2.png


I have edited my post above to display the new and improve code.
I have coded in all the variables that calculate the SVEStochRSI so you can change the OB, OS, and any of the rest.

If a signal fires, the field will be dark red or dark green
if the SVEStochRSI is in the OS or OB zones, the field will be violet
if the SVEStochRSI is greater than OS and rising, the field will be light green
if the SVEStochRSI is less than the OB and falling, the field will be pink

If you only want the dark red and dark green fields, change the code for all the other colors to: color.white
HTH
 
Last edited:
@MerryDay Can you do the same thing you did with the last indicator to show green when arrow is up or red when arrow is down with this indicator below for watchlist. Thanks in advance....

Code:
# Stochastic_Momentum_Index
# original author: TDAmeritrade
# enhancements: netarchitech
# 10.20.2019


declare lower;

input over_bought = 40.0;
input over_sold = -40.0;
input percentDLength = 3;
input percentKLength = 5;
input showBreakoutSignals = {default "No", "On SMI", "On AvgSMI", "On SMI & AvgSMI"};

def min_low = lowest(low, percentKLength);
def max_high = highest(high, percentKLength);
def rel_diff = close - (max_high + min_low)/2;
def diff = max_high - min_low;

def avgrel = expaverage(expaverage(rel_diff, percentDLength), percentDLength);
def avgdiff = expaverage(expaverage(diff, percentDLength), percentDLength);

plot SMI = if avgdiff != 0 then avgrel / (avgdiff / 2) * 100 else 0;
smi.setDefaultColor(getColor(1));
smi.setLineWeight(2);

plot AvgSMI = expaverage(smi, percentDLength);
avgsmi.setDefaultColor(getcolor(5));
avgsmi.setLineWeight(2);

plot overbought = over_bought;
overbought.setDefaultColor(getcolor(4));

plot oversold = over_sold;
oversold.setDefaultColor(getcolor(4));

# Slow Line
input N2_Period = 21;
input R2_Period = 5;

def Ln2 = Lowest(low, N2_Period);
def Hn2 = Highest(high, N2_Period);
def Y2 = ((close - Ln2)/(Hn2 - Ln2)) * 100;
def X2 = ExpAverage(Y2, R2_period);


def Lxn = Lowest(x2, n2_period);
def Hxn = Highest(x2, n2_period);
def DSS = ((X2 - Lxn)/(Hxn - Lxn)) * 100;


def DSSb = ExpAverage(Dss, R2_period);
#DSSb.setdefaultColor(Color.GREEN);

plot DSSsignal = DSSb[1];
DSSsignal.AssignValueColor(if DSSb>DSSsignal then Color.Green else Color.Red);
DSSsignal.SetLineWeight(3);

def upSMI = SMI crosses above OverSold;
def upAvgSMI = AvgSMI crosses above OverSold;
def downSMI = SMI crosses below OverBought;
def downAvgSMI = AvgSMI crosses below OverBought;

plot UpSignal;
plot DownSignal;
switch (showBreakoutSignals) {
case "No":
    UpSignal = Double.NaN;
    DownSignal = Double.NaN;
case "On SMI":
    UpSignal = if upSMI then OverSold else Double.NaN;
    DownSignal = if downSMI then OverBought else Double.NaN;
case "On AvgSMI":
    UpSignal = if upAvgSMI then OverSold else Double.NaN;
    DownSignal = if downAvgSMI then OverBought else Double.NaN;
case "On SMI & AvgSMI":
    UpSignal = if upSMI or upAvgSMI then OverSold else Double.NaN;
    DownSignal = if downSMI or downAvgSMI then OverBought else Double.NaN;
}

UpSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");
DownSignal.setHiding(showBreakoutSignals == showBreakoutSignals."No");

OverBought.SetDefaultColor(GetColor(4));
OverSold.SetDefaultColor(GetColor(4));
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpSignal.SetLineWeight(3);
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownSignal.SetLineWeight(3);
 
@MerryDay Yes I had tried but, not sure what im missing, it doesnt work.

Code:
# Stochastic_Momentum_Index
input over_bought = 40.0;
input over_sold = -40.0;

plot AvgSMI =
AvgSMI( "percentDLength" = 3, "percentKLength" = 5, "over bought" = overbought, "over sold" = oversold)."AvgSMI" ;

AssignBackgroundColor(
if AvgSMI < oversold then color.violet else
if AvgSMI > overbought then color.violet else
if AvgSMI crosses above oversold   then color.dark_green else
if AvgSMI crosses below overbought then color.dark_red   else
if AvgSMI > oversold   and SVEStochRSI>SVEStochRSI[1] then color.light_green else
if AvgSMI < overbought and SVEStochRSI<SVEStochRSI[1] then color.pink else
color.violet);
 
@stocksniper Pat yourself on the back! 👏

A well-thought-out attempt.
  • All the TOS built-in studies have very specific definitions. I went to the StochasticMomentumIndex study and copied the AvgSMI definition And put it in the plot statement.
  • There was a lacked consistency in your definitions of os & ob. And underline hyphen in the input statements but written w/o hyphen in plot statement
  • The only other error that I could see was you left a couple of SVEStochRSI in the middle of the last 2 if statements.
Other than that it should work. I didn't test it so let us know how it goes!

Code:
# Stochastic_Momentum_Index
input overbought = 40.0;
input oversold = -40.0;

plot AvgSMI =
StochasticMomentumIndex("over bought" = overbought , "over sold" = oversold , "percent d length" = 3, "percent k length" = 5)."AvgSMI" ;

AssignBackgroundColor(
if AvgSMI < oversold then color.violet else
if AvgSMI > overbought then color.violet else
if AvgSMI crosses above oversold then color.dark_green else
if AvgSMI crosses below overbought then color.dark_red else
if AvgSMI > oversold and AvgSMI>AvgSMI[1] then color.light_green else
if AvgSMI < overbought and AvgSMI<AvgSMI[1] then color.pink else
color.violet);
 
Last edited:

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
290 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