make this $TICK study easier to read?

khpro59

Expert Trader
VIP
Can someone help me make this $TICK study easier to read?

Someone produced this for me upon request looking for a new set of TICK indicators, and I was pleasantly surprised with how much I love it. I was wondering if its at all possible to have the lines more spread apart so its easier to read? The lines are so close together when viewing it on a "normal" sized lower study. The best way to view it, I have found, is to make it really really big so you can make out the divergences and convergences easier. I even commented out the CumTick.SetLineWeight(3); to see if smaller lines would help, but no dice, really.

1703185611041.png


Here is how it looks when I blow it way up:

1703185639142.png


Was messing around with the cumulative tick lookback period, and seems to help some. Wasnt sure if anyone else had any good ideas?


Code:
#SKYNETGEN CTICK
#Can reset to start at beginning of Day, Week, Month, Year, Chart
#Thanks to futures.io @rmejia for similar code in VWAP_Bands
# interesting code fore rolling periods
#skynetgen: coloration and explicit signals

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

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.Line);
#CumTick.SetLineWeight(3);
CumTick.DefineColor("PosAndUp", Color.Green);
CumTick.DefineColor("PosAndDn", Color.Orange);
CumTick.DefineColor("NegAndDn", Color.Red);
CumTick.DefineColor("NegAndUP", Color.orange);


CumTick.AssignValueColor(
    if Cumtick>0 then
       ( if cumtick>cumtick[1] then CumTick.color("PosAndUp") else CumTick.color("PosAndDN"))
    else
      ( if cumtick>cumtick[1] then CumTick.color("NegAndUp") else CumTick.color("NegAndDN")));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3)); zero.hidetitle();
plot avgtick=average(cumtick,3);
plot xup=if avgtick crosses above 0 then 0 else double.nan;
plot xdn=if avgtick crosses below 0 then 0 else double.nan;
xup.setpaintingStrategy(paintingStrategy.ARROW_UP);xup.hideTitle();
xdn.setpaintingStrategy(paintingStrategy.ARROW_DowN);xdn.hideTitle();
 

Attachments

  • 2023-12-21_14h06_20.png
    2023-12-21_14h06_20.png
    67.9 KB · Views: 138
Last edited:
Solution
Can you share updated sccript.
Here is the latest and greatest. Feel free to mess with line 72 (plot avgtick = Average(CumTick, 21); and just change the bold numbers to match your style. Hint: bigger the number, wider apart the lines, but miss out on smaller moves, and vice versa for lower numbers.


Code:
#@khpro59
#Cumulative tick.
#Can use aggregration periods - Day, Week, Month, Year, Chart


#############
#CHANGE LOG
#############

#1/9/24 khpro by way of @sleepyz added arrows for every crossover that occurs, and crosses of 0 #line are now purple for both bullish and bearish moves
#khpro - changed lookback period avgtick to 9 ( avgtick = Average(CumTick, 9); ) - can be found on line 72
#khpro - added label to alert user to...
Can someone help me make this $TICK study easier to read?

Someone produced this for me upon request looking for a new set of TICK indicators, and I was pleasantly surprised with how much I love it. I was wondering if its at all possible to have the lines more spread apart so its easier to read? The lines are so close together when viewing it on a "normal" sized lower study. The best way to view it, I have found, is to make it really really big so you can make out the divergences and convergences easier. I even commented out the CumTick.SetLineWeight(3); to see if smaller lines would help, but no dice, really.

View attachment 20482

Here is how it looks when I blow it way up:

View attachment 20483

I am not all familiar with this aspect of coding, and not sure if its possible or how it works. But figured it was worth a shot. Below is the script:


Code:
#SKYNETGEN CTICK
#Can reset to start at beginning of Day, Week, Month, Year, Chart
#Thanks to futures.io @rmejia for similar code in VWAP_Bands
# interesting code fore rolling periods
#skynetgen: coloration and explicit signals

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

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.Line);
#CumTick.SetLineWeight(3);
CumTick.DefineColor("PosAndUp", Color.Green);
CumTick.DefineColor("PosAndDn", Color.Orange);
CumTick.DefineColor("NegAndDn", Color.Red);
CumTick.DefineColor("NegAndUP", Color.orange);


CumTick.AssignValueColor(
    if Cumtick>0 then
       ( if cumtick>cumtick[1] then CumTick.color("PosAndUp") else CumTick.color("PosAndDN"))
    else
      ( if cumtick>cumtick[1] then CumTick.color("NegAndUp") else CumTick.color("NegAndDN")));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3)); zero.hidetitle();
