Accumulative $TICK Meter and Index for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
Someone recently mentioned that the $TICK index can be used for trend confirmation. I just came across this post in the Yahoo thinkScript group so I thought I would share it here as well.



Accumulative $TICK Meter

Code:
#Hint: The NYSE TICK represents, at any given moment, the net number of stocks in the broad market that are trading at their offer prices minus those trading at their bids. When the NYSE TICK becomes very positive, it means that traders are lifting offers in the broad market: buyers are quite aggressive. When the TICK becomes very negative, it means that traders are hitting bids in the broad market: sellers are very aggressive. \n The swings in the NYSE TICK during the day, then, represent relative swings in short-term trader sentiment. The beauty of the measure is that it is assessing what bulls and bears are actually doing in the marketplace; not what they report as their sentiment or what they try to fool others into believing. \n

declare lower;
def upper = no;
input hidecumtick = yes;
input symbol = "$TICK"; #HINT symbol: Default SYMBOL is $TICK (New York Stock Exchange). This can be changed to see the tick values for the Russel 2000, the NASDAQ and many others.
input period = 20;
input smooth = 5;
input lookback = 4;
input filter = 300;
def p = period;
def i = barNumber();
def na = double.nan;
#input usetrend = {"No", default "Yes"};
def usetrend = yes;
rec htick = if IsNaN(high(symbol)) then htick[1] else high("$TICK") ;
rec ltick = if IsNaN(low(symbol)) then ltick[1] else low("$TICK");
rec avgh = if i == 1 then htick else Max(filter, avgh[1] + 2 / (p + 1) * (htick - avgh[1]));
rec avgl = if i == 1 then ltick else Min(-filter, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));

def hi = high("$TICK");
def lo = low("$TICK");

plot Last = if IsNaN(close(symbol)[-1]) then close(symbol) else double.nan;

plot amean = if IsNaN(close) then na else (avgh + avgl) / 2;
def trendmean = if usetrend AND (htick > avgh OR ltick < avgl) then amean else 0;

def bull = if htick > avgh then htick - avgh  else 0;
def bear = if ltick < avgl then ltick - avgl  else 0;

rec ctick = if i == 1 then 0 else if IsNaN(htick) OR IsNaN(ltick) then ctick[1] else ctick[1] + bull + bear + trendmean; 

def ctickavg = ExpAverage(ctick, smooth);
plot cumtick = if IsNaN(close) then na else ctickavg;
plot nettick = if IsNaN(close) then na else ctick;

plot zero = 0;
cumtick.AssignValueColor(if cumtick > cumtick[lookback] then color.green else color.red);
AssignPriceColor(if !upper then color.current else if cumtick > cumtick[lookback] AND ltick < avgl then color.green else if cumtick > cumtick[lookback] then color.gray else if cumtick < cumtick[lookback] AND htick > avgh then color.red else color.gray);
cumtick.SetLineWeight(2);
def hcumtick=if !hidecumtick then cumtick else na;
def hzero=if !hidecumtick then zero else na;
AddCloud(hcumtick, hzero );
plot buy = if cumtick > cumtick[lookback] AND ltick < avgl then low - tickSize() else if cumtick > cumtick[lookback] then na else if cumtick < cumtick[lookback] AND htick > avgh then na else na;
plot sell = if cumtick > cumtick[lookback] AND ltick < avgl then na else if cumtick > cumtick[lookback] then na else if cumtick < cumtick[lookback] AND htick > avgh then high + tickSize() else na;

plot ahi = if IsNaN(close) then na else avgh;
plot alo = if IsNaN(close) then na else avgl;
plot hib = if hi < 0 then hi else na;
plot lob = if lo > 0 then lo else na;
plot phi = hi;
plot plo = lo;

buy.SetDefaultColor(color.green);
buy.SetPaintingStrategy(paintingStrategy.ARROW_UP);
sell.SetDefaultColor(color.red);
sell.SetPaintingStrategy(paintingStrategy.ARROW_DOWN);

#plot zero=0;
#
# Formatting:
#
hib.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
hib.SetDefaultColor(color.black);
hib.SetLineWeight(5);
lob.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
lob.SetDefaultColor(color.black);
lob.SetLineWeight(5);

