Cumulative Tick Indicator for ThinkorSwim

BenTen

Administrative
Staff member
Staff
VIP
Lifetime
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.

IudRf3E.png


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.
 
Free cumulative tick indicator for anyone who wants it. The indicator references total net difference between all index stock up and down ticks.

Code:
#Ctick by @Dalebru 10/24/2015
#Cumulative tick
#Can reset to start at beginning of Day, Week, Month, Year, Chart
#Thanks to futures.io @rmejia for similar code in VWAP_Bands
declare lower;
input TimeFrame = {default Day, Week, Month, Year, Chart};
input symbol = "$TICK";
def isInvalid = IsNaN(hlc3(symbol));
def price = If (isInvalid, 0, hlc3(symbol));
input showOnlyToday = YES;
input avePeriod1 = 10;
input avePeriod2 = 34;
input UseUpDownColors = yes;
def cap = GetAggregationPeriod();
def errorInAggregation =
TimeFrame == TimeFrame.Day and cap >= AggregationPeriod.WEEK or
TimeFrame == TimeFrame.Week and cap >= AggregationPeriod.MONTH;
Assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");
def yyyyMmDd = GetYYYYMMDD();
def year = GetYear();
def periodIndx;
switch (TimeFrame)
{
case Chart:
periodIndx = 0;
case Day:
periodIndx = yyyyMmDd;
case Week:
periodIndx = Floor((DaysFromDate(First(yyyyMmDd)) + GetDayOfWeek(First(yyyyMmDd))) / 7);
case Month:
periodIndx = RoundDown(yyyyMmDd / 100, 0);
case Year:
periodIndx = Floor(year - First(year));
}
def isPeriodRolled = CompoundValue(1, periodIndx != periodIndx[1], yes);
def cum;
if (isPeriodRolled)
{
cum = price;
}
else
{
cum = cum[1] + price;
}
plot CumTick = if isInvalid then Double.NaN else cum;
CumTick.SetPaintingStrategy(PaintingStrategy.POINTS);
CumTick.SetLineWeight(3);
CumTick.DefineColor("Up", Color.GREEN);
CumTick.DefineColor("Down",  Color.RED);
CumTick.DefineColor("Default", GetColor(1));
CumTick.DefineColor("Empty",  Color.RED);

CumTick.AssignValueColor(if !UseUpDownColors then CumTick.Color("Default") else  if CumTick[0] > CumTick[1] then CumTick.Color("Up") else CumTick.Color("Down"));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3));


def TAve1 = Average(CumTick, avePeriod1);

plot TAvec1 =  if showOnlyToday and GetDay() == GetLastDay() then TAve1 else if !showOnlyToday then TAve1 else Double.NaN;
TAvec1.AssignValueColor(if TAve1 > TAve1[1] then Color.CYAN else Color.MAGENTA) ;

def TAve2 = Average(CumTick, avePeriod2);

plot TAvec2 =  if showOnlyToday and GetDay() == GetLastDay() then TAve2 else if !showOnlyToday then TAve2 else Double.NaN;
TAvec2.AssignValueColor(if TAve2 > TAve2[1] then Color.GREEN else Color.RED) ;
 

skynetgen

Well-known member
Code:
#for identicating close above/below horizontal threshold (like on  $tick or $ADD)

input threshold=400;
input location=1000;
input price=close;
def above= price > threshold;
def below= price< -threshold;


plot pabove=if above then location else double.nan;
pabove.setPaintingStrategy(paintingStrategy.TRIANGLES); pabove.setdefaultcolor(color.green);
pabove.setLineWeight(5);

plot pbelow=if below then -location else double.nan;
pbelow.setPaintingStrategy(paintingStrategy.TRIANGLES); pbelow.setdefaultcolor(color.red);
pbelow.setLineWeight(5);

addcloud(threshold,-threshold,color.gray, color.gray);

GZiSP6Q.png


Entire chart setup (as shown in screenshot)
https://tos.mx/3dD2VrT
 
Last edited by a moderator:

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.
 

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

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.
 

Shasha

New member
@BenTen
I just recently posted this question https://usethinkscript.com/threads/...-chart-when-conditions-are-met-in-lower.9659/ and after looking at the indicator you mentioned above Accumulative $TICK Meter, they display very similar and it appears some of the inputs in the settings differ slightly.
Anyways, Can you take a look at the indicator/code mentioned in my post and let me know if you possibly can help accomplish what I'm looking for? If the arrows in the upper study could be added to the code Accumulative $TICK Meter from Post#2 above I suppose that would work also.
 