plot avgtick=average(cumtick,3);
plot xup=if avgtick crosses above 0 then 0 else double.nan;
plot xdn=if avgtick crosses below 0 then 0 else double.nan;
xup.setpaintingStrategy(paintingStrategy.ARROW_UP);xup.hideTitle();
xdn.setpaintingStrategy(paintingStrategy.ARROW_DowN);xdn.hideTitle();
well if anyone is curious I got it to look much better.... I tried a lot of different angles, multiplying TICK to see if that would help ($TICK*100,*500,etc), changing line weights, paint histogram, commenting out weighted lines but alas the best thing that worked was just changing the time frame in the indicators settings to "chart" 🤦‍♂️. If it still doesn't look good, mess around with the # of day(s) look back you have. For me, I got it to look the best (and accurate) at 5D:2M(min) with after hours turned off. So could above is still intact and unchanged.

2024-02-06_12h44_13.png


1707241701633.png
 
Last edited:
Can someone help me make this $TICK study easier to read?

Someone produced this for me upon request looking for a new set of TICK indicators, and I was pleasantly surprised with how much I love it. I was wondering if its at all possible to have the lines more spread apart so its easier to read? The lines are so close together when viewing it on a "normal" sized lower study. The best way to view it, I have found, is to make it really really big so you can make out the divergences and convergences easier. I even commented out the CumTick.SetLineWeight(3); to see if smaller lines would help, but no dice, really.

View attachment 20482

Here is how it looks when I blow it way up:

View attachment 20483

I am not all familiar with this aspect of coding, and not sure if its possible or how it works. But figured it was worth a shot. Below is the script:


Code:
#SKYNETGEN CTICK
#Can reset to start at beginning of Day, Week, Month, Year, Chart
#Thanks to futures.io @rmejia for similar code in VWAP_Bands
# interesting code fore rolling periods
#skynetgen: coloration and explicit signals

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

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.Line);
#CumTick.SetLineWeight(3);
CumTick.DefineColor("PosAndUp", Color.Green);
CumTick.DefineColor("PosAndDn", Color.Orange);
CumTick.DefineColor("NegAndDn", Color.Red);
CumTick.DefineColor("NegAndUP", Color.orange);


CumTick.AssignValueColor(
    if Cumtick>0 then
       ( if cumtick>cumtick[1] then CumTick.color("PosAndUp") else CumTick.color("PosAndDN"))
    else
      ( if cumtick>cumtick[1] then CumTick.color("NegAndUp") else CumTick.color("NegAndDN")));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3)); zero.hidetitle();
plot avgtick=average(cumtick,3);
plot xup=if avgtick crosses above 0 then 0 else double.nan;
plot xdn=if avgtick crosses below 0 then 0 else double.nan;
xup.setpaintingStrategy(paintingStrategy.ARROW_UP);xup.hideTitle();
xdn.setpaintingStrategy(paintingStrategy.ARROW_DowN);xdn.hideTitle();
subtract 1 line from the other
plot that as a histogram
 
subtract 1 line from the other
plot that as a histogram
Thanks Hal! I did try CumTick.SetPaintingStrategy(PaintingStrategy.Histogram), but since this is mainly for the crossovers of averages, I didnt think it would be best suited and found the histogram to be hard to read (for exactly what I had intended it for)

The crossovers of the zero line (purple arrows) are perfect and look great, but I am also interested in the crossovers that occur above and below the 0 line, although it is easier to get a feel of its direction with the histogram.

Did you have something else in mind? Thanks for the insight!

2024-02-06_16h03_11.png
 
If it still doesn't look good, mess around with the # of day(s) look back you have. For me, I got it to look the best (and accurate) at 5D:2M(min) with after hours turned off. So could above is still intact and unchanged.

Hi. If referring to cumulative $TICK, what is the reason to include anything prior to the current session? Thanks.
 
Hi. If referring to cumulative $TICK, what is the reason to include anything prior to the current session? Thanks.
really no go technical reason, but with the expanded chart, for some reason made the lines a bit easier to read. But I have since found a better method.

I have changed the average lookback period to 50, so now the lines are very far apart and only alerts the user to bigger moves. Here is the update code if interested
I also have $TICK chart overlaid in the background in a histogram format

Tick Chart Style: http://tos.mx/wYz6epI

2024-02-20_16h36_58.png


Code:
#Ctick by @Dalebru 10/24/2015
#Cumulative tick.
#https://futures.io/thinkorswim/41392-cumulative-tick-script-2.html
#Can reset to start at beginning of Day, Week, Month, Year, Chart
#Thanks to futures.io @rmejia for similar code in VWAP_Bands



#############
#CHANGE LOG
#############

#skynetgen: coloration and explicit signals
#1/9/24 khpro by way of sleepyz added arrows for every crossover that occurs, and crosses of 0 #line are now purple for both bullish and bearish moves
#khpro - changed lookback period avgtick to 50 ( avgtick = Average(CumTick, 50); )
#khpro - added label to alert user to watch for big divergences

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


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.LINE);
CumTick.SetLineWeight(1);
CumTick.DefineColor("PosAndUp", Color.GREEN);
CumTick.DefineColor("PosAndDn", Color.ORANGE);
CumTick.DefineColor("NegAndDn", Color.RED);
CumTick.DefineColor("NegAndUP", Color.ORANGE);


