Triple TSI For ThinkOrSwim

Hoinar

New member
VIP
I need help with coding a triple TSI.
One fast TSI(5,3) an average TSI (13, 8) and a slow one (34, 21). How can I combine them in one chart, so when all are moving in the same direction (up-green, down-red) and when there are divergences between them, blue for example? Anybody has this setup, maybe I can try it and tweak it? Thanks in advance.
 

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

@Hoinar
Looks a little messy, Maybe you can clean it up.
Ruby:
declare lower;

input FastlongLength = 5;
input FastshortLength = 3;

input AvglongLength = 13;
input AvgshortLength = 8;

input SlowlongLength = 18;
input SlowshortLength = 21;

input averageType = AverageType.EXPONENTIAL;

def TSIFast = TrueStrengthIndex(averagetype,Fastlonglength,Fastshortlength).Signal;
def TSIAvg = TrueStrengthIndex(averagetype,Avglonglength,Avgshortlength).Signal;
def TSISlow = TrueStrengthIndex(averagetype,Slowlonglength,Slowshortlength).Signal;

def TSIFU = TSIFast>TSIFast[1];
def TSIAU = TSIAvg>TSIAvg[1];
def TSISU = TSISlow>TSISlow[1];

def TSIFD = TSIFast<TSIFast[1];
def TSIAD = TSIAvg<TSIAvg[1];
def TSISD = TSISlow<TSISlow[1];

plot TSIFP = TSIFast;
TSIFP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
plot TSIAP = TSIAvg;
TSIAP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
plot TSISP = TSISlow;
TSISP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
rvxPhm0.png
 
This may not be what you are looing for but I took your triple TSI , I weighted them then averaged , took the average and broke them down against the zero line, broke the Combo line into 4 regions, color coded them, added deviation zones, added arrows
Code:
declare lower;

input AlongLength = 5;
input AshortLength = 3;

input BlongLength = 13;
input BshortLength = 8;

input ClongLength = 21;
input CshortLength =18;

input averageType = AverageType.EXPONENTIAL;

input Arrows = 0;
input Dotsize = 3;
Input APC =0;

def TSIFast = TrueStrengthIndex(averagetype,Alonglength,Ashortlength).Signal;
def TSIAvg = TrueStrengthIndex(averagetype,Blonglength,Bshortlength).Signal;
def TSISlow = TrueStrengthIndex(averagetype,Clonglength,Cshortlength).Signal;
Plot TSICombo = (TSIFast +2*TSIAvg + 3*TSISlow)/6;

Def Con1 = TSICombo>= 0;
Def Con2 = TSICombo < 0;
Def Con3 = TSICombo > TSICombo[1];
Def Con4 = TSICombo < TSICombo[1];
Def BullRise = If Con1 and Con3 then 1 else 0;
Def BullFall = if Con1 and Con4 then 1 else 0;
Def BearFall = if Con2 and Con4 then 1 else 0;
Def BearRise = if Con2 and Con3 then 1 else 0;

TSICombo.assignValueColor(If TSICombo >= TSICombo[1] then Color.Green else Color.Red); 
TSICombo.setLineWeight(3);
AddCloud(TSICombo,0,Color.Green,Color.Red);
plot Hist = TSICombo;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.AssignValueColor(if BULLRISE ==1 then Color.GREEN else if BULLFALL ==1 then Color.Dark_GREEN else if BearRISE ==1 then Color.red else if Bearfall ==1 then Color.Dark_Red else Color.Gray);

Plot UZ = Average(TSICombo,34) + (1.3185*StDev(TSICombo,34));
UZ.SetPaintingStrategy(PaintingStrategy.Line);
UZ.SetLineWeight(2);
UZ.SetDefaultColor(Color.Yellow);
Plot LZ = Average(TSICombo,34) - (1.3185*StDev(TSICombo,34));
LZ.SetPaintingStrategy(PaintingStrategy.Line);
LZ.SetLineWeight(2);
LZ.SetDefaultColor(Color.Yellow);