BigScalp

Member
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.

IudRf3E.png


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.
Is it normal to show 100% identical information across multiple tickers and time charts?
 

MerryDay

Administrative
Staff member
Staff
VIP
Lifetime
Is it normal to show 100% identical information across multiple tickers and time charts?
#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.
The Stock Exchange numbers are not going to change because you put it on a different chart.
They measure the general sentiment of the market.
The general consensus is that going long when the market is having a down day, is like pushing a rock uphill.
 

Happyfadez

New member
2019 Donor
Ruby:
declare lower;
input hidecumtick = yes;

input hidemean = no; #hint hidemean: <b> MEAN </b> \n\n The Mean dots are plotted for people who want to use the <b> Cumulative $TICK </b> \n If hidemean <b> "Yes" </b> then the MEAN dots will be turned off. \n Think of this as a seperate indicator showing the "average ticks" rather than the "tick by tick" value. \n This is calculating the "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2.

input usetrend = { "No", default "Yes"}; #HINT usetrend: This is a setting that is used with the <b> Cumulative $TICK </b> - not with the $TICK meter.

input change_candle_colors = yes; #HINT change_candle_colors: Recognizing when the market breadth is on your side is easier when bullish and bearish $TICK action is taking place. \n\n Change Color Candles: <b> "Yes" </b> will "gray out" the candles in the upper chart unless there is actionable market breadth - then the colors will turn red or green to indicate aggressive positive or negative market breath and indicating a buying or selling opportunity \n\n Change Color Candles:<b> "No" </b> will allow the upper candles to be the color set by your chart default colors.

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; #HINT period: This is used to determine where the "average" ticks are on the day. \n This is the lookback period used to plot the green & red dashed lines that show up "typically" near 300 & -300.
#input smooth = 5; #HINT smooth: this is just an internal smoothing value and should not be adjusted.
input lookback = 4; #HINT lookback: Lookback is used in the script a few places \n\n * Lookback is used to calculate the trade triggers (buy & sell) \n * Lookback is used to color the dots on the cumulative plot \n * Lookback is used to color the candles on the chart - shows the current chart candles in vivid color to highlight when aggressive buying or aggressive selling is taking place within the NYSE total market

## Coding definitions ##
def p = period;
def i = BarNumber();
def na = Double.NaN;

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


## Code designed to record things at a specific place and time
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(600, avgh[1] + 2 / (p + 1) * (htick - avgh[1] ));
rec avgl = if i == 1 then ltick else Min(-600, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));


## Coding Definitions ##
# Now that the values have been recorded - we can defnie new parts of the indicator. Here, the code is defining what is "bullish" and what is "bearish".
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;

## Last ##
# $TICK Value: This is the actual $TICK
plot Last = if IsNaN(close(symbol)[-1]) then close(symbol) else Double.NaN;
Last .SetDefaultColor(Color.WHITE);
Last .SetPaintingStrategy(PaintingStrategy.POINTS);


## AMEAN ##
# This is "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2. When calculating a "average" we always use this math; add up all the things & then divide by that many things.
plot average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
average_mean .SetHiding(hidemean);
average_mean .SetLineWeight(1);
average_mean .SetStyle(Curve.POINTS);

## Coding Definitions ##
# The indicator needs to know when the mean is getting outside of "normal" levels - this definition is telling the indicator when to use the average mean and when not to use the average mean
def trendmean = if usetrend and (htick > avgh or ltick < avgl) then average_mean 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;


## Coding Definitions ##
# this defines the "average" of the cumulative $TICK
def ctickavg = ExpAverage(ctick, 5);

#this is the plot of the 5-period exponential moving average of the cumulative $TICK
plot cumtick = if IsNaN(close) then na else ctickavg;
cumtick .SetHiding(hidecumtick);
cumtick .AssignValueColor(if cumtick > cumtick[lookback] then Color.GREEN else Color.RED);

#This is where the average_mean lines get their color definitions.
average_mean .AssignValueColor(if cumtick > cumtick[lookback] then Color.YELLOW else Color.WHITE);

#this is the plot of the cumulative $TICK
plot nettick = if IsNaN(close) then na else ctick;
nettick .SetHiding(hidecumtick);

#this is the plot of the Zero Line
plot zero = 0;
zero .SetDefaultColor(Color.GRAY);
zero .SetLineWeight(1);





## Price Color ##

# Price color is the coding used to color the candles on the "upper" chart.
#AssignPriceColor( if change_candle_colors then
#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 else color.current);
#cumtick.SetLineWeight(2);



