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);
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 | |
Looking for thinkscript version of ChrisMoody's MacD Custom Indicator-MTF indicator? | Questions | 1 | ||
Help me create Schaff MTF version | Questions | 3 | ||
K | High low band MTF | Questions | 1 |