Last.SetDefaultColor(Color.white);
Last.SetPaintingStrategy(paintingStrategy.DASHES);
phi.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
phi.AssignValueColor(if hi > ahi then color.dark_GREEN else color.gray);
phi.SetLineWeight(5);
plo.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
plo.AssignValueColor(if lo < alo then color.dark_red else color.gray);
plo.SetLineWeight(5);
zero.SetDefaultColor(color.gray);
zero.SetLineWeight(1);
amean.AssignValueColor(if cumtick > cumtick[lookback] then color.green else color.red);
amean.SetLineWeight(5);
amean.SetStyle(curve.POINTS);
ahi.SetDefaultColor(color.green);
ahi.SetStyle(curve.SHORT_DASH);
alo.SetDefaultColor(color.red);
alo.SetStyle(curve.SHORT_DASH);

#Hiding depending on if upper or lower
phi.setHiding(upper);
plo.setHiding(upper);
zero.setHiding(upper);
last.setHiding(upper);
hib.setHiding(upper);
lob.setHiding(upper);

ahi.setHiding(upper);
alo.setHiding(upper);
cumtick.setHiding(hidecumtick);
nettick.setHiding(hidecumtick);
buy.setHiding(!upper);
sell.setHiding(!upper);

amean.setHiding(upper);

Simple TICK Meter

Code:
##### Simple Tick
##### Made By Signet
##### Version 1.0
##### 11/22/2018
##### Revised 12/19/2018
#https://www.dummies.com/personal-finance/investing/day-trading/how-to-use-the-tick-and-trin-in-day-trading/
##http://tradingsmart.net/indicators/tick-trin-label/
#Hint: TICK and TRIN are two indicators that measure the general sentiment of the market. They can be used both to determine near term market movement. Theses indicators are not well know by traders. TRIN is a calculator, its formula is ((Advancing issues/declining issues) / (advancing volume/declining volume)), it's a contrarian indicator to detect overbought and oversold levels in the market.

#How to day trade with these indicators? TICK value between +200 and -300 indicate a neutral market sentiment. It became bullish when its value became higher than +200 and bearish when it is lower -300. Very bullish when its value is higher than +500 and very bearish when it is lower than -500. Note that when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon. Generally a rising TRIN is bearish and a falling TRIN is bullish. A TRIN value higher than 1 is bearish while bullish when it is below 0.9
declare lower;

plot HighTick = high("$tick");
plot LowTick = low ("$tick");
#plot ZeroLine = 0;
plot up = 800;
plot down = -1000;
plot Noise = 600;
plot Noise2 = -600;
Noise.SetDefaultColor(Color.dark_orange);
Noise2.SetDefaultColor(Color.dark_orange);
up.SetDefaultColor(Color.UPTICK);
down.SetDefaultColor(Color.UPTICK);
HighTick.AssignValueColor(if HighTick >= 800 then Color.UPTICK else Color.DOWNTICK );
HighTick.SetLineWeight(2);
HighTick.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
LowTick.AssignValueColor(if LowTick <= -1000 then Color.DOWNTICK else Color.DOWNTICK);
LowTick.SetLineWeight(2);
LowTick.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);

def Trin = close("$TRIN");
plot Zeroline = 0;
Zeroline.AssignValueColor(if Trin <= 1 then Color.GREEN else if Trin > 1 then Color.dark_Orange else Color.dark_GRAY);
Zeroline.SetLineWeight(2);
Zeroline.SetPaintingStrategy(PaintingStrategy.POINTS);

input show_Trin = yes;
AddLabel(show_Trin, Concat("$TRIN: ", Trin) + if Trin > 1 then " : Sellers Market" else if Trin < 1 then " : Buyers Market" else "", if Trin <= 1 then Color.dark_GREEN else Color.RED);
#A trin of less than 1.00 usually means that a lot of buyers are acting strongly. A trin above 1.00 indicates that the sellers are acting more strongly.
#
def Tick = close("$TICK");
#If the tick is a positive number, that’s good: The market as a whole has a lot of buying interest. A positive tick shows that most people in the market have a positive perspective right now. Extremes show a catalyst event, and this label will stay gray unless an extreme tick is present.
#
def NeutralMarket_Top = +200; 
#Hint NeutralMarket_Top: TICK value between +200 and -300 indicate a neutral market sentiment.
def NeutralMarket_Bottom = -300;
#Hint NeutralMarket_Top: TICK value between +200 and -300 indicate a neutral market sentiment.
def BullishValue = +500;
#Hint BullishValue: Very bullish when its value is higher than +500.
def BearishValue = -500;
#Hint BullishValue: Very  bearish when it is lower than -500.
def Upper_Xtreme_Limit = 999;
 #Hint Upper_Xtreme_Limit: when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon.
def Lower_Xtreme_Limit = -999;
 #Hint Lower_Xtreme_Limit: when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon.