## Clouds on the Cumulative Plots ##
# this part of the code was designed to show clouds within the cumulative plot
def hcumtick = if !hidecumtick then cumtick else na;
def hzero = if !hidecumtick then zero else na;
AddCloud(hcumtick, hzero );


####### Trade Triggers ### BUY ######
# the BUY signal comes from a combination of two events.
# this "buy" signal is generated when
# the 5-period cumulative $TICK is higher than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# when the $TICK drops below the average low.
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;

buy .SetDefaultColor(Color.GREEN);
buy .SetPaintingStrategy(PaintingStrategy.ARROW_UP);

####### Trade Triggers ### SELL #####
# the SELL signal comes from a combination of two events.
# This "sell" signal is generated when
# the 5-period cumulative $TICK is lower than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# When the $TICK pops above the average high
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;

sell .SetDefaultColor(Color.RED);
sell .SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

# shows the 20 period "average" tick value as a dashed line
plot average_hi = if IsNaN(close) then na else avgh;
average_hi .SetDefaultColor(Color.GREEN);
average_hi .SetStyle(Curve.SHORT_DASH);

# shows the 20 period "average" tick value as a dashed line
plot average_lo = if IsNaN(close) then na else avgl;
average_lo .SetDefaultColor(Color.RED);
average_lo .SetStyle(Curve.SHORT_DASH);

# high plot
# the $TICK crosses above and below the zero line often - this plot helps identify when the "highest" part of the candle was below the zero line or when the lowest part of the candle was above the zero line (indicating that the entire $TICK for that candle was completely above or completely below the zero line. On a Black Chart - this would help to show what the tick actually was plotting

plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
hib.SetDefaultColor(Color.BLACK);
hib.SetLineWeight(5);

plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
lob.SetDefaultColor(Color.BLACK);
lob.SetLineWeight(5);


# phi #
# when the $TICK crosses the average high (the green dashed line "near" 300) this shows the bars as a green color
plot phi = hi;

# plo #
# when the $TICK crosses the average low (the red dashed line "near" -300) this shows the bars as a red color
plot plo = lo;







#



phi.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
phi.AssignValueColor(if hi > average_hi
then color.BLUE else Color.BLACK);
phi.SetLineWeight(5);
plo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plo.AssignValueColor(if lo < average_lo then Color.ORANGE else Color.BLACK);
plo.SetLineWeight(5);

Alert(phi > 600, "ABOVE 600", Alert.BAR, Sound.Bell);


#Hiding depending on if upper or lower
 
Last edited by a moderator:

halcyonguy

Well-known member
VIP
Lifetime
Ruby:
declare lower;
input hidecumtick = yes;

input hidemean = no; #hint hidemean: <b> MEAN </b> \n\n The Mean dots are plotted for people who want to use the <b> Cumulative $TICK </b> \n If hidemean <b> "Yes" </b> then the MEAN dots will be turned off. \n Think of this as a seperate indicator showing the "average ticks" rather than the "tick by tick" value. \n This is calculating the "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2.

input usetrend = { "No", default "Yes"}; #HINT usetrend: This is a setting that is used with the <b> Cumulative $TICK </b> - not with the $TICK meter.

input change_candle_colors = yes; #HINT change_candle_colors: Recognizing when the market breadth is on your side is easier when bullish and bearish $TICK action is taking place. \n\n Change Color Candles: <b> "Yes" </b> will "gray out" the candles in the upper chart unless there is actionable market breadth - then the colors will turn red or green to indicate aggressive positive or negative market breath and indicating a buying or selling opportunity \n\n Change Color Candles:<b> "No" </b> will allow the upper candles to be the color set by your chart default colors.

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; #HINT period: This is used to determine where the "average" ticks are on the day. \n This is the lookback period used to plot the green & red dashed lines that show up "typically" near 300 & -300.
#input smooth = 5; #HINT smooth: this is just an internal smoothing value and should not be adjusted.
input lookback = 4; #HINT lookback: Lookback is used in the script a few places \n\n * Lookback is used to calculate the trade triggers (buy & sell) \n * Lookback is used to color the dots on the cumulative plot \n * Lookback is used to color the candles on the chart - shows the current chart candles in vivid color to highlight when aggressive buying or aggressive selling is taking place within the NYSE total market

## Coding definitions ##
def p = period;
def i = BarNumber();
def na = Double.NaN;

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


