SMI_DSS_EUO Indicator for ThinkorSwim

smi.png


Latest code for your review:

Code:
# filename: MR__EZ_SMI_DSS_EUO_

# original authors: TDAmeritrade rmejia and LazyBear
# enhancements: netarchitech as requested by @HighBredCloud
#               normalized code sample courtesy of @tomsk
# DSS source: https://futures.io/thinkorswim/34312-double-stochs-tos-thinkorswim-trading-platform.html#post468156
# V1.01.2019.11.06
# V1.02.2019.11.16
# V1.03.2019.11.17
# V1.04.2019.11.18

declare lower;

input PaintBars = no;
input showHistogram = yes;
input showBreakoutSignals = {default "No", "On SMI", "On AvgSMI", "On SMI & AvgSMI"};

input MinValue = -100; 
input MaxValue = 100; 

input percentDLength = 3;
input percentKLength = 5;

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.hide();

plot PlotToNormalize = SMI;   
PlotToNormalize.SetHiding(1);
plot NormalizedSMI =  (MaxValue - MinValue) * (PlotToNormalize - LowestAll(PlotToNormalize))/ (HighestAll(PlotToNormalize) - LowestAll(PlotToNormalize))+ MinValue;
NormalizedSMI.SetPaintingStrategy(PaintingStrategy.LINE);
NormalizedSMI.SetDefaultColor(GetColor(6));
NormalizedSMI.SetLineWeight(2);

plot AvgSMI = ExpAverage(SMI, percentDLength);
AvgSMI.hide();

plot PlotToNormalize1 = AvgSMI;   
PlotToNormalize1.SetHiding(1);
plot NormalizedAvgSMI =  (MaxValue - MinValue) * (PlotToNormalize1 - LowestAll(PlotToNormalize1))/ (HighestAll(PlotToNormalize1) - LowestAll(PlotToNormalize1))+ MinValue;
NormalizedAvgSMI.SetPaintingStrategy(PaintingStrategy.LINE);
NormalizedAvgSMI.SetDefaultColor(GetColor(5));
NormalizedAvgSMI.SetLineWeight(2);

# DSS
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 Y2 = ((close - Ln2) / (Hn2 - Ln2));
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 DSS = ((X2 - Lxn) / (Hxn - Lxn));
def DSSb = ExpAverage(DSS, R2_Period);
plot DSSsignal = DSSb[1];

plot PlotToNormalize2 = DSSsignal;
PlotToNormalize2.SetHiding(1);
plot NormalizedDSS =  (MaxValue - MinValue) * (PlotToNormalize2 - LowestAll(PlotToNormalize2))/ (HighestAll(PlotToNormalize2) - LowestAll(PlotToNormalize2))+ MinValue;
NormalizedDSS.SetPaintingStrategy(PaintingStrategy.LINE_VS_POINTS);
NormalizedDSS.AssignValueColor(if DSSb > NormalizedDSS then Color.GREEN else Color.RED);
NormalizedDSS.SetLineWeight(3);

#EUO
input bandedge = 20;
input lengthMA = 9;

def whitenoise = (close - close[2]) / 2;
def a1 = ExpAverage(-1.414 * 3.14159 / bandedge);
def b1 = 2.0 * a1 * Cos(1.414 * 180 / bandedge);
def c2 = b1;
def c3 = -a1 * a1;
def c1 = 1 - c2 - c3;

def filt = c1 * (whitenoise + (whitenoise[1])) / 2 + c2 * (filt[1]) + c3 * (filt[2]);
def filt1 = if TotalSum(1) == 0 then 0 else if TotalSum(1) == 2 then c2 * filt1[1] else if TotalSum(1) == 3 then c2 * filt1[1] + c3 * (filt1[2]) else filt;
def pk = if TotalSum(1) == 2 then .0000001 else if AbsValue(filt1) > pk[1] then AbsValue(filt1) else 0.991 * pk[1];
def denom = if pk == 0 then -1 else pk;
def euo = if denom == -1 then euo[1] else filt1 / pk;
plot euoMA = ExpAverage(euo, lengthMA);
euoMA.hide();