#ARROWS
plot ArrowDown = if arrows and (TSICombo Crosses below TSICombo[1]) then TSICombo[1] else double.nan;
ArrowDown.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown.setDefaultColor(color.Magenta);
ArrowDown.setLineWeight(dotsize);
plot ArrowUp = if arrows and (TSICombo crosses above TSICombo[1]) then TSICombo[1] else double.nan;
ArrowUp.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp.setDefaultColor(color.Cyan);
ArrowUp.setLineWeight(dotsize);
plot ArrowDown2 = if arrows and (TSICombo Crosses below 0) then 0 else double.nan;
ArrowDown2.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown2.setDefaultColor(color.Red);
ArrowDown2.setLineWeight(dotsize);
plot ArrowUp2 = if arrows and (TSICombo crosses above 0 ) then 0 else double.nan;
ArrowUp2.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp2.setDefaultColor(color.Blue);
ArrowUp2.setLineWeight(dotsize);
plot ArrowDown3 = if arrows and (TSICombo Crosses below UZ) then UZ else double.nan;
ArrowDown3.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown3.setDefaultColor(color.Yellow);
ArrowDown3.setLineWeight(dotsize);
plot ArrowUp3 = if arrows and (TSICombo crosses above LZ ) then LZ else double.nan;
ArrowUp3.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp3.setDefaultColor(color.Yellow);
ArrowUp3.setLineWeight(dotsize);

AssignPriceColor( if APC ==1 and TSICombo>= TSICombo[1] then Color.Cyan else if APC == 1 and TSICombo < TSICombo[1] then Color.Magenta else If APC ==2 and TSICombo >=0 then Color.Green else If APC ==2 and TSICombo <0 then Color.Red else Color.Current);
 
Last edited:
@Hoinar
Looks a little messy, Maybe you can clean it up.
Ruby:
declare lower;

input FastlongLength = 5;
input FastshortLength = 3;

input AvglongLength = 13;
input AvgshortLength = 8;

input SlowlongLength = 18;
input SlowshortLength = 21;

input averageType = AverageType.EXPONENTIAL;

def TSIFast = TrueStrengthIndex(averagetype,Fastlonglength,Fastshortlength).Signal;
def TSIAvg = TrueStrengthIndex(averagetype,Avglonglength,Avgshortlength).Signal;
def TSISlow = TrueStrengthIndex(averagetype,Slowlonglength,Slowshortlength).Signal;

def TSIFU = TSIFast>TSIFast[1];
def TSIAU = TSIAvg>TSIAvg[1];
def TSISU = TSISlow>TSISlow[1];

def TSIFD = TSIFast<TSIFast[1];
def TSIAD = TSIAvg<TSIAvg[1];
def TSISD = TSISlow<TSISlow[1];

plot TSIFP = TSIFast;
TSIFP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
plot TSIAP = TSIAvg;
TSIAP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
plot TSISP = TSISlow;
TSISP.AssignValueColor(if TSIFU and TSIAU and TSISU then Color.Green else if TSIFD and TSIAD and TSISD then Color.RED else Color.Blue);
rvxPhm0.png
Is a great start, what can I say? This in combination with few more indicators (BTD, TP, Mobius TMO) is what I was looking for. This weekend I will be playing with it and test it on different time frames and stocks. Thank you and Ben for putting this community together.
 
This may not be what you are looing for but I took your triple TSI , I weighted them then averaged , took the average and broke them down against the zero line, broke the Combo line into 4 regions, color coded them, added deviation zones, added arrows
Code:
declare lower;

input AlongLength = 5;
input AshortLength = 3;

input BlongLength = 13;
input BshortLength = 8;

input ClongLength = 21;
input CshortLength =18;

input averageType = AverageType.EXPONENTIAL;

input Arrows = 0;
input Dotsize = 3;
Input APC =0;

def TSIFast = TrueStrengthIndex(averagetype,Alonglength,Ashortlength).Signal;
def TSIAvg = TrueStrengthIndex(averagetype,Blonglength,Bshortlength).Signal;
def TSISlow = TrueStrengthIndex(averagetype,Clonglength,Cshortlength).Signal;
Plot TSICombo = (TSIFast +2*TSIAvg + 3*TSISlow)/6;