## Code designed to record things at a specific place and time
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(600, avgh[1] + 2 / (p + 1) * (htick - avgh[1] ));
rec avgl = if i == 1 then ltick else Min(-600, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));


## Coding Definitions ##
# Now that the values have been recorded - we can defnie new parts of the indicator. Here, the code is defining what is "bullish" and what is "bearish".
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;

## Last ##
# $TICK Value: This is the actual $TICK
plot Last = if IsNaN(close(symbol)[-1]) then close(symbol) else Double.NaN;
Last .SetDefaultColor(Color.WHITE);
Last .SetPaintingStrategy(PaintingStrategy.POINTS);


## AMEAN ##
# This is "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2. When calculating a "average" we always use this math; add up all the things & then divide by that many things.
plot average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
average_mean .SetHiding(hidemean);
average_mean .SetLineWeight(1);
average_mean .SetStyle(Curve.POINTS);

## Coding Definitions ##
# The indicator needs to know when the mean is getting outside of "normal" levels - this definition is telling the indicator when to use the average mean and when not to use the average mean
def trendmean = if usetrend and (htick > avgh or ltick < avgl) then average_mean 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;


## Coding Definitions ##
# this defines the "average" of the cumulative $TICK
def ctickavg = ExpAverage(ctick, 5);

#this is the plot of the 5-period exponential moving average of the cumulative $TICK
plot cumtick = if IsNaN(close) then na else ctickavg;
cumtick .SetHiding(hidecumtick);
cumtick .AssignValueColor(if cumtick > cumtick[lookback] then Color.GREEN else Color.RED);

#This is where the average_mean lines get their color definitions.
average_mean .AssignValueColor(if cumtick > cumtick[lookback] then Color.YELLOW else Color.WHITE);

#this is the plot of the cumulative $TICK
plot nettick = if IsNaN(close) then na else ctick;
nettick .SetHiding(hidecumtick);

#this is the plot of the Zero Line
plot zero = 0;
zero .SetDefaultColor(Color.GRAY);
zero .SetLineWeight(1);





## Price Color ##

# Price color is the coding used to color the candles on the "upper" chart.
#AssignPriceColor( if change_candle_colors then
#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 else color.current);
#cumtick.SetLineWeight(2);



## Clouds on the Cumulative Plots ##
# this part of the code was designed to show clouds within the cumulative plot
def hcumtick = if !hidecumtick then cumtick else na;
def hzero = if !hidecumtick then zero else na;
AddCloud(hcumtick, hzero );


####### Trade Triggers ### BUY ######
# the BUY signal comes from a combination of two events.
# this "buy" signal is generated when
# the 5-period cumulative $TICK is higher than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# when the $TICK drops below the average low.
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;

buy .SetDefaultColor(Color.GREEN);
buy .SetPaintingStrategy(PaintingStrategy.ARROW_UP);

####### Trade Triggers ### SELL #####
# the SELL signal comes from a combination of two events.
# This "sell" signal is generated when
# the 5-period cumulative $TICK is lower than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# When the $TICK pops above the average high
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;

sell .SetDefaultColor(Color.RED);
sell .SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);

# shows the 20 period "average" tick value as a dashed line
plot average_hi = if IsNaN(close) then na else avgh;
average_hi .SetDefaultColor(Color.GREEN);
average_hi .SetStyle(Curve.SHORT_DASH);

# shows the 20 period "average" tick value as a dashed line
plot average_lo = if IsNaN(close) then na else avgl;
average_lo .SetDefaultColor(Color.RED);
average_lo .SetStyle(Curve.SHORT_DASH);

# high plot
# the $TICK crosses above and below the zero line often - this plot helps identify when the "highest" part of the candle was below the zero line or when the lowest part of the candle was above the zero line (indicating that the entire $TICK for that candle was completely above or completely below the zero line. On a Black Chart - this would help to show what the tick actually was plotting

plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
hib.SetDefaultColor(Color.BLACK);
hib.SetLineWeight(5);

plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
lob.SetDefaultColor(Color.BLACK);
lob.SetLineWeight(5);


# phi #
# when the $TICK crosses the average high (the green dashed line "near" 300) this shows the bars as a green color
plot phi = hi;

# plo #
# when the $TICK crosses the average low (the red dashed line "near" -300) this shows the bars as a red color
plot plo = lo;

phi.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
phi.AssignValueColor(if hi > average_hi
then color.BLUE else Color.BLACK);
phi.SetLineWeight(5);
plo.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
plo.AssignValueColor(if lo < average_lo then Color.ORANGE else Color.BLACK);
plo.SetLineWeight(5);

