I rely heavily on the usage of the TICK index, normally I just have a $TICK chart pulled up on a seperate monitor and view it that way, although lately I have discovered (a few) lower cumulative TICK studies that I really like. I even made a post about this study on how I can make it easier to read, I think arrows would really help.
What I would like help with:
I want to add arrows whenever there is a crossover in this study. Currently it will only alert a cross above or below the 0 line, which, in itself is very valuable (screen shot below). But I have also found through back testing with my scalping strategy that any old crossover tends to produce an "actionable" event.
Here are arrows I have drawn in myself where I would like them. Whenever the Cumulative Tick line crosses above or below the avg tick line, as seen below. I would actually like to keep the arrows at the 0 line, but perhaps make them purple to stand out (instead of color coded red green, they can just be up/down arrows but in purple). While the crossovers in averages can be dashboard style (Green = bullish ; Red = Bearish) Like I have below.
Sincerely appreciate ANYONES help, I like to always try and give it a go my-self, but I can never get it the way I would like it and would learn a thing or two from someone else who could code this, which on the surface seems pretty rudimentary. Thanks in advance everyone!
What I would like help with:
I want to add arrows whenever there is a crossover in this study. Currently it will only alert a cross above or below the 0 line, which, in itself is very valuable (screen shot below). But I have also found through back testing with my scalping strategy that any old crossover tends to produce an "actionable" event.
Here are arrows I have drawn in myself where I would like them. Whenever the Cumulative Tick line crosses above or below the avg tick line, as seen below. I would actually like to keep the arrows at the 0 line, but perhaps make them purple to stand out (instead of color coded red green, they can just be up/down arrows but in purple). While the crossovers in averages can be dashboard style (Green = bullish ; Red = Bearish) Like I have below.
Sincerely appreciate ANYONES help, I like to always try and give it a go my-self, but I can never get it the way I would like it and would learn a thing or two from someone else who could code this, which on the surface seems pretty rudimentary. Thanks in advance everyone!
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
# 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();