Def Con1 = TSICombo>= 0;
Def Con2 = TSICombo < 0;
Def Con3 = TSICombo > TSICombo[1];
Def Con4 = TSICombo < TSICombo[1];
Def BullRise = If Con1 and Con3 then 1 else 0;
Def BullFall = if Con1 and Con4 then 1 else 0;
Def BearFall = if Con2 and Con4 then 1 else 0;
Def BearRise = if Con2 and Con3 then 1 else 0;

TSICombo.assignValueColor(If TSICombo >= TSICombo[1] then Color.Green else Color.Red);
TSICombo.setLineWeight(3);
AddCloud(TSICombo,0,Color.Green,Color.Red);
plot Hist = TSICombo;
Hist.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Hist.AssignValueColor(if BULLRISE ==1 then Color.GREEN else if BULLFALL ==1 then Color.Dark_GREEN else if BearRISE ==1 then Color.red else if Bearfall ==1 then Color.Dark_Red else Color.Gray);

Plot UZ = Average(TSICombo,34) + (1.3185*StDev(TSICombo,34));
UZ.SetPaintingStrategy(PaintingStrategy.Line);
UZ.SetLineWeight(2);
UZ.SetDefaultColor(Color.Yellow);
Plot LZ = Average(TSICombo,34) - (1.3185*StDev(TSICombo,34));
LZ.SetPaintingStrategy(PaintingStrategy.Line);
LZ.SetLineWeight(2);
LZ.SetDefaultColor(Color.Yellow);

#ARROWS
plot ArrowDown = if arrows and (TSICombo Crosses below TSICombo[1]) then TSICombo[1] else double.nan;
ArrowDown.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown.setDefaultColor(color.Magenta);
ArrowDown.setLineWeight(dotsize);
plot ArrowUp = if arrows and (TSICombo crosses above TSICombo[1]) then TSICombo[1] else double.nan;
ArrowUp.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp.setDefaultColor(color.Cyan);
ArrowUp.setLineWeight(dotsize);
plot ArrowDown2 = if arrows and (TSICombo Crosses below 0) then 0 else double.nan;
ArrowDown2.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown2.setDefaultColor(color.Red);
ArrowDown2.setLineWeight(dotsize);
plot ArrowUp2 = if arrows and (TSICombo crosses above 0 ) then 0 else double.nan;
ArrowUp2.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp2.setDefaultColor(color.Blue);
ArrowUp2.setLineWeight(dotsize);
plot ArrowDown3 = if arrows and (TSICombo Crosses below UZ) then UZ else double.nan;
ArrowDown3.setpaintingStrategy(paintingStrategy.Arrow_Down);
ArrowDown3.setDefaultColor(color.Yellow);
ArrowDown3.setLineWeight(dotsize);
plot ArrowUp3 = if arrows and (TSICombo crosses above LZ ) then LZ else double.nan;
ArrowUp3.setpaintingStrategy(paintingStrategy.Arrow_Up);
ArrowUp3.setDefaultColor(color.Yellow);
ArrowUp3.setLineWeight(dotsize);

AssignPriceColor( if APC ==1 and TSICombo>= TSICombo[1] then Color.Cyan else if APC == 1 and TSICombo < TSICombo[1] then Color.Magenta else If APC ==2 and TSICombo >=0 then Color.Green else If APC ==2 and TSICombo <0 then Color.Red else Color.Current);
Henry, thank you also for your help here. Both of you coded what I was looking for and now I just need to test it and use it. Seems that this is more dynamic than any indicators I have been using, able to pick up better entries and exits. I am seeing it for day and intraday trading, but this is great help. Will have plenty of time in front of the computer this weekend and look for productive trades next week.
 
Henry, thank you also for your help here. Both of you coded what I was looking for and now I just need to test it and use it. Seems that this is more dynamic than any indicators I have been using, able to pick up better entries and exits. I am seeing it for day and intraday trading, but this is great help. Will have plenty of time in front of the computer this weekend and look for productive trades next week.
@Hoinar this is looking great, are you looking at the triple sync logic system, just trying to get away from the 3 charts that Tood R uses?? I've done my own triple sync version just using TOS indicators and matching as close as possible to what Todd is doing?? The RSI Laguerre indicators have worked the best, I used 8, 13 and 21 EMA's and SuperTrend without the labels just the dots to give you the entry's from the 2 min & 1 min chart, the 5 min is mainly used for the heads up once in oversold/overbought ranges!! Let me know how you do, Id be willing to give you a code for what I was using if you like the 3 chart setup??
 