Alert(phi > 600, "ABOVE 600", Alert.BAR, Sound.Bell);


#Hiding depending on if upper or lower

this is an example of limiting a signal level.
also known as clipping in audio equipment, removing peaks.

to verify it is doing something, set it to a small number , like 50 , and notice all the horizontal lines on the top and bottom.

Code:
# tick_limit_0

declare lower;

input tick_limit_level = 950;

def cls = close("$TICK");
def cls2 = if cls > tick_limit_level then tick_limit_level else if cls < -tick_limit_level then -tick_limit_level else cls;

plot z = cls2;
z.setdefaultcolor(color.cyan);

# draw lines above and below the plot, to scale the plot down just a little.
def percent = 20;
plot z1 =  tick_limit_level * (1 + (percent/100));
plot z2 =  -tick_limit_level * (1 + (percent/100));
z1.setdefaultcolor(color.black);
z2.setdefaultcolor(color.black);
#
 

grapetux

Member
$TICK extreme readings for Market Sentiment - $PY/QQQ
Hi friends - As I was scouring the interwebs for a custom $tick lower study, I came across the following code from a YT vid I found last night. After looking over a bunch of charts.. the extreme $tick readings (-1000 / +1000) can coincide nicely with tops and bottoms on faster time frames intraday. - (More so for SPY QQQ and some of their respective top holdings, not sure on small/mid caps)
The one thing I would find extremely helpful is to be able to plot a signal of some sort on the upper price chart when the tick value hits 1000 and above, and -1000 and below, to filter out some of the noise.
I'd love any suggestions on how to expand and improve on this amazing study!

( I focus on trading $PY.. fast time frames... scalping commons and options)

Im happy to include the YT link on request.. i didn't want to spam any links, feel me??

Original code:
https://usethinkscript.com/threads/cumulative-tick-indicator-for-thinkorswim.603/
along with some interesting notes/thoughts from the author
Ruby:
##START##

declare lower;
input hidecumtick = yes; #hint hidecumtick: <b> Cumulative $TICK </b> \n\n Think of the Cumulative $TICK as a built in indicator that is showing the total accumulated value of TICK's today. \n If hidecumtick <b> "Yes" </b> then the cumulative tick lines will not show. \n\n Some ways that we use the Cumulative TICK include: \n When we have a likely trending day vs. when we expect choppy days \n When the trend has exhauste and we expect a reversal \n Zones that signify “extreme” Cumulative TICK readings \n This will hide the cumtick and the nettick plots.

input hidemean = no; #hint hidemean: <b> MEAN </b> \n\n The Mean dots are plotted for people who want to use the <b> Cumulative $TICK </b> \n If hidemean <b> "Yes" </b> then the MEAN dots will be turned off. \n Think of this as a seperate indicator showing the "average ticks" rather than the "tick by tick" value. \n This is calculating the "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2.

input usetrend = { "No", default "Yes"}; #HINT usetrend: This is a setting that is used with the <b> Cumulative $TICK </b> - not with the $TICK meter.

input change_candle_colors = yes; #HINT change_candle_colors: Recognizing when the market breadth is on your side is easier when bullish and bearish $TICK action is taking place. \n\n Change Color Candles: <b> "Yes" </b> will "gray out" the candles in the upper chart unless there is actionable market breadth - then the colors will turn red or green to indicate aggressive positive or negative market breath and indicating a buying or selling opportunity \n\n Change Color Candles:<b> "No" </b> will allow the upper candles to be the color set by your chart default colors.

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; #HINT period: This is used to determine where the "average" ticks are on the day. \n This is the lookback period used to plot the green & red dashed lines that show up "typically" near 300 & -300.
#input smooth = 5; #HINT smooth: this is just an internal smoothing value and should not be adjusted.
input lookback = 4; #HINT lookback: Lookback is used in the script a few places \n\n * Lookback is used to calculate the trade triggers (buy & sell) \n * Lookback is used to color the dots on the cumulative plot \n * Lookback is used to color the candles on the chart - shows the current chart candles in vivid color to highlight when aggressive buying or aggressive selling is taking place within the NYSE total market

## Coding definitions ##
def p = period;
def i = barNumber();
def na = double.nan;

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


## Code designed to record things at a specific place and time
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(300, avgh[1] + 2 / (p + 1) * (htick - avgh[1]));
rec avgl = if i == 1 then ltick else Min(-300, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));

