The Universe of ThinkScript - Your One Stop Research Shop!

Thank you for sharing. Please enable the share settings in Google Drive so that we don't have to request for permission to view the document.
Hi @BenTen , You may want to move that Google Drive to the Tutorials and pin it. Would that work better? Just wondering. Take care!
 
@markos I thought it would suitable here since that Google Drive is a compilation of ToS resources similar to what we already have here. Hope you're doing well.
 
Hi guys. A lot of useful scripts have accumulated. I want to share in this thread.

First script is HIGH, LOW, OPEN, CLOSE – SUPPORT AND RESISTANCE LINE
The indicator will draw levels Opening, Close, High, and Low of a current and previous day on the chart.

Code:
#thinkscript indicator : OCHLO_levels
#It draws yesterday High, Low, Open, Close support and resistance line
#by thetrader.top
input sPeroid = {default DAY, WEEK, MONTH};
input iHigh = {default “yes”, “no”};
input iLow = {default “yes”, “no”};
input iClose = {default “yes”, “no”};
input iOpen = {default “yes”, “no”};
input iTodayOpen = {default “yes”, “no”};
plot pHigh = if !iHigh then high(period = sPeroid)[1] else Double.NaN;
plot pLow = if !iLow then low(period = sPeroid)[1] else Double.NaN;
plot pClose = if !iClose then close(period = sPeroid)[1] else Double.NaN;
plot pOpen = if !iOpen then open(period = sPeroid)[1] else Double.NaN;
plot pTodayOpen = if !iTodayOpen then open(period = sPeroid)[0] else Double.NaN;
pHigh.SetDefaultColor (Color.GREEN);
pHigh.SetPaintingStrategy(PaintingStrategy.DASHES);

"Outside Bar" Indicator

The indicator shows us the "Outside Bar" pattern.
It will be shown on any timeframe but I recommend looking at the daytime period. You will see a certain number of signals on the chart.

Code:
#thinkscript indicator: Outside_Bar.
#It shows the "Outside Bar" pattern
#by thetrader.top

def bSignalDown=open[1]<close[1]and high>high[1] and close<low[1] or open[1]>close[1] and high>high[1] and close<low[1];
def bSignalUp = open[1]>close[1] and low<low[1] and close>high[1] or open[1]<close[1] and low<low[1] and close>high[1];
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);

The "Inside Bar" candlestick pattern is shown with arrows when the candlestick pattern is formed in the chart. An Inside Bar is formed when price trades within the high and low range of the previous day, making the candle an inside day or an inside bar. The inside bar is therefore a two candlestick price pattern. An inside bar is also similar to a bullish or a bearish harami candlestick pattern.

⚙Install the indicator in Thinkorswim. There are no special settings, but you can set the color of the arrows, size and so on.
_______________________________________
Code:
#thinkscript indicator:Inside_Bar.
#Shows the pattern “Inside Bar”
#by thetrader.top

def bSignalDown = open[1]>close[1] and open<close and high<high[1] and low>low[1];
def bSignalUp = open[1]<close[1] and open>close and high<high[1] and low>low[1];
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);

📈 The Double Outside Bar candlestick pattern shows signals on the chart with arrows at the moment when such pattern is formed. The signal is very rare.

⚙ First, import indicator by using <Edit Studies> menu. It will appear on the list, but you cannot see it right away.You need to enter Studies – User Defined. Click on the necessary indicator and add - "Add Study". There are no special settings for this indicator.
_______________
Code:
#thinkscript indicator: Double_Outside_bar.
#Shows the pattern "Double Outside bar."
#by thetrader.top

def bSignalDown = 0;
def bSignalUp = high[2]<high[1] and high[1]<high and low[2]>low[1] and low[1]>low;
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);
 
Last edited by a moderator:
Double Inside Bar Indicator

📈Candlestick pattern indicator Double Inside Bar shows when the "inside bar" pattern is drawn on the chart 2 times in a row. The signal is very rare as in the "Double Outside bar" Indicator.

