stocksniper
Member
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.
# 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);
# 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);
# 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);
# 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);
# 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);
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
F | How to make an MTF version of a custom script? | Questions | 4 | |
P | hello can this be put into a mtf version? | Questions | 1 | |
Help me create Schaff MTF version | Questions | 3 | ||
R | MTF Scan and Custom Watchlist Column - Institutional Accumulation and Distribution | Questions | 1 | |
Price Above MTF 5ema Paint Background | Questions | 1 |
Start a new thread and receive assistance from our community.
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.
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.