Friday, February 20, 2009

Qs SD Signal Line

This is a continuing snippet of research based on last weekend's stated goal of refining a robust mean reversion signal using standard deviations of a floating price point, the pivots range mean reversion and a linear regression component.

This little algorithm was inspired by Jeff Pietsch's z-score analysis of ETF pairs trading opportunities. Now Jeff's work is considerably more complex than this system could ever hope to be, and I've stripped off the log functions to make it even simpler as they have no impact when not comparing 2 different ETFs. My goal here is rather basic and requires a conviction that price does indeed revert to the mean (eventually).
I've written before about the advantages of balancing probability theory (mean reversion) versus uncertainty (chaos theory, random walk, nonlinear logic) to build a Kit of Parts trading system of non-correlated factors and today's work focuses on some of the mean reversion aspects of that equation.

A little closer look at the TS code below reveals that we're actually looking for reversals above or below a zero line.
If the Len average price equals the current close, the result is 0, showing no + or - bias.
If the Len average price is less than the current close, the result is a + number, reflecting a price expansion above the current range.
If the Len average price is more than the current close, the result is a - number, reflecting price expansion below the current range.
If we then divide the +/- resultant by the standard deviation of the same Len range, we end up (hopefully) with a simple mean reversion to the zero line indicator.
I've just looked at the short side for now. . . the final product will incorporate both sides of the equation not only to generate BUY signals but, just as importantly, to confirm the bias of other mean reversion signal components.
As with many of the other short side systems I've profiled in the Qs Dirty Dozen, the Fixed Bar exit optimizes to 9, adding further support to this time frame as a reliable Qs short cycle.

4 comments:

GS751 said...

Just wanted to say that even though you don't get many comments. Your blog is still really sweet... I read all of your posts...

bzbtrader said...

Thanks George,
With an average of 300 daily readers I'd expect a little more feedback too. Many choose to send me emails directly with questions unrelated to specific posts and, as time permits, I always try to accommodate those inquiries. They say that if you're the smartest guy in your group then you're in the wrong group. . . a philosophy I enthusiastically endorse and I'm always looking for smart, inquisitive traders (and others) to bounce ideas off of. As such, there have been more than a few comments that have prompted me to explore new trading ideas and the blog has providedd the venue to network offline with several of the bloggers in my Sites of Interest. It's a learning process for sure and I find nuggets of trading wisdom in sometimes the most peculiar places.

Unknown said...

In reviewing the code I'm unsure what the 'function of len2' is, as it isn't attached to stddev or barssinceentry or some other function.. Thanks

bzbtrader said...

Tom,
If you look at the actual TS code for the system at the bottom of the post, you'll see that len2 (1.5) is the SD threshold for activating the SELL signal. I tried to explain how the (mean)zero line function was created earlier in that postand Len2 is the upper resistance level above that zero line that signals an overbought condition.