## Coding Definitions ##
# Now that the values have been recorded - we can defnie new parts of the indicator. Here, the code is defining what is "bullish" and what is "bearish".
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;

## Last ##
# $TICK Value: This is the actual $TICK
plot Last = if IsNaN(close(symbol)[-1]) then close(symbol) else double.nan;
Last .SetDefaultColor(Color.white);
Last .SetPaintingStrategy(PaintingStrategy.POINTS);


## AMEAN ##
# This is "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2. When calculating a "average" we always use this math; add up all the things & then divide by that many things.
plot average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
average_mean .setHiding(hidemean);
average_mean .SetLineWeight(5);
average_mean .SetStyle(curve.POINTS);

## Coding Definitions ##
# The indicator needs to know when the mean is getting outside of "normal" levels - this definition is telling the indicator when to use the average mean and when not to use the average mean
def trendmean = if usetrend AND (htick > avgh OR ltick < avgl) then average_mean 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;


## Coding Definitions ##
# this defines the "average" of the cumulative $TICK
def ctickavg = ExpAverage(ctick, 5);

#this is the plot of the 5-period exponential moving average of the cumulative $TICK
plot cumtick = if IsNaN(close) then na else ctickavg;
cumtick .setHiding(hidecumtick);
cumtick .AssignValueColor(if cumtick > cumtick[lookback] then color.green else color.red);

#This is where the average_mean lines get their color definitions.
average_mean .AssignValueColor(if cumtick > cumtick[lookback] then color.dark_green else color.dark_red);

#this is the plot of the cumulative $TICK
plot nettick = if IsNaN(close) then na else ctick;
nettick .setHiding(hidecumtick);

#this is the plot of the Zero Line
plot zero = 0;
zero .SetDefaultColor(color.gray);
zero .SetLineWeight(1);





## Price Color ##

# Price color is the coding used to color the candles on the "upper" chart.
AssignPriceColor( if change_candle_colors then
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 else color.current);
cumtick.SetLineWeight(2);



## Clouds on the Cumulative Plots ##
# this part of the code was designed to show clouds within the cumulative plot
def hcumtick=if !hidecumtick then cumtick else na;
def hzero=if !hidecumtick then zero else na;
AddCloud(hcumtick, hzero );


####### Trade Triggers ### BUY ######
# the BUY signal comes from a combination of two events.
# this "buy" signal is generated when
# the 5-period cumulative $TICK is higher than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# when the $TICK drops below the average low.
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;

buy .SetDefaultColor(color.green);
buy .SetPaintingStrategy(paintingStrategy.ARROW_UP);

####### Trade Triggers ### SELL #####
# the SELL signal comes from a combination of two events.
# This "sell" signal is generated when
# the 5-period cumulative $TICK is lower than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# When the $TICK pops above the average high
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;

sell .SetDefaultColor(color.red);
sell .SetPaintingStrategy(paintingStrategy.ARROW_DOWN);

# shows the 20 period "average" tick value as a dashed line
plot average_hi = if IsNaN(close) then na else avgh;
average_hi .SetDefaultColor(color.green);
average_hi .SetStyle(curve.SHORT_DASH);

# shows the 20 period "average" tick value as a dashed line
plot average_lo = if IsNaN(close) then na else avgl;
average_lo .SetDefaultColor(color.red);
average_lo .SetStyle(curve.SHORT_DASH);

# high plot
# the $TICK crosses above and below the zero line often - this plot helps identify when the "highest" part of the candle was below the zero line or when the lowest part of the candle was above the zero line (indicating that the entire $TICK for that candle was completely above or completely below the zero line. On a Black Chart - this would help to show what the tick actually was plotting

plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
hib.SetDefaultColor(color.dark_gray);
hib.SetLineWeight(5);

plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
lob.SetDefaultColor(color.dark_gray);
lob.SetLineWeight(5);

# phi #
# when the $TICK crosses the average high (the green dashed line "near" 300) this shows the bars as a green color
plot phi = hi;

# plo #
# when the $TICK crosses the average low (the red dashed line "near" -300) this shows the bars as a red color
plot plo = lo;

phi.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
phi.AssignValueColor(if hi > average_hi then color.dark_GREEN else color.dark_gray);
phi.SetLineWeight(5);
plo.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
plo.AssignValueColor(if lo < average_lo then color.dark_red else color.dark_gray);
plo.SetLineWeight(5);

#Hiding depending on if upper or lower


##END##
 
Last edited by a moderator:

grapetux