Henry, thank you also for your help here. Both of you coded what I was looking for and now I just need to test it and use it. Seems that this is more dynamic than any indicators I have been using, able to pick up better entries and exits. I am seeing it for day and intraday trading, but this is great help. Will have plenty of time in front of the computer this weekend and look for productive trades next week.
@Hi I just started looking at this system. I loaded this thinkscript onto a chart. I am wondering how you are using it?
 
@Hoinar this is looking great, are you looking at the triple sync logic system
@Hi I just started looking at this system. I loaded this thinkscript onto a chart. I am wondering how you are using it?
Did you know that clicking on a member's avatar will allow you to see when a member was last seen on the uTS forum? @Hoinar has not been back. :(

To learn more about the True Strength Index:
https://school.stockcharts.com/doku.php?id=technical_indicators:true_strength_index

The OP stated that he looks for:
all are moving in the same direction (up-green, down-red) and when there are divergences between them
 
@Hoinar this is looking great, are you looking at the triple sync logic system, just trying to get away from the 3 charts that Tood R uses?? I've done my own triple sync version just using TOS indicators and matching as close as possible to what Todd is doing?? The RSI Laguerre indicators have worked the best, I used 8, 13 and 21 EMA's and SuperTrend without the labels just the dots to give you the entry's from the 2 min & 1 min chart, the 5 min is mainly used for the heads up once in oversold/overbought ranges!! Let me know how you do, Id be willing to give you a code for what I was using if you like the 3 chart

Thank you for all the work. Would you be willing to share the code that you are using for the 3 chart system?
 
Thank you for all the work. Would you be willing to share the code that you are using for the 3 chart system?
Did you know that clicking on a member's name will allow you to see when a member was last seen on the uTS forum? @mrtreasures has not been seen in a while. :(
You can add the indicators that are mentioned in the post.
Get Moving Averages from here:
https://usethinkscript.com/threads/stacked-moving-averages-for-thinkorswim.4719/page-2#post-72617
And choose your favorite SuperTrend:
https://usethinkscript.com/search/8...1&c[nodes][0]=3&c[title_only]=1&o=replies&g=1
 
This may not be what you are looing for but I took your triple TSI , I weighted them then averaged , took the average and broke them down against the zero line, broke the Combo line into 4 regions, color coded them, added deviation zones, added arrows

Thank you for this code. even without totally under standing it I able to make better entry/exits. I would like to learn how to use it more efficiently, can you point me in the right direction. sincerely
 
Last edited by a moderator:
Thank you for this code. even without totally under standing it I able to make better entry/exits. I would like to learn how to use it more efficiently, can you point me in the right direction. sincerely
The True Strength Index (TSI) can be used for various purposes.
Google these search terms to determine which purpose suits you best:
  • spotting divergences
  • determining overbought/oversold conditions
  • and generating trading signals.
 
The True Strength Index (TSI) can be used for various purposes.
Google these search terms to determine which purpose suits you best:
  • spotting divergences
  • determining overbought/oversold conditions
  • and generating trading signals.
thanks
 
@Hoinar this is looking great, are you looking at the triple sync logic system, just trying to get away from the 3 charts that Tood R uses?? I've done my own triple sync version just using TOS indicators and matching as close as possible to what Todd is doing?? The RSI Laguerre indicators have worked the best, I used 8, 13 and 21 EMA's and SuperTrend without the labels just the dots to give you the entry's from the 2 min & 1 min chart, the 5 min is mainly used for the heads up once in oversold/overbought ranges!! Let me know how you do, Id be willing to give you a code for what I was using if you like the 3 chart setup??
Hi Mrtreasures, I know this is an old post, but maybe with some luck you'll log in some time soon and see this. The annoying part of Todd R system is it is only for tradestation. Do you still have the code for triple sync on TOS?
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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