⚙First, import indicator by using <Edit Studies> menu. It will appear on the list, but you cannot see it right away.
You need to enter Studies – User Defined. Click on the necessary indicator and add - "Add Study". There are no special settings for this indicator.
________________
Code:
#thinkscript indicator: Double_Inside_bar.
#Shows the pattern "Double Inside bar"
#by thetrader.top

def bSignalDown = high[2]>high[1] and high[1]>high and low[2]<low[1] and low[1]<low;
def bSignalUp = 0;
plot down = if bSignalDown then high else double.NaN;
plot up = if bSignalUp then high else double.NaN;
up.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_up);
down.SetPaintingStrategy(paintingStrategy.BOOLEAN_ARROW_down);
up.setDefaultColor(color.LIGHT_green);
down.setDefaultColor(color.LIGHT_red);

qLGJ2d1.png
 
Last edited by a moderator:
Stan_L offered a treasure trove, but were you able to make money with them?? A treasure chest....but again will it help to make money.
Most of his code is for example purposes only and not necessarily designed for actual trade use, but some of the code does work well... I have used his examples as guides in writing my own custom studies...
 
Most of his code is for example purposes only and not necessarily designed for actual trade use, but some of the code does work well... I have used his examples as guides in writing my own custom studies...
Yes,...you are right, many experimental pieces....
 
Chris Stop Light Labels
This study contains just the labels from the Chris Stop Light dashboard found in post#18

JSBgO8b.png

MOMENTUM Red =lower price compared to price from 5 candles ago. Green =higher price compared to price from 5 candles ago
CCI<-100 price way below historic avg and falling=DARK Red. CCI<-100 price way below historic avg and rising=Violet.
CCI<0 price slightly below avg and falling=Red. CCI<0 price slightly below avg and rising=Violet.
CCI>0 price above and rising =Green. CCI>0 price above and falling =Red
CCI> 100 price way above historic avg and rising=Cyan. CCI> 100 price way above historic avg and falling=Violet.
RSI <20 =DARK Red. RSI>20 and rising =Green. RSI>80 =light Green. RSI<80 and falling =Red
MOBO price inside BOLLINGER BANDS=Red. Price above BB=Green. Price below BB=Violet
CHOP considered CHOPPY when the index is above 61.8=Red. Price is considered TRENDING when the index is below 38.2=Cyan. As the index rises above 50 and approaches CHOP=light Green. Otherwise, Green. Read more
ADX<20 =Red. ADX>20 =Green. ADX>40 =Cyan.
The Trend ALL creates an average for these indicators to determine if the trend is overall Bull/Bear
Squeeze Orange Labels are Squeezed or Not Squeezed +# of bars squeezed. Read more

Here is the share link: http://tos.mx/7nbKjCu
Code:
#Name: ChrisStoplight LABELS ONLY
#Programmed By: Chris Ball (xxx) on #1/31/09
#Added Choppiness and Squeeze Indicator by Mobius@Thinkscript Lounge
#Added FW_Mobo_Basic
#Modified to add/change indicators
#Modified to show labels only @MerryDay 12/2020
input rsilength = 5;
def c = close;
def h = high;
def l = low;
def o = open;

#MOMENTUM
input lengthmo = 5;
def Momentum = c - c[lengthmo];
def mopos = if Momentum >= 0 then 3 else 2;
def moneg = if Momentum < 0 then 3 else 2;

#CCI
input lengthcci = 13;
def pricecci = c + l + h;
def linDev = LinDev(pricecci, lengthcci);
def CCI = if linDev == 0 then 0 else (pricecci - Average(pricecci, lengthcci)) / linDev / 0.015;
def cci1 = if CCI >= 0 then 4 else 3;
def cci2 = if CCI < 0 then 4 else 3;

#RSI
def rsi = reference RSI(length = rsilength)."RSI";
def rsi1 = if rsi >= 50 then 5 else 4;
def rsi2 = if rsi < 50 then 5 else 4;