Member
$TICK extreme readings for Market Sentiment - $PY/QQQ
Hi friends - As I was scouring the interwebs for a custom $tick lower study, I came across the following code from a YT vid I found last night. After looking over a bunch of charts.. the extreme $tick readings (-1000 / +1000) can coincide nicely with tops and bottoms on faster time frames intraday. - (More so for SPY QQQ and some of their respective top holdings, not sure on small/mid caps)
The one thing I would find extremely helpful is to be able to plot a signal of some sort on the upper price chart when the tick value hits 1000 and above, and -1000 and below, to filter out some of the noise.
I'd love any suggestions on how to expand and improve on this amazing study!

( I focus on trading $PY.. fast time frames... scalping commons and options)

Im happy to include the YT link on request.. i didn't want to spam any links, feel me??

Original code:
https://usethinkscript.com/threads/cumulative-tick-indicator-for-thinkorswim.603/
along with some interesting notes/thoughts from the author
Ruby:
##START##

declare lower;
input hidecumtick = yes; #hint hidecumtick: <b> Cumulative $TICK </b> \n\n Think of the Cumulative $TICK as a built in indicator that is showing the total accumulated value of TICK's today. \n If hidecumtick <b> "Yes" </b> then the cumulative tick lines will not show. \n\n Some ways that we use the Cumulative TICK include: \n When we have a likely trending day vs. when we expect choppy days \n When the trend has exhauste and we expect a reversal \n Zones that signify “extreme” Cumulative TICK readings \n This will hide the cumtick and the nettick plots.

input hidemean = no; #hint hidemean: <b> MEAN </b> \n\n The Mean dots are plotted for people who want to use the <b> Cumulative $TICK </b> \n If hidemean <b> "Yes" </b> then the MEAN dots will be turned off. \n Think of this as a seperate indicator showing the "average ticks" rather than the "tick by tick" value. \n This is calculating the "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2.

input usetrend = { "No", default "Yes"}; #HINT usetrend: This is a setting that is used with the <b> Cumulative $TICK </b> - not with the $TICK meter.

input change_candle_colors = yes; #HINT change_candle_colors: Recognizing when the market breadth is on your side is easier when bullish and bearish $TICK action is taking place. \n\n Change Color Candles: <b> "Yes" </b> will "gray out" the candles in the upper chart unless there is actionable market breadth - then the colors will turn red or green to indicate aggressive positive or negative market breath and indicating a buying or selling opportunity \n\n Change Color Candles:<b> "No" </b> will allow the upper candles to be the color set by your chart default colors.

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; #HINT period: This is used to determine where the "average" ticks are on the day. \n This is the lookback period used to plot the green & red dashed lines that show up "typically" near 300 & -300.
#input smooth = 5; #HINT smooth: this is just an internal smoothing value and should not be adjusted.
input lookback = 4; #HINT lookback: Lookback is used in the script a few places \n\n * Lookback is used to calculate the trade triggers (buy & sell) \n * Lookback is used to color the dots on the cumulative plot \n * Lookback is used to color the candles on the chart - shows the current chart candles in vivid color to highlight when aggressive buying or aggressive selling is taking place within the NYSE total market

## Coding definitions ##
def p = period;
def i = barNumber();
def na = double.nan;

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


## Code designed to record things at a specific place and time
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(300, avgh[1] + 2 / (p + 1) * (htick - avgh[1]));
rec avgl = if i == 1 then ltick else Min(-300, avgl[1] + 2 / (p + 1) * (ltick - avgl[1]));

## Coding Definitions ##
# Now that the values have been recorded - we can defnie new parts of the indicator. Here, the code is defining what is "bullish" and what is "bearish".
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;

## Last ##
# $TICK Value: This is the actual $TICK
plot Last = if IsNaN(close(symbol)[-1]) then close(symbol) else double.nan;
Last .SetDefaultColor(Color.white);
Last .SetPaintingStrategy(PaintingStrategy.POINTS);


## AMEAN ##
# This is "average Mean" and is taking the avg high value and adding it to the average low value before dividing that number by 2. When calculating a "average" we always use this math; add up all the things & then divide by that many things.
plot average_mean = if IsNaN(close) then na else (avgh + avgl) / 2;
average_mean .setHiding(hidemean);
average_mean .SetLineWeight(5);
average_mean .SetStyle(curve.POINTS);

## Coding Definitions ##
# The indicator needs to know when the mean is getting outside of "normal" levels - this definition is telling the indicator when to use the average mean and when not to use the average mean
def trendmean = if usetrend AND (htick > avgh OR ltick < avgl) then average_mean 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;


