Messing Around With Cumulative Tick

After a comment by Donahchoo on Twitter, I started thinking of ways of looking at cumulative values of the NYSE Tick.

As with many other topics, there has been exhaustive treatment of what the Tick is and the significance thereof. Richard at Move the Markets has a very good Tick article if you want this background info. Dr. Brett Steenbarger talks a lot about how he uses cumulative adjusted Tick; see his blog for more details on what he does with it. Building on this foundation of what the Tick is, I’ll jump right in. This is more of a thought journal of my impressions than an exhaustive treatment of an optimized indicator, so it’s a bit rough around the edges.

I’ve been thinking that the most revealing information comes when we see extremes in the value of the Tick. Many times we hear of the tick being referenced to absolute levels: above +1000 could mean heavy buying, below -1000 heavy selling. The trouble with this is that sometimes you get a spike in the Tick that is unsustainable (and you should fade it), and sometimes you get heavy, extended readings for a long time (that you should be following). But the absolute level of the Tick doesn’t really tell me which is which. Additionally, it seems that when the low of a bar of the Tick stays relatively high (such as the low of a 5 min Tick bar being at +400 and the high at +1200), that means more for strength than having both a high and a low reading in the same bar, as in both +1200 and -1200.

So to define an extreme, I decided to use a different approach. First, I apply two exponential moving averages to create bands. I plotted the EMA(20) of the highs in the Tick, and the EMA(20) of the lows. Then I wrote a script to sum the net extremes ONLY, ignoring any Tick readings happening inside the bands, using this formula:

def htick = high("$TICK");
def ltick = low("$TICK");
def avgh = expaverage(htick,20);
def avgl = expaverage(ltick,20);
def bull = if htick > avgh then htick - avgh else 0;
def bear = if ltick < avgl then ltick - avgl else 0;

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

That code will sum only the extreme Tick readings, as defined by our EMA bands. I like this because it forms an adaptive definition for tick extremes, and it also captures the effect of having high Tick highs and lows as I described above, and vice versa for low highs and lows.

I wrote a full indicator to test this out on a 5min chart of the last 3 days in ES. I’ve plotted the indicator below the price chart. I’ve also included a separate plot of the Tick for visualization purposes. The CumTick indicator is doing all it’s own calculations behind the scenes. There are three things going on that I’ll explain:

1. A net sum line (thin line) for the cumulative values of ctick as described in the code above.
2. A 20 period EMA of the net sum line. This is done for smoothing purposes. This line is colored according to values in it’s own past–if the EMA is above the value of the same EMA 4 periods ago, it is green, else red. This lookback is kind of like the way the Fisher transform looks back at it’s own past values, only it uses a lookback period of 1.
3. I have added a cloud, red if the EMA is below zero, and green if it is above zero.


You can see that the red/green EMA does pretty well on choosing the dominant market direction. Zooming in for some detail, I’ve annotated graphically what my code from above is doing:


I wrote a couple of strategies to run a quick backtest on this. I went long when the EMA went from red to green, and opposite for shorts. I also included an ‘exit on close’ to keep this to a daytrading strategy only. Here’s what the trades looked like:


Only a couple of whipsaws, but the entries had some significant retracement at times. With no stop loss or profit target, just reversing according to color and going flat at the end of the day, here’s the results (in ES points) for the 3 day period:

Max trade P/L: 10.00
Total P/L 26.25
Total 41 order(s)

That’s very encouraging! I always want to do a sanity check on new ideas. If it’s not profitable in a simple test, you’re not going to mine gold by tweaking it. I would need to do more work in looking at stops and more backwards data to gain confidence in it, and work on an entry setup to see if there was a smarter way to get in. I welcome comments and any ideas anybody may have, if you’re interested. You can download my indicator file and the strategy files (look for “Cumulative”) in the “Work in Progress” section at my google site.

Tags: , , ,