#Bollinger Bands MOBO
input lengthmobo = 10;
input Num_Dev_Dn = -0.8;
input Num_Dev_up = 0.8;

def sDev = StDev(data = c, length = lengthmobo);
def Midmobo = Average(c, length = lengthmobo);
def Lowermobo = Midmobo + Num_Dev_Dn * sDev;
def Uppermobo = Midmobo + Num_Dev_up * sDev;
def upmobo = if upmobo[1] == 0 and c >= Uppermobo then 1 else if upmobo[1] == 1 and c > Lowermobo then 1 else 0;
def upmo = if upmobo and c > Uppermobo then 1 else 0;
def dnmo = if !upmobo and c > Lowermobo then 1 else 0;
def mobo1 = if upmobo == 1 then 6 else 5;
def mobo2 = if upmobo == 0 then 6 else 5;

#Trend
#Choppiness Indicator from Mobius @My Trade with color changes by Lar
#Set ADX & SMA to how you trade
#Indicates Trending or Chop along with current ADX level

def ADXLength = 5; #TOS default 10
input AverageType = AverageType.HULL;
def AvgLength = 5; #TOS default 8
def Lengthchop = 8;
def Signal = 3;
def Choppy = 61.8;
def MidLine = 50;
def Trending = 38.2;
def ADX = Round(reference ADX(length = ADXLength), 0);
def AVG = MovingAverage(AverageType = AverageType, c, AvgLength);
def CIB = ((Log(Sum(TrueRange(h, c, l), Lengthchop) /
(Highest(if h >= c[1] then h else
c[1], Lengthchop) -
Lowest( if l <= c[1] then l else c[1], Lengthchop)))
/ Log(10)) / (Log(Lengthchop) / Log(10))) * 100;
def CI = CIB;

#Choppiness/Trend Indicator
def chop = if CI > MidLine then 7 else 6;
def trend1 = if CI < MidLine and c > AVG then 7 else 6;
def trend2 = if CI < MidLine and c < AVG then 7 else 6;

#Overall
def uptrend = if mopos == 3 and cci1 == 4 and rsi1 == 5 and mobo1 == 6 then 8 else 7;
def dntrend = if moneg == 3 and cci2 == 4 and rsi2 == 5 and mobo2 == 6 then 8 else 7;

#Squeeze by Mobius @ My Trade with color mod by Lar
#Look at Cloud Color as a possible indication of direction once squeeze ends
def nK = 1.5;
def nBB = 2.0;
def lengthsqueeze = 20;

def BBHalfWidth = StDev(c, lengthsqueeze);
def KCHalfWidth = nK * Average(TrueRange(h, c, l), lengthsqueeze);
def isSqueezed = nBB * BBHalfWidth / KCHalfWidth < 1;

#Squeeze for Longer Term Trend Indicator
def BBS_Ind = if isSqueezed then 8.2 else Double.NaN;

DefineGlobalColor("Pre_Cyan", CreateColor(0, 150, 200)) ;
DefineGlobalColor("LabelGreen",  CreateColor(0, 165, 0)) ;
DefineGlobalColor("Label2Green",  CreateColor(0, 200, 0)) ;
DefineGlobalColor("LabelRed",  CreateColor(225, 0, 0)) ;
AddLabel(yes, "MOMENTUM " + Round(Momentum, 2), if Momentum >= 0 then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes,
if CCI < -100 and CCI > CCI[1] then "CCI down but rising "  +round(CCI,0) else
if CCI < -100                  then "CCI down & falling "  +round(CCI,0) else
if CCI >  100 and CCI > CCI[1] then "CCI TRENDING "  +round(CCI,0) else
if CCI >  100                  then "CCI Hi but falling "  +round(CCI,0) else
if CCI <    0 and CCI > CCI[1] then "CCI low but rising "  +round(CCI,0) else
if CCI <    0                  then "CCI low & falling "  +round(CCI,0) else
if CCI > CCI[1]                then "CCI Rising " +round(CCI,0) else "CCI Falling " +round(CCI,0),
if CCI < -100 and CCI > CCI[1] then color.violet else
if CCI < -100                  then color.dark_red  else
if CCI >  100 and CCI > CCI[1] then GlobalColor("Pre_Cyan") else
if CCI >  100                  then color.violet else
if CCI <    0 and CCI > CCI[1] then color.violet else
if CCI <    0                  then GlobalColor("LabelRed") else
if CCI > CCI[1]                then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes,
if rsi < 20   then "RSI bottom " +round(rsi,0) else
if rsi > 80   then "RSI max " +round(rsi,0) else
if rsi > rsi[1] then "RSI Rising " +round(rsi,0) else "RSI Falling " +round(rsi,0),
if rsi < 20   then Color.Dark_red else
if rsi > 80   then GlobalColor("Label2Green") else
if rsi > rsi[1] then GlobalColor("LabelGreen") else GlobalColor("LabelRed"));
AddLabel(yes, if upmobo and upmo then "Mobo Above Upper" else
              if !upmo and dnmo  then "Mobo Below Lower" else "Mobo Inside",
              if upmobo and upmo then GlobalColor("LabelGreen") else
              if !upmo and dnmo then color.violet else GlobalColor("LabelRed"));
AddLabel(yes, if CI < 38.2 then "Trending " +round(CI,0) else
              if CI > 61.8 then "CHOPPY " +round(CI,0) else "No Chop " +round(CI,0),
              if CI < 38.2 then GlobalColor("Pre_Cyan") else
              if CI > 61.8 then GlobalColor("LabelRed") else
              if CI > midLine then GlobalColor("Label2Green") else GlobalColor("LabelGreen"));
AddLabel(yes,
if ADX <= 20   then "ADX No Trend " +round(ADX,0) else
if ADX >  40   then "ADX WOW " +round(ADX,0) else  "ADX Trending " +round(ADX,0),
if ADX < 20    then GlobalColor("LabelRed") else
if ADX > 40    then GlobalColor("Pre_Cyan") else GlobalColor("LabelGreen"));

AddLabel(yes, if uptrend == 8 then "Trend All Up " else if dntrend == 8 then "Trend All Down " else "Trend Mixed ", if uptrend == 8 then GlobalColor("LabelGreen") else if dntrend == 8 then GlobalColor("LabelRed") else Color.GRAY);
#Count of Periods in consecutive squeeze
rec count = if isSqueezed then count[1] + 1 else 0;
AddLabel(yes, if isSqueezed then Concat("Squeeze ", count) else "No Squeeze", Color.DARK_ORANGE);
 
Last edited:
@rjg212 I edited the above post to include how the bull/bear labels are calculated and included links to the less common indicators.

CCI, RSI, BOLLINGER BANDS, ADX are the gold standard for technical indicators. A google search will provide a plethora of information.

HTH
 
Last edited:
@MerryDay What I'm not understanding is for ADX, its showing right now on CHWY at 69 but when I scroll my mouse along the chart, the values in the title and on the graph change, But the values in the SHOW LABELS section are only showing today. Is there a way to make the labels sync with my mouse?

Edit:

So the one you posted doesn't show anything and the key with the title is disappearing. Like, when I hold my mouse over the one you linked, it shows Y: N/A and then that entire line disappears when my mouse goes back up to the chart. I will try to tweak some things as yours shows more info on the Labels, but I like the mass of info on post#18 of this thread.
 
Last edited:
@mourningwood4521 I didn't write the definitions; just took them as Chris Ball wrote them and made them into labels.

Go look at Stanl's more comprehensive dashboard that @markos put together. Be sure to read his notes. Try posting both of the studies on a chart and comparing the effect of different indicator settings.

Come back here and let us know what you learn. I will modify the labeling scheme with anything you find interesting.
 
Last edited:

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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