## Coding Definitions ##
# this defines the "average" of the cumulative $TICK
def ctickavg = ExpAverage(ctick, 5);

#this is the plot of the 5-period exponential moving average of the cumulative $TICK
plot cumtick = if IsNaN(close) then na else ctickavg;
cumtick .setHiding(hidecumtick);
cumtick .AssignValueColor(if cumtick > cumtick[lookback] then color.green else color.red);

#This is where the average_mean lines get their color definitions.
average_mean .AssignValueColor(if cumtick > cumtick[lookback] then color.dark_green else color.dark_red);

#this is the plot of the cumulative $TICK
plot nettick = if IsNaN(close) then na else ctick;
nettick .setHiding(hidecumtick);

#this is the plot of the Zero Line
plot zero = 0;
zero .SetDefaultColor(color.gray);
zero .SetLineWeight(1);





## Price Color ##

# Price color is the coding used to color the candles on the "upper" chart.
AssignPriceColor( if change_candle_colors then
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 else color.current);
cumtick.SetLineWeight(2);



## Clouds on the Cumulative Plots ##
# this part of the code was designed to show clouds within the cumulative plot
def hcumtick=if !hidecumtick then cumtick else na;
def hzero=if !hidecumtick then zero else na;
AddCloud(hcumtick, hzero );


####### Trade Triggers ### BUY ######
# the BUY signal comes from a combination of two events.
# this "buy" signal is generated when
# the 5-period cumulative $TICK is higher than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# when the $TICK drops below the average low.
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;

buy .SetDefaultColor(color.green);
buy .SetPaintingStrategy(paintingStrategy.ARROW_UP);

####### Trade Triggers ### SELL #####
# the SELL signal comes from a combination of two events.
# This "sell" signal is generated when
# the 5-period cumulative $TICK is lower than the 5-period cumulative $TICK from ("lookback") 4 periods back
# AND #
# When the $TICK pops above the average high
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;

sell .SetDefaultColor(color.red);
sell .SetPaintingStrategy(paintingStrategy.ARROW_DOWN);

# shows the 20 period "average" tick value as a dashed line
plot average_hi = if IsNaN(close) then na else avgh;
average_hi .SetDefaultColor(color.green);
average_hi .SetStyle(curve.SHORT_DASH);

# shows the 20 period "average" tick value as a dashed line
plot average_lo = if IsNaN(close) then na else avgl;
average_lo .SetDefaultColor(color.red);
average_lo .SetStyle(curve.SHORT_DASH);

# high plot
# the $TICK crosses above and below the zero line often - this plot helps identify when the "highest" part of the candle was below the zero line or when the lowest part of the candle was above the zero line (indicating that the entire $TICK for that candle was completely above or completely below the zero line. On a Black Chart - this would help to show what the tick actually was plotting

plot hib = if hi < 0 then hi else na;
hib.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
hib.SetDefaultColor(color.dark_gray);
hib.SetLineWeight(5);

plot lob = if lo > 0 then lo else na;
lob.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
lob.SetDefaultColor(color.dark_gray);
lob.SetLineWeight(5);

# phi #
# when the $TICK crosses the average high (the green dashed line "near" 300) this shows the bars as a green color
plot phi = hi;

# plo #
# when the $TICK crosses the average low (the red dashed line "near" -300) this shows the bars as a red color
plot plo = lo;

phi.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
phi.AssignValueColor(if hi > average_hi then color.dark_GREEN else color.dark_gray);
phi.SetLineWeight(5);
plo.SetPaintingStrategy(paintingStrategy.HISTOGRAM);
plo.AssignValueColor(if lo < average_lo then color.dark_red else color.dark_gray);
plo.SetLineWeight(5);

#Hiding depending on if upper or lower


##END##
Just wanted to follow up , I figured it out! Here's what i added to the bottom of the code that I provided:

input threshold=400;
input location=1000;
input price=close;


plot pabove=if hi >= 950 then location else double.nan;
pabove.setPaintingStrategy(paintingStrategy.TRIANGLES); pabove.setdefaultcolor(color.green);
pabove.setLineWeight(5);

plot pbelow=if lo <= -950 then -location else double.nan;
pbelow.setPaintingStrategy(paintingStrategy.TRIANGLES); pbelow.setdefaultcolor(color.red);
pbelow.setLineWeight(5);
 

ibenjamin305

New member
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.

IudRf3E.png


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.
Hi Is there anyway to make this indicator work in after hours for futures?
 

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.
Top