plot PlotToNormalize3 = euo;
PlotToNormalize3.SetHiding(1);
plot NormalizedEUO =  (MaxValue - MinValue) * (PlotToNormalize3 - LowestAll(PlotToNormalize3))/ (HighestAll(PlotToNormalize3) - LowestAll(PlotToNormalize3))+ MinValue;
NormalizedEUO.hide();

plot hist = if showHistogram then NormalizedEUO else Double.NaN;
hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
hist.SetLineWeight(5);
hist.DefineColor("Positive and Up", Color.GREEN);
hist.DefineColor("Positive and Down", Color.DARK_GREEN);
hist.DefineColor("Negative and Down", Color.RED);
hist.DefineColor("Negative and Up", Color.DARK_RED);
hist.AssignValueColor(if hist >= 0 then if hist > hist[1] then hist.Color("Positive and Up") else hist.Color("Positive and Down") else if hist < hist[1] then hist.Color("Negative and Down") else hist.Color("Negative and Up"));


plot ZeroLine = 0;
ZeroLine.SetDefaultColor(GetColor(4));
ZeroLine.HideTitle();

def over_bought = 40;
def overbought = over_bought;

def over_sold = -40;
def oversold = over_sold;

plot OS = if !isNaN(close) then OverSold else Double.NaN;
OS.SetPaintingStrategy(PaintingStrategy.Line);
OS.SetLineWeight(2);
OS.SetDefaultColor(Color.ORANGE);

plot OB = if !IsNaN(close) then OverBought else Double.NaN;
OB.SetPaintingStrategy(PaintingStrategy.Line);
OB.SetLineWeight(2);
OB.SetDefaultColor(Color.ORANGE);

def upSMI = NormalizedSMI crosses above oversold;
def upAvgSMI = NormalizedAvgSMI crosses above oversold;
def downSMI = NormalizedSMI crosses below overbought;
def downAvgSMI = NormalizedAvgSMI crosses below overbought;

plot UpSignal;
UpSignal.SetDefaultColor(Color.UPTICK);
UpSignal.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
UpSignal.SetLineWeight(3);

plot DownSignal;
DownSignal.SetDefaultColor(Color.DOWNTICK);
DownSignal.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
DownSignal.SetLineWeight(3);

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");

AssignPriceColor(if PaintBars then (if euo >= 0 then Color.GREEN else Color.RED) else Color.CURRENT);

AddCloud(NormalizedSMI, NormalizedAvgSMI, Color.GREEN, Color.RED);
 
@mc01439 Thanks for the kind words...It's good to know that the team's efforts are going to good use :) It looks like you've enhanced the SMI_DSS_EUO nicely... :cool: Thanks for sharing your thoughts and the images...Wish I had trends like that to play everyday...

Good Luck and Good Trading!
 
This is interesting, although I am not seeing what the DSS is really helping with though - it seems like the SMI is better, with more information, and faster signals. Maybe someone can explain what it is really helping with. Also, for those that like the SMI (my new favorite indicator), the Buy Low MP SMI indicator recently posted on here is really good. It has the ADX in the middle which reminds me of the Laguerre RSI in that it can help show the strength of a trend, which I find very helpful for entries and exits.
 
Thank-You to all that have worked on the SMI, DSS, EUO indicator. I never thought of making them into one indicator. Have done other multi-indicators in the past without much success. Wanted to show how I am testing as a possible scalping tool for the trading toolbox.


@mc01439 What is determining the candle coloring in your posted image? Please keep us posted on how your testing goes.
 
Hello,
I'm seeking your help on creating scan from (ChrisAutoTrendline post#7 in this thread ), I'm interested in scan when the price crosses trend1 and disregard the rest of the trend lines.
your help is appreciated.
 
Hello,
I'm seeking your help on creating scan from (ChrisAutoTrendline post#7 in this thread ), I'm interested in scan when the price crosses trend1 and disregard the rest of the trend lines.
your help is appreciated.
i've it. does any have trading view version of chrisautotrendline?
 

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

Thread starter Similar threads Forum Replies Date
S Smart Money Index (SMI) Indicator for ThinkorSwim Indicators 29

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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