CumTick.AssignValueColor(
    if CumTick > 0 then
       ( if CumTick > CumTick[1] then CumTick.Color("PosAndUp") else CumTick.Color("PosAndDN"))
    else
      ( if CumTick > CumTick[1] then CumTick.Color("NegAndUp") else CumTick.Color("NegAndDN")));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3));
zero.HideTitle();
plot avgtick = Average(CumTick, 50);
plot xup = if avgtick crosses above 0 then 0 else Double.NaN;
plot xdn = if avgtick crosses below 0 then 0 else Double.NaN;
xup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
xup.setdefaultColor(color.magenta);
xup.setlineWeight(2);
xup.HideTitle();
xdn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
xdn.setdefaultColor(color.magenta);
xdn.setlineWeight(2);
xdn.HideTitle();

plot arrowup = if avgtick crosses below cumtick then max(avgtick,cumtick) else double.nan;
plot arrowdn = if cumtick crosses below avgtick then max(avgtick,cumtick) else double.nan;
arrowup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
arrowup.setlineWeight(3);
arrowup.HideTitle();
arrowup.setdefaultColor(color.green);
arrowdn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
arrowdn.setlineWeight(3);
arrowdn.HideTitle();
arrowdn.setdefaultColor(color.red);

addlabel(yes, "Look for Big Divergences! ", color.YELLOW);
 
Thanks Hal! I did try CumTick.SetPaintingStrategy(PaintingStrategy.Histogram), but since this is mainly for the crossovers of averages, I didnt think it would be best suited and found the histogram to be hard to read (for exactly what I had intended it for)

The crossovers of the zero line (purple arrows) are perfect and look great, but I am also interested in the crossovers that occur above and below the 0 line, although it is easier to get a feel of its direction with the histogram.

Did you have something else in mind? Thanks for the insight!

View attachment 20937


Can you share updated sccript.
 
Can you share updated sccript.
Here is the latest and greatest. Feel free to mess with line 72 (plot avgtick = Average(CumTick, 21); and just change the bold numbers to match your style. Hint: bigger the number, wider apart the lines, but miss out on smaller moves, and vice versa for lower numbers.


Code:
#@khpro59
#Cumulative tick.
#Can use aggregration periods - Day, Week, Month, Year, Chart


#############
#CHANGE LOG
#############

#1/9/24 khpro by way of @sleepyz added arrows for every crossover that occurs, and crosses of 0 #line are now purple for both bullish and bearish moves
#khpro - changed lookback period avgtick to 9 ( avgtick = Average(CumTick, 9); ) - can be found on line 72
#khpro - added label to alert user to watch for big divergences
#khpro - added input for the use of $TIKSP

declare lower;
input TimeFrame = {default Day, Week, Month, Year, Chart};
input symbol =  {default "$TICK", "$TIKSP"};
def isInvalid = IsNaN(hlc3(symbol));
def price = If (isInvalid, 0, hlc3(symbol));


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.LINE);
CumTick.SetLineWeight(1);
CumTick.DefineColor("PosAndUp", Color.GREEN);
CumTick.DefineColor("PosAndDn", Color.ORANGE);
CumTick.DefineColor("NegAndDn", Color.RED);
CumTick.DefineColor("NegAndUP", Color.ORANGE);


CumTick.AssignValueColor(
    if CumTick > 0 then
       ( if CumTick > CumTick[1] then CumTick.Color("PosAndUp") else CumTick.Color("PosAndDN"))
    else
      ( if CumTick > CumTick[1] then CumTick.Color("NegAndUp") else CumTick.Color("NegAndDN")));
#CumTick.SetHiding(isInvalid);

plot zero = 0;
zero.AssignValueColor(GetColor(3));
zero.HideTitle();
plot avgtick = Average(CumTick, 21);
plot xup = if avgtick crosses above 0 then 0 else Double.NaN;
plot xdn = if avgtick crosses below 0 then 0 else Double.NaN;
xup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
xup.setdefaultColor(color.magenta);
xup.setlineWeight(2);
xup.HideTitle();
xdn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
xdn.setdefaultColor(color.magenta);
xdn.setlineWeight(2);
xdn.HideTitle();

plot arrowup = if avgtick crosses below cumtick then max(avgtick,cumtick) else double.nan;
plot arrowdn = if cumtick crosses below avgtick then max(avgtick,cumtick) else double.nan;
arrowup.SetPaintingStrategy(PaintingStrategy.ARROW_UP);
arrowup.setlineWeight(3);
arrowup.HideTitle();
arrowup.setdefaultColor(color.green);
arrowdn.SetPaintingStrategy(PaintingStrategy.ARROW_DOWN);
arrowdn.setlineWeight(3);
arrowdn.HideTitle();
arrowdn.setdefaultColor(color.red);

addlabel(yes, "Look for Big Divergences! ", color.YELLOW);
 
Solution

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

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
348 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top