I was inspired by these two posts to create a "Cumulative Tick" signal:
(1) https://usethinkscript.com/threads/cumulative-tick-indicator-for-thinkorswim.603/post-4541
(2) https://usethinkscript.com/threads/...ick-indicator-for-thinkorswim.9211/post-84661
Except, instead of resetting the "Cumulative Tick" value each day, I would instead let it constantly accumulate to assess long-term trends. Using the TOS-provided documentation on these symbols as my guide:
https://tlc.thinkorswim.com/center/release/rel-07-20-2013
I decided to sum ALL of $TICK-style sources to take in a truly global view. Here is the super-basic code to accomplish that, with Labels added to easily assess the values of each signal:
Here is the result:
OK, now that I have my signal, let's slap on some moving averages -- perhaps I can conclude that the market is short-term bullish or bearish when this "Cumulative Tick" value is above its 20-bar moving average / 50-bar moving average / 100-bar moving average etc. I will add those calculations and also add them as labels to the calculated values are easy to see:
I save the updated Thinkscript and here are the results:
ALL of the "underlying" signals, the raw $TICKXYZ values, have changed after adding these simple moving averages! This runs counter to years of programming experience -- I am writing this on Sunday Jul22 31st, at 10:45AM Chicago time, so all markets are closed and these values should not be changing.
Why has the addition of simple moving averages beyond the underlying signals changed the underlying signals?
Thank you so much in advance for your help here my friends as I feel like I'm taking crazy pills haha... -Dan
PS, for reference, the values before and after the addition of the simple moving averages:
Before:
$TICK=241_463
$TICKC=92_192
$TICKA=20_104
$TICKAC=668
$TICKAR=252_765
$TICKARC=176_460
$TICK/Q=206_212
$TICKC/Q=140_504
CumulativeTick=1_130_368
After:
$TICK=242_766 (+0.54% larger)
$TICKC=89_929 (-2.45% smaller)
$TICKA=17_205 (-14.42% smaller)
$TICKAC=920 (+37.72% larger)
$TICKAR=231_401 (-8.45% smaller)
$TICKARC=162_544 (-7.89% smaller)
$TICK/Q=196_428 (-4.74% smaller)
$TICKC/Q=146_730 (+4.43% larger)
CumulativeTick=1_087_923 (-3.75% smaller)
(1) https://usethinkscript.com/threads/cumulative-tick-indicator-for-thinkorswim.603/post-4541
(2) https://usethinkscript.com/threads/...ick-indicator-for-thinkorswim.9211/post-84661
Except, instead of resetting the "Cumulative Tick" value each day, I would instead let it constantly accumulate to assess long-term trends. Using the TOS-provided documentation on these symbols as my guide:
https://tlc.thinkorswim.com/center/release/rel-07-20-2013
I decided to sum ALL of $TICK-style sources to take in a truly global view. Here is the super-basic code to accomplish that, with Labels added to easily assess the values of each signal:
Code:
# BenTen $TICK accumulator: https://usethinkscript.com/threads/cumulative-tick-indicator-for-thinkorswim.603/
# Mobius $TICK accumulator https://usethinkscript.com/threads/time-anchored-cumulative-tick-indicator-for-thinkorswim.9211/#post-84661
def TICK = close(Symbol = "$TICK");
def cumTICK = cumTICK[1] + TICK;
def TICKC = close(Symbol = "$TICKC");
def cumTICKC = cumTICKC[1] + TICKC;
def TICKA = close(Symbol = "$TICKA");
def cumTICKA = cumTICKA[1] + TICKA;
def TICKAC = close(Symbol = "$TICKAC");
def cumTICKAC = cumTICKAC[1] + TICKAC;
def TICKAR = close(Symbol = "$TICKAR");
def cumTICKAR = cumTICKAR[1] + TICKAR;
def TICKARC = close(Symbol = "$TICKARC");
def cumTICKARC = cumTICKARC[1] + TICKARC;
def TICK_Q = close(Symbol = "$TICK/Q");
def cumTICK_Q = cumTICK_Q[1] + TICK_Q;
def TICKC_Q = close(Symbol = "$TICKC/Q");
def cumTICKC_Q = cumTICKC_Q[1] + TICKC_Q;
AddLabel(yes, "$TICK=" + cumTICK, Color.YELLOW);
AddLabel(yes, "$TICKC=" + cumTICKC, Color.YELLOW);
AddLabel(yes, "$TICKA=" + cumTICKA, Color.YELLOW);
AddLabel(yes, "$TICKAC=" + cumTICKAC, Color.YELLOW);
AddLabel(yes, "$TICKAR=" + cumTICKAR, Color.YELLOW);
AddLabel(yes, "$TICKARC=" + cumTICKARC, Color.YELLOW);
AddLabel(yes, "$TICK_Q=" + cumTICK_Q, Color.YELLOW);
AddLabel(yes, "$TICKC_Q=" + cumTICKC_Q, Color.YELLOW);
def totalCumTick = cumTICK + cumTICKC + cumTICKA + cumTICKAC + cumTICKAR + cumTICKARC + cumTICK_Q + cumTICKC_Q;
AddLabel(yes, "CumulativeTick=" + totalCumTick, Color.WHITE);
plot tct = totalCumTick;
tct.SetLineWeight(2);
tct.SetPaintingStrategy(PaintingStrategy.LINE);
tct.AssignValueColor(Color.WHITE);
Here is the result:
OK, now that I have my signal, let's slap on some moving averages -- perhaps I can conclude that the market is short-term bullish or bearish when this "Cumulative Tick" value is above its 20-bar moving average / 50-bar moving average / 100-bar moving average etc. I will add those calculations and also add them as labels to the calculated values are easy to see:
Code:
# ... exact same code from above...
# Here is the new stuff:
def SMA_1 = MovingAverage(AverageType.Simple, totalCumTick, 20);
def SMA_2 = MovingAverage(AverageType.Simple, totalCumTick, 50);
def SMA_3 = MovingAverage(AverageType.Simple, totalCumTick, 100);
AddLabel(yes, "SMA_20=" + SMA_1, Color.GRAY);
AddLabel(yes, "SMA_50=" + SMA_2, Color.GRAY);
AddLabel(yes, "SMA_100=" + SMA_3, Color.GRAY);
plot sma1 = SMA_1;
sma1.SetLineWeight(1);
sma1.SetPaintingStrategy(PaintingStrategy.LINE);
sma1.AssignValueColor(Color.GRAY);
plot sma2 = SMA_2;
sma2.SetLineWeight(1);
sma2.SetPaintingStrategy(PaintingStrategy.LINE);
sma2.AssignValueColor(Color.GRAY);
plot sma3 = SMA_3;
sma3.SetLineWeight(1);
sma3.SetPaintingStrategy(PaintingStrategy.LINE);
sma3.AssignValueColor(Color.GRAY);
I save the updated Thinkscript and here are the results:
ALL of the "underlying" signals, the raw $TICKXYZ values, have changed after adding these simple moving averages! This runs counter to years of programming experience -- I am writing this on Sunday Jul22 31st, at 10:45AM Chicago time, so all markets are closed and these values should not be changing.
Why has the addition of simple moving averages beyond the underlying signals changed the underlying signals?
Thank you so much in advance for your help here my friends as I feel like I'm taking crazy pills haha... -Dan
PS, for reference, the values before and after the addition of the simple moving averages:
Before:
$TICK=241_463
$TICKC=92_192
$TICKA=20_104
$TICKAC=668
$TICKAR=252_765
$TICKARC=176_460
$TICK/Q=206_212
$TICKC/Q=140_504
CumulativeTick=1_130_368
After:
$TICK=242_766 (+0.54% larger)
$TICKC=89_929 (-2.45% smaller)
$TICKA=17_205 (-14.42% smaller)
$TICKAC=920 (+37.72% larger)
$TICKAR=231_401 (-8.45% smaller)
$TICKARC=162_544 (-7.89% smaller)
$TICK/Q=196_428 (-4.74% smaller)
$TICKC/Q=146_730 (+4.43% larger)
CumulativeTick=1_087_923 (-3.75% smaller)