def Upper_Caution_Limit = 600;
#Hint Upper_Caution_Limit: Causes Label to change color when $TICK reaches this number.   
def Lower_Caution_Limit = -600;
#Hint Lower_Caution_Limit: Causes Label to change color when $TICK reaches this number.
input show_tick = yes;
AddLabel (show_tick, Concat("$TICK: ", Tick) +

if (close < NeutralMarket_Top and close > NeutralMarket_Bottom) then " Neutral Market"  else

if (close > NeutralMarket_Top and close < BullishValue ) then " Bullish Position" else 

if (close > BullishValue and close < Upper_Caution_Limit)   then " Bullish Extreme" else

if close > Upper_Xtreme_Limit then " CAUTION Upper Extreme" else

if (close < NeutralMarket_Bottom and close > BearishValue ) then " Bearish Position" else

if (close < BearishValue and close > Lower_Caution_Limit) then " Bearish Extreme" else

if close < Lower_Xtreme_Limit then "  CAUTION Upper Extreme" else "",

if (close > 0 and close < NeutralMarket_Top ) then Color.DARK_GREEN else

if (close > NeutralMarket_Top and close < BullishValue ) then Color.dark_GREEN else

if (close > BullishValue and close < Upper_Caution_Limit)   then Color.dark_GREEN else

if (close > Upper_Caution_Limit and close < Upper_Xtreme_Limit)   then Color.blue else

if close > Upper_Xtreme_Limit   then Color.RED else

if (close < 0 and close > NeutralMarket_Bottom ) then Color.DARK_RED else

if (close < NeutralMarket_Bottom and close > BearishValue ) then Color.red else

if (close < BearishValue and close > Lower_Caution_Limit)   then Color.DARK_ORANGE else

if (close < Lower_Caution_Limit and close > Lower_Xtreme_Limit) then Color.RED else

if close < Lower_Xtreme_Limit then Color.RED else Color.dark_GRAY);

def A = close(“$UVOL”);
def D = close (“$DVOL”);

def C = close(“$ADVN”);
def E = close (“$DECN”);

#addlabel (yes, If ((C / E) / (A / D)) > 1 then "Trin Decline " else if  ((C / E) / (A / D)) < 1 then "Trin Advance" else "", If  ((C / E) / (A / D)) > 1 then color.red else if  ((C / E) / (A / D)) < 1 then color.green else color.gray);

$TICK and $TRIN Meters with Labels

Code:
##### Smart Tick
##### Made By Signet
##### Version 1.0
##### 11/22/2018
##### Revised 12/19/2018
#https://www.dummies.com/personal-finance/investing/day-trading/how-to-use-the-tick-and-trin-in-day-trading/
##http://tradingsmart.net/indicators/tick-trin-label/
#Hint: TICK and TRIN are two indicators that measure the general sentiment of the market. They can be used both to determine near term market movement. Theses indicators are not well know by traders. TRIN is a calculator, its formula is ((Advancing issues/declining issues) / (advancing volume/declining volume)), it's a contrarian indicator to detect overbought and oversold levels in the market.

#How to day trade with these indicators? TICK value between +200 and -300 indicate a neutral market sentiment. It became bullish when its value became higher than +200 and bearish when it is lower -300. Very bullish when its value is higher than +500 and very bearish when it is lower than -500. Note that when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon. Generally a rising TRIN is bearish and a falling TRIN is bullish. A TRIN value higher than 1 is bearish while bullish when it is below 0.9
#declare hide_on_daily;
Declare lower;
def NeutralMarket_Top = +200; 
#Hint NeutralMarket_Top: TICK value between +200 and -300 indicate a neutral market sentiment.
def NeutralMarket_Bottom = -300;
#Hint NeutralMarket_Top: TICK value between +200 and -300 indicate a neutral market sentiment.
def BullishValue = +500;
#Hint BullishValue: Very bullish when its value is higher than +500.
def BearishValue = -500;
#Hint BullishValue: Very  bearish when it is lower than -500.
def Upper_Xtreme_Limit = 999;
 #Hint Upper_Xtreme_Limit: when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon.
def Lower_Xtreme_Limit = -999;
 #Hint Lower_Xtreme_Limit: when TICK is higher than +1000 or lower than -1000, then a reversal of the market will probably happen soon.
def Upper_Caution_Limit = 600;
#Hint Upper_Caution_Limit: Causes Label to change color when $TICK reaches this number.   
def Lower_Caution_Limit = -600;
#Hint Lower_Caution_Limit: Causes Label to change color when $TICK reaches this number.
  