19 Responses to “Messing Around With Cumulative Tick”

  1. manatrader Says:

    Being that the last few days have been awful for a lot of ES traders, this could be a significant tweak to the venerable tick, thanks for sharing it. I hope you can backtest more with ninjatrader ..

  2. Prospectus Says:

    I plan to code this for Ninja, but I need to get a new data source since my Zen-Fire demo feed is only for a few futures contracts, and I don’t have a source for NYSE Tick data.

  3. David Says:

    very nice.. looks promising, thanks for posting

  4. Cuervos Laugh Says:

    You and Danny over at iBC seem to be drinking from the same well here.

  5. James T. Says:

    amazing stuff you produced… dun think i’ve made anything that great lol

  6. Prospectus Says:

    I appreciate the compliment. I just hope people find my stuff useful at the end of the day.

  7. Tao Says:

    I plotted a similar TICK indicator using Tick high, low and average. give it a try, it helps me timing the extreme TICK, if display this indicator over the one minute /ES price chart, the bear or bull flags are very easy to be spotted.

    input periods = 8;
    input shrtperiods = 2;
    def tick = ((high(“$TICK”) + low(“$TICK”)) / 2 + close(“$TICK”)) / 2;
    def TickAvg0 = ExpAverage(tick, periods);
    def TickAvg1 = ExpAverage(TickAvg0, periods);
    def TickAvg2 = ExpAverage(TickAvg1, periods);
    def tickExtrm = if TickAvg2 > TickAvg2[1] then high(“$TICK”) else low(“$TICK”);
    def TickExtrmAvg0 = ExpAverage(tickExtrm, periods);
    def TickExtrmAvg1 = ExpAverage(TickExtrmAvg0, periods);
    def TickExtrmAvg2 = ExpAverage(TickExtrmAvg1, periods);

    def shtickExtrm = if TickExtrmAvg2 > TickAvg2 then high(“$TICK”) else low(“$TICK”);
    def shrtExtrem =ExpAverage(shtickExtrm, shrtperiods);
    def shrtExtrem1 = ExpAverage(shrtExtrem, shrtperiods);
    def shrtExtrem11 = ExpAverage(shrtExtrem1, shrtperiods);

    plot zeroline = 0;
    plot line1 = 500;
    plot line2 =-500;
    plot TickAvg = TickAvg2 ;
    plot TickExtrmAvg = TickExtrmAvg2;
    zeroline.AssignValueColor(CreateColor(0, 0 , 100));
    line1.AssignValueColor(CreateColor(0, 0 , 200));
    line2.AssignValueColor(CreateColor(0, 0 , 200));
    TickAvg.AssignValueColor(if TickAvg > TickAvg[1] then CreateColor(180, 180 , 0) else CreateColor(200, 20 , 50));
    TickExtrmAvg.AssignValueColor( if TickExtrmAvg > TickExtrmAvg[1] then CreateColor(160, 160 , 0) else CreateColor(160, 10 , 10) );

  8. Daniel M. Says:

    Hi Prospectus I heard good things about you from Richard. A very neat indicator indeed. Any chance you have coded it for Ninja Trader yet. Thanks for sharing and good trading to you.

  9. David Says:

    I would also be very interested in a NinjaScript version of this indicator.

  10. TradAnsh Says:

    Hi Prospectus,
    Is it possible to re-write this study, given that the latest version of ToS doesnt support fullrange anymore?


  11. Prospectus Says:

    Just delete the

    declare fullrange;

    line and it should work fine.

  12. Weird Cumulative Tick Plot: Distribution or Math Artifact? « Read the Prospectus Says:

    […] Okay, this is making me scratch my head a bit. Here’s a plot of the ES with my “Messing around with Cumulative Tick” indicator on it, showing 1 hour bars since March […]

  13. Weird Cumulative Tick Plot: Distribution or Math Artifact? » ThinkOrSwim | Says:

    […] this is making me scratch my head a bit. Here’s a plot of the ES with my “Messing around with Cumulative Tick” indicator on it, showing 1 hour bars since March […]

  14. Cumulative Tick Indicator with Paintbars for Think or Swim « Read the Prospectus Says:

    […] Tick Indicator with Paintbars for Think or Swim By Prospectus I’m pretty happy with the cumulative tick indicator now, so I’m graduating it out of “works in progress”. I think it does fairly well […]

  15. Cumulative Tick Indicator with Paintbars for Think or Swim » ThinkOrSwim | Says:

    […] pretty happy with the cumulative tick indicator now, so I’m graduating it out of “works in progress”. I think it does fairly well identifying […]

  16. John Hills Says:

    Good luck trading them adjusted cumulative tick crossovers, your going to need it

  17. Prospectus Says:

    Why do you say that?

  18. Federico Says:

    Hi Prospectus.

    I Trying to develop a NT version of your indicator, but just know a bit about Ninjascripts.

    I wrote a code but I don’t know how to continue. If you complete the script, I will testing in NintaTrader.

    Thank you very much.

  19. Keith Says:

    Hey Prospectus,

    Big fan and it’s through this site that I learned to write a few scripts that I now rely on, so, thank you for that. Question: I like to use this study on a 5 day chart but would like the value to reset and start fresh every day. I have tried to insert Showtodayonly etc., and can’t seem to get it to work, can you set me on the right path?

    Thank you very much.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: