Traders Dynamic Index (TDI) Indicator for ThinkorSwim

MerryDay

Administrative
Staff member
Staff
VIP
@Herbee
Click on scan.
Click on +Add filter
Click on the pencil icon next to the filter you just added
Click edit
1. In the left column, click on the pull-down window, click add study
Type in whatever you named your TDI script
2. Under Plot, click on the pull-down window, choose RSI1
3. In the middle column, choose Greater Than
4. In the right column, click on the pull-down window, click add study
Type in whatever you named your TDI script
5. Under Plot, click on the pull-down window, choose RSI2
Save
For RSI1 crossing below RSI2, create a separate scan the same way, except in the middle column choose Less Than.
HTH
XMqEWzx.png
 

Hapme

New member
if you can have a look at the picture there ,,, we have the -- Upper Volatiility band and Lower , RSI , signal Line , but the yellow line is the Base line , the base line also gives a lot of info about the trend going and more important divergences . the script you post is great similar to tradeview in all ways , but is missing online the baseline thats all , if you can add it

 
Last edited by a moderator:

germanburrito

Active member
all you could do is delete def bbmidline and write plot intead.

Code:
# LS_TradersDynamIcIndex_long

# Traders Dynamic Index   

# 2 smoothed RSIs Plotted on OverBought / OverSold Grid

# with Bollinger Band of unsmoothed RSIs


declare lower;

input averageType = {default SMA, EMA};

input Period = 13;

input showBreakoutSignals = YES;


plot RegRSI = reference RSI(Period);

plot average = average(Regrsi,7);


RegRSI.SetDefaultColor(Color.GREEN);

RegRSI.SetStyle(Curve.FIRM);

RegRSI.HideBubble();

RegRSI.HideTitle();




input BBlength = 34;


input BBsdMult = 1.62;

plot BBmidline = Average(RegRSI, BBlength);

def SDBB = StDev(RegRSI, BBlength);


# Upper Line of Bollinger Band----------------------------------

plot uBBline = BBmidline + BBsdMult * SDBB;


uBBline.SetDefaultColor(Color.YELLOW);

uBBline.SetStyle(Curve.SHORT_DASH);

uBBline.SetLineWeight(1);

uBBline.HideBubble();

uBBline.HideTitle();


# Lower Line of Bollinger Band---------------------------------

plot lBBline = BBmidline - BBsdMult * SDBB;


lBBline.SetDefaultColor(Color.YELLOW);

lBBline.SetStyle(Curve.SHORT_DASH);

lBBline.SetLineWeight(2);

lBBline.HideBubble();

lBBline.HideTitle();







plot UpSignal = if RegRSI crosses above lBBline then lBBline else Double.NaN;

plot DownSignal = if RegRSI crosses below uBBline then uBBline else Double.NaN;


UpSignal.SetHiding(!showBreakoutSignals);

DownSignal.SetHiding(!showBreakoutSignals);



UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);

DownSignal.SetDefaultColor(Color.DOWNTICK);

DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

# END ======================================
 

wussay

New member
VIP
How could I use the study for a scan to find stocks where the BBmidline dips below 20?
 
Last edited by a moderator:

Zlotko

Member
VIP
@KYLEM0990 Use the version below:

Code:
# LS_TradersDynamIcIndex_long
# Traders Dynamic Index  
# 2 smoothed RSIs Plotted on OverBought / OverSold Grid
# with Bollinger Band of unsmoothed RSIs

input averageType = {default SMA, EMA};

# RSI (Relative Strength Index)====================

input Period = 13;
def RegRSI = reference RSI(Period);

# Compute 2 smoothed (by averaging) RSIs------------------
# 2 Smoothers--------------------------------------------------------
input sm1 = 2; # 1st RSI smoother
input sm2 = 7; # 2nd RSI smoother

# 1st smoothed RSI--------------------------------------------------
# Either ----------------------------------------------------------------
# (1) a simple averaging (SMA) or -------------------------
# (2) an exponential averaging (EMA)---------------------

def smRSI1 = if averageType == averageType.SMA then Average(RegRSI, sm1 ) else ExpAverage(RegRSI, sm1);

# 2nd smoothed RSI------------------------------------------------
# Either ---------------------------------------------------------------
# (1) a simple averaging (SMA) or ---------------------
# (2) an exponential averaging (EMA)-----------------

def smRSI2 = if averageType == averageType.SMA then Average(RegRSI, sm2) else ExpAverage(RegRSI, sm2);

# So far we have:
# 1. RegRSI = RSI
# 2. smRSI1 = 1st smoothed RSI, smoother = 2
# 3. smRSI2 = 2nd smoothed RSI, smoother = 7

#--------------------------------------------------------------------------
# PLOTS---------------------------------------------------------------
#---------------------------------------------------------------------------


# RSI1---1st smoothed RSI----------------------------------------
def RSI1 = smRSI1;

# RSI2---2nd smoothed RSI---------------------------------------
def RSI2 = smRSI2;


#============================================
# Bollinger Bands of RSI=========================
#============================================

# Length of Bollinger Averaging---------------------------------
input BBlength = 34;          
# Width of Bollinger Band in Standard Deviations----------
input BBsdMult = 1.62;
# Mid-line for the Bollinger Band of the RegRSIs -----------

def BBmidline = Average(RegRSI, BBlength);

#--------------------------------------------------------------------------
# Upper and Lower Bollinger Bands---------------------------
#---------------------------------------------------------------------------

# Standard Deviation of unsmoothed RSIs-------------------
def SDBB = StDev(RegRSI, BBlength);

# Upper Line of Bollinger Band----------------------------------
def uBBline = BBmidline + BBsdMult * SDBB;

# Lower Line of Bollinger Band---------------------------------
def lBBline = BBmidline - BBsdMult * SDBB;

#--------------------------------------------------------------------------
# GRID-----------------------------------------------------------------
#--------------------------------------------------------------------------

#plot OB = 68; # OverBought
#plot ML = 50; # Mid-Line
#plot OS = 32; # OverSold

plot bullish = if RSI1 > BBmidline and RSI1[1] <= BBmidline then low else double.nan;
plot bearish = if RSI1 < BBmidline and RSI1[1] >= BBmidline then high else double.nan;

plot bull = bullish;
bull.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
bull.SetDefaultColor(Color.CYAN);
bull.SetLineWeight(1);
plot bear = bearish;
bear.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
bear.SetDefaultColor(Color.CYAN);
bear.SetLineWeight(1);

#---------------------------------------------------------------------------
# Add Vertical Line when RSI1 crosses BBmidline-----------
#---------------------------------------------------------------------------

#AddVerticalLine (if RSI1 > BBmidline and RSI1[1] <= BBmidline
#then 1 else 0, "--- UP ? ---", Color.YELLOW, Curve.LONG_DASH);

#AddVerticalLine (if RSI1 < BBmidline and RSI1[1] >= BBmidline
#then 1 else 0, "--- DN ? ---", Color.VIOLET, Curve.LONG_DASH);

#---------------------------------------------------------------------------
# Cloud between RSI2 and BBmidline-------------------------
#---------------------------------------------------------------------------

#AddCloud (RSI2, BBmidline, Color.WHITE, Color.YELLOW);

# END ======================================
Is this not MACD?
 

Similar threads

Top