Plot Tick = close("$TICK");
Plot Trin = close("$TRIN");
Trin.AssignValueColor(if Trin < 1 THEN COLOR.Uptick ELSE COLOR.Downtick);

plot Upper_Xtreme = if tick > Upper_Xtreme_Limit then Upper_Xtreme_Limit else double.nan;
Upper_Xtreme.AssignValueColor(COLOR.white);;
Upper_Xtreme.AssignValueColor(COLOR.white);

plot Upper_Limit = if tick > Upper_Caution_Limit then Upper_Caution_Limit else double.nan;
Upper_Limit.AssignValueColor(COLOR.RED);

plot Bullishbottom = NeutralMarket_Top;
Bullishbottom.AssignValueColor(COLOR.Green);

plot BullishTop = BullishValue;
BullishTop.AssignValueColor(COLOR.dark_Green);

plot BearishBottom = NeutralMarket_Bottom;
Bearishbottom.AssignValueColor(COLOR.Red);

plot BearishTop = BearishValue;
BearishTop.AssignValueColor(COLOR.dark_Red);

plot Lower_Limit = if tick < Lower_Caution_Limit then Lower_Caution_Limit else double.nan ;
Lower_Limit.AssignValueColor(COLOR.RED);

plot Lower_Xtreme = if tick < lower_Xtreme_Limit then lower_Xtreme_Limit else double.nan ;
Lower_Xtreme.AssignValueColor(COLOR.white);

Tick.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
Tick.DefineColor("Positive", Color.UPTICK);
Tick.DefineColor("Negative", Color.DOWNTICK);
tick.definecolor("Extreme", color.cyan);
tick.definecolor("neutral", color.gray);
tick.definecolor("bullish",color.blue);
tick.definecolor("bearish",color.dark_orange);
Tick.AssignValueColor(
if (Tick >= neutralMarket_bottom and tick <= neutralMarket_top)  then Tick.color("neutral") else
if (Tick > NeutralMarket_Top and tick < Upper_Caution_Limit) then Tick.color("Positive") else
if (Tick < NeutralMarket_bottom and tick > Lower_Caution_Limit) then Tick.color("Negative") else
if (Tick > Upper_Caution_Limit and tick < Upper_Xtreme_Limit)  then  Tick.color("Bullish")  else
if  (Tick < Lower_Caution_Limit and tick > Lower_Xtreme_Limit)  then  Tick.color("bearish")  else
if tick > Upper_Xtreme_Limit or tick < Lower_Xtreme_Limit then Tick.color("Extreme")
else Tick.color("neutral"));

#A trin of less than 1.00 usually means that a lot of buyers are acting strongly. A trin above 1.00 indicates that the sellers are acting more strongly.
INPUT SHOW_trin = YES;
AddLabel(SHOW_trin, Concat("$TRIN: ", Trin) + if trin > 1 then " : Sellers Market" else if trin < 1 then " : Buyers Market" else "", IF Trin <= 1 THEN COLOR.GREEN ELSE Color.Red);

#If the tick is a positive number, that’s good: The market as a whole has a lot of buying interest. A positive tick shows that most people in the market have a positive perspective right now. Extremes show a catalyst event, and this label will stay gray unless an extreme tick is present.
AddLabel (yes, Concat("$TICK: ", Tick) + if
        (Close < NeutralMarket_Top and
    Close > NeutralMarket_Bottom) then
" Neutral Market"  else if
        (Close > NeutralMarket_Top and
    Close < BullishValue ) then
" Bullish Market" else if
        (Close > BullishValue and
    Close < Upper_Caution_Limit) then
" Bullish Extreme" else if
    Close > Upper_Xtreme_Limit then
" CAUTION Upper Extreme" else if
        (Close < NeutralMarket_Bottom and
    Close > BearishValue ) then
" Bearish Position" else if
        (Close < BearishValue and
    Close > Lower_Caution_Limit) then
" Bearish Extreme" else if
    Close < Lower_Xtreme_Limit then
" CAUTION Upper Extreme" else "", if
        (Close > 0 and
    Close < NeutralMarket_Top ) then
Color.Dark_Green else if
        (Close > NeutralMarket_Top and
    Close < BullishValue ) then
Color.Green else if
        (Close > BullishValue and
    Close < Upper_Caution_Limit) then
Color.Light_Green else if
        (Close > Upper_Caution_Limit and
    Close < Upper_Xtreme_Limit) then
Color.Cyan else if
    Close > Upper_Xtreme_Limit then
Color.red else if
        (Close < 0 and
    Close > NeutralMarket_Bottom ) then
Color.Dark_red else if
        (Close < NeutralMarket_Bottom and
    Close > BearishValue ) then
Color.pink else if
        (Close < BearishValue and
    Close > Lower_Caution_Limit) then
Color.dark_Orange else if
        (Close < Lower_Caution_Limit and
    Close > Lower_Xtreme_Limit) then
Color.red else if
    Close < Lower_Xtreme_Limit then
Color.red else Color.Gray);
Learn more about the TICK index here.
 
