Archive for the ‘Misc. Jackassery’ Category

Burning the Candle at Both Ends

November 25, 2009

So if you still even read my blog, you’ve noticed that I haven’t posted much in a while. I’ve been finishing custom projects, programming indicators for EOT and also had a busy time with work. Topped off with a leaky roof and allergies, I’ve pushed too hard for too long. And I’m worn out.

I’ll be regrouping during the thanksgiving holidays and afterwards I’ll start some blogging again. Hope you have a good holiday and enjoy your families and friends.

Fables For Socialist Children: The Little Red Hen

August 13, 2009

There once was a little red hen. This hen was hard working and industrious, always busy. She had 7 little chicks to feed. She lived on a farm with a lazy cat, a sleepy dog, and a big fat pig.

One day the hen found some wheat grains on the ground, carelessly dropped there by the farmer. “Who will help me plant this wheat?” she asked. “Not I!” said the lazy cat. Planting sounded like hard work, though the cat had no experience to draw that observation from, having never worked in her life. “Not I,” yawned the sleepy dog without even opening his eyes. Many years ago, the dog had chased off a burglar, and he had long before received his “well earned rest” and then some. “Not I!” grunted the big fat pig from his comfy mud wallow, never imagining his charming personality wasn’t the reason the farmer was fattening him up. “Then I will do it myself!” said the hen.

So she planted the wheat, all by herself. Every day, she watered the wheat and pulled weeds from the field, all by herself. Each time she worked, she first asked the others if they would help, and each time she got the same answer: “Not I.”

The time for harvest finally came! “Who will help me cut the wheat?” asked the hen. “Not I!” said the lazy cat. She was too busy lying in the sun, and cutting wheat sounded like hard work. “Not I,” yawned the sleepy dog without lifting his head. “Not I!” grunted the big fat pig with his mouth full of swill. “Then I will do it myself!” said the hen.

So she cut the wheat, all by herself. She threshed the wheat and ground it into flour, all by herself. Each time she worked, she first asked the others if they would help, and each time she got the same answer: “Not I.”

The hen was ready to bake bread from the flour. “Who will help me bake the bread?” asked the hen. “Not I!” said the lazy cat. “Not I,” yawned the sleepy dog. “Not I!” grunted the big fat pig. “Then I will do it myself!” said the hen.

So she mixed and kneaded, baked and cooled the bread, all by herself. The finished bread smelled and looked delicious. This attracted the attention of the lazy cat, the sleepy dog, and the big fat pig, who rushed to her side. “Who will now eat this bread?” asked the little red hen, her hungry chicks pecking the ground near her feet.

NOT YOU!!” boomed a deep, loud voice. It was the farmer! He snatched the loaf from the startled hen’s wings. “Hen, you know how to plant and harvest, to grind and bake. The cat does not know how. She cannot bake for herself. She needs this bread more than you, as you can make more.” The farmer tore off a chunk and gave it to the cat, who nibbled at it with disgust, as there was no meaty taste.

The farmer continued, “Hen, you have never provided for the security of the farm. Long ago, the dog chased away a burglar. He deserves this bread more than you.” The farmer tore off another piece and gave it to the dog, who took it away to his shady spot and dropped it, soaked with slobber, as he went back to sleep.

“Hen, I want you to lay eggs,” the farmer said. “That is your purpose. My big fat pig here is meant for greater things!” The farmer gave a large piece of bread to the big fat pig, who dashed back to the mud and gobbled it with such speed that half of the bread broke into crumbs and fell, wasted, into the sty.

As he walked away from the astonished hen and her hungry chicks, the farmer laughed: “And the last piece is for me, since this farm doesn’t run itself!” The chicks began to cry, and the little red hen covered her beak with her wings, the words of the farmer still ringing in her ears: “NOT YOU!!

Messing Around With Cumulative Tick

June 13, 2009

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.

Some Work In Progress: Pivot Points Using “VWAP” Instead Of “Close”

May 20, 2009

One thing I have sporadically messed around with is this: What if you made a new Pivot Points calculation, but instead of using yesterday’s High, Low and Close, you used yesterday’s High, Low, and End-of-Day VWAP? Wouldn’t that give you a more “value” based pivot point calculation?

I leave this as an exercise for the reader, as I kind of lost interest with my ADD self and didn’t want to write an article. But since it might be interesting to someone, here it is as a “beta”.

My initial looks said it made the pivot levels wider in general, which I’m not sure is what we would want. In any event, the code is freely available in my “Work in Progress” page under the name “NewPivotVWAPSTUDY.ts”. Mess around with it and feel free to comment on any ideas or observations you may have!


May 18, 2009

I have discovered the Holy Grail. This is big. If you donate $1,000,000 I will send it to you.

What the hell, I’ll give it away! I have had a change of heart. In lieu of donations, please send flowers to the freedom lovers at

plot HOLYEFFINGGRAIL = close[-1];

Plot that on your charts. IT. ALWAYS. SHOWS. THE. CLOSE. OF. THE. NEXT. BAR. IN. THE. FUTURE.

Isn’t that worth $1,000,000? I would think so. Also, if you donate to my blog, all of your dreams will come true. True story.

We now return you to your regularly scheduled “Pro-scam-us” blog, already in progress…