Brain Monkey

Brain Monkey

New member
I effing love these! I used the Smart Tick today. I switched it to declare upper and laid it over the top of my $TICK box. I went into setting, switched the candles to bars and turned down the opacity of the bars to about 25%. This is a global setting, that's why you have to switch it to bars. I use this a graph of the vix futures and a 1 min graph of the /es futures to give me a heads up in case there is a shift in the markets.
 
BenTen

BenTen

Administrative
Staff
VIP
@Brain Monkey Market Internals can predict some good movements. Glad you liked it!
 
B

ball

New member
Did you ever test the script for $TICK and $TRIN Meters with Labels

???

The AddLabel section is wrong.

It is comparing "Close" against the value set for Extreme Tick (ie Upper_Extreme_Limit) before it decides on the text of the label.
That does not make any sense.

You need to compare the value of the TICK against the Extreme Tick Level
 
Rojo Grande

Rojo Grande

Member
VIP
Hello All,

Let me start with a disclaimer, I stink at descriptions, and I’m NOT the sharpest knife in the drawer. Now that that’s done, I’ve been playing with tick candles and was wondering if it possible to make a study that shows the minutes and/or seconds from the start of a candle to the start of the next candle, (how long it took to complete that particular candle). Maybe labels across the top of the chart that shows the times of the previous 5 candles. I was thinking this would be a way to gauge activity, without hovering over the candles to see the times. Something like one candle took 7 minutes, the next took 6 minutes thirty seconds, etc. Thanks for your time.
 
switchfire

switchfire

Member
VIP
Hello All,

Let me start with a disclaimer, I stink at descriptions, and I’m NOT the sharpest knife in the drawer. Now that that’s done, I’ve been playing with tick candles and was wondering if it possible to make a study that shows the minutes and/or seconds from the start of a candle to the start of the next candle, (how long it took to complete that particular candle). Maybe labels across the top of the chart that shows the times of the previous 5 candles. I was thinking this would be a way to gauge activity, without hovering over the candles to see the times. Something like one candle took 7 minutes, the next took 6 minutes thirty seconds, etc. Thanks for your time.
I think you're referencing tick chart candles, which is different from TICK study.
 
BenTen

BenTen

Administrative
Staff
VIP
@switchfire is correct. @Rojo Grande $TICK as an index and the tick chart are two different things.
 
F

fpapedo

New member
VIP
LOOKING FOR SCRIPT THAT WOULD PLOT DIFFERENT COLOR HORIZONTAL LINES AT TICK EXTREMES OF 1000, 1200 AND 1400.
ANYBODY HAVE ANYTHING LIKE THIS?
 
spicytrader

spicytrader

New member
VIP
You don't need a script for that. All you have to do is draw price levels at those levels, format them or color-code them as you like and turn On the Left and Right extensions so that they stay on your TICK Chart.
 
F

fpapedo

New member
VIP
ANYWAY TO DO THIS AUTOMATICALLY, SEEMS LIKE ALOT OF WORK OTHERWISE
 
BenTen

BenTen

Administrative
Staff
VIP
@fpapedo What kind of work? The levels are plotted for you
 
F

fpapedo

New member
VIP
@fpapedo What kind of work? The levels are plotted for you

hope the pic shows up, first time posting a picture.
I used the tutorial.
this is what I'm interested in.
it places a horizontal line on the chart at the extremes. these levels would be worth watching if the stocks pullback from there highs.

sorry, cell phone photo, only way to get it
 
BenTen

BenTen

Administrative
Staff
VIP
@fpapedo Did you use any of the indicators in post #1 above?
 
T

TreeDT

New member
Anyone have any ideas of how to bring the equivalent of $TICK chart into a lower study? Ultimately, I would like to build a strategy so that changes in $TICK can be used, second by second or tick by tick. All of the studies that I've seen written have only been on closing price, but not within the bar itself. TICK is just the first example, I would like to use all of the market internals and create a strategy that shows buy/sell signals, but will also use some of the other studies pre-built and some found on this site.
 
Top