The short side and trend following

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Mathemagician
Full Member
Full Member
Posts: 20
Joined: Thu Jun 28, 2007 1:46 pm
Contact:

What is a 10-day Exponential Moving Average?

Post by Mathemagician » Wed Oct 01, 2008 1:20 pm

What is a 10-day Exponential Moving Average?

Thanks!

AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2040
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner » Wed Oct 01, 2008 2:04 pm

Droll

jasonz
Full Member
Full Member
Posts: 10
Joined: Sat Apr 14, 2007 10:37 am

Post by jasonz » Thu Oct 02, 2008 12:20 pm

sluggo,

I believe my coefficient of correlation is bigger than your coefficient of correlation! :wink:

I don't have any futures data to hand, but your sample data is quite narrowly a bound agricultural contract.

What would be a little more interesting is to examine something such as oil contracts for instance which have moved up many multiples, or gold.

What is interesting is that the ATR() is becoming less stable, that is we are seeing GARCH type volatility.

I think we really should be looking for the vol peaks and regarding them as our maximum risk, any recent volatility is not sufficient to account for the volatility bursts that may occur...

(My firewall here won't let me upload the excel document unfortunately.)
Attachments
DJIA.PNG
DJIA.PNG (27.34 KiB) Viewed 7775 times

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Thu Oct 02, 2008 1:32 pm

Thanks for showing your test results! Do you trade futures yourself with real money, and just happen to be temporarily away from your computers that contain futures data?

If you do trade futures using mechanical systems, you probably deploy those systems on portfolios of numerous futures markets. And I hope that CME Hogs is in your portfolio, as it is in mine; Hogs are making a nice move right now that most mechanical systems are finding quite profitable. Along with Hogs, my portfolio contains Crude Oil and Gold and the (eMini) Dow Jones futures as you suggested. My portfolio also contains markets such as 2-Year US Treasury Notes futures (info here) whose contract price has only varied by 10% in its entire 18.5 year history. (And, hilariously, whose scatterplot regression trendline shows a negative slope: greater price begets smaller volatility! Download the history from your futures data provider and have a look for yourself; prepare to laugh.) You'll probably get a kick out of these other markets too, all of which are in my portfolio:
  • EURIBOR futures (traded in London (INFO)) whose price has varied by just under 9% in its 19 year trading history, and whose slope is also negative: volatility falls when price rises
  • 10-Year Canadian Govt Bond futures (traded in Montreal (INFO)) whose price has varied by a factor of 1.6 (woo!) but whose volatility falls when price rises
  • Robusta Coffee (traded in London (INFO)). This futures contract is interesting because it has the largest range of prices (higest/lowest) of any of the 100+ futures contracts I checked. Prices have varied by a factor of 84, yes eighty-four, on this futures contract. Unfortunately, the coefficient of determination (R-squared) is rather low, 0.24, meaning that variations in Price can only explain 24% of the variations in volatility.
The observed phenomenon is: Mechanical trading systems applied to broad portfolios of many diverse markets, appear to always show larger profits on Long trades than on Short trades. This is observed on wide varieties of systems and portfolios. A theory that attempts to explain this observation, needs to apply to wide varieties of systems and portfolios. Even portfolios containing Hogs and 2-Year Notes and EURIBOR and CGB and Robusta Coffee, markets for whom position size is manifestly not a function of notional value.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Re: What is a 10-day Exponential Moving Average?

Post by sluggo » Sat Oct 04, 2008 11:07 am

Mathemagician wrote:What is a 10-day Exponential Moving Average?

Thanks!

It's a built-in function of Trading Blox software and other trading system simulators (MetaStock, TeleCharts, Tradestation, Wealth-Lab, etc.) There are some good explanations of it on the web, and in the manuals for these software packages. Usually the EMA is defined recursively; that is, EMA is defined in terms of itself(!). The recursive definition tells you how to calculate today's EMA if you know today's price and yesterday's EMA. Which makes for a very fast calculation, and that's why ~~ all software implementations of the EMA, use the recursive definition.

It's a little more difficult to find discussions of EMA that define it non-recursively. That's because the EMA is an infinite impulse response digital filter, i.e., today's output depends on all prior input values, even those from infinitely long ago. The non-recursive summation extends to n=infinity, which spooks software implementers seeking fast calculations. The recursive definition hides this scary feature, pushing it into the nether-world of indicator priming :?

By convention, the EMA's smoothing constant "alpha" is chosen such that a "d day EMA" will have the same output response to a unit ramp input, as a "d day SMA" (simple moving average). A bit of algebra, performed long ago and checked many times since, shows that alpha = (2/(d+1)) gives this behavior.

The EMA on day number j (written EMA[j]) is a function of the price on day number j (written y[j]), and the price on day number j-1 (written y[j-1]), and the price on day number j-2 (y[j-2]), and the price on day number j-3 (y[j-3]), and so forth, extending infinitely far back into the past. Pragmatically speaking, the terms beyond about (6 times d) days ago have such a small influence on the result (less than ~10 PPM) that they can be dropped, with very little loss of accuracy.

So, for completeness, here is a non-recursive definition of a d-day EMA:
Attachments
ema.png
what is a d-day exponential moving average?
ema.png (13.3 KiB) Viewed 7673 times

alp
Roundtable Knight
Roundtable Knight
Posts: 309
Joined: Mon Aug 27, 2007 8:09 pm

Post by alp » Thu Oct 23, 2008 9:03 pm

sluggo, it looks like you've squeezed every possible, imaginable quantitative analysis out from the systems and markets you trade. And then some traders say that trading is not rocket science. I guess there are a few potentical rocket scientists just on this thread.

So, what's been your system actual performance? Do you have stocks in your portfolio or else, you trade only futures and forex? Thanks.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Thu Oct 23, 2008 9:21 pm


Karakoram
Roundtable Knight
Roundtable Knight
Posts: 127
Joined: Wed Apr 16, 2003 11:01 pm
Location: Reno, NV
Contact:

Post by Karakoram » Sat Oct 25, 2008 2:54 pm

Eric,

now that "The current boom in the Prices of Everything" has turned into the "Huge Slide in the Prices of Everything" what do you think now about trading the short side ?

alp
Roundtable Knight
Roundtable Knight
Posts: 309
Joined: Mon Aug 27, 2007 8:09 pm

Re: The short side and trend following

Post by alp » Sat Oct 25, 2008 10:52 pm

Eric Winchell wrote:I haven't been super creative, but I've yet to find a traditional trend following or breakout system that has any edge at all on the short side using data back to 1984 for 60+ markets (aggregate portfolio).

The reason seems obvious enough: trend following rules favor a particular type of uptrend that starts calm and ends with volatility and high prices. The nature of price action in downtrends seems to have different characteristics. My test results indicate it's more common for upside momentum to build and accelerate for longer periods than for selling to build and accelerate in the same way. This says nothing about the existence of long downtrends or that markets become oversold, but it does lead me to believe that the path to that oversold low point often takes a different form -- enough that I can't find an edge in shorting downside breakouts.

Comments?
If you're doing your backtests on stocks, that's precisely what you're going to get, if you consider the history of major indexes (see charts).

Try instead doing your research with commodities for the period prior to the recent boom. And also currencies starting from 2002.

Although both SP and DJIA seem extremely oversold, the recent sell-off might signal the end of the smooth uptrends back from 1984. Also as you yourself state the "uptrend that starts calm and ends with volatility and high prices." Whatever we're going to get from now on, the big picture doesn't look like the 80's and 90's.
Attachments
DJIA_monthly.png
DJIA_monthly.png (19.58 KiB) Viewed 7378 times
DX_monthly.png
DX_monthly.png (20.41 KiB) Viewed 7378 times
SP_monthly.png
SP_monthly.png (19.55 KiB) Viewed 7378 times
crb-ci.gif
crb-ci.gif (13.17 KiB) Viewed 7378 times

alp
Roundtable Knight
Roundtable Knight
Posts: 309
Joined: Mon Aug 27, 2007 8:09 pm

Post by alp » Sun Oct 26, 2008 9:22 pm

On June 20, 2008, sluggo wrote:The set of {breakout systems you've simulated} combined with the set of {markets you've tested, over the slice of past history you've tested} has not been satisfyingly profitable on short trades.

Naturally this leads to two thoughts. First, what about the systems you haven't tested? Second, will the markets of the future have the same characteristics as the markets of the past?

A lot of people think it is unwise to assume that shorting will turn out to be unprofitable in the future. Some of them have decided that a safe approach is to trade ALL possible markets, and trade both long and short. Don't ever miss an entry signal, because you never know which one is going to be the mammoth +50 R-multiples-of-profit trade of the year. It might even be a short trade.
I think sluggo has helped to explain what I understand by "robustness". The idea of studying price history so as to discover if long only trades are better than long and short somehow implies judgement about future price behaviour.

On the other hand, I think that the trader's task is to come up with a set of rules that almost guarantees that if there is a sustained move, the system will be in. The rules would be such that they would give markets maximum freedom to behave as they will, and work with the sole implicit premise that, sometimes, they will trend.

Doing otherwise implies judgement or discretion. How bad is that, i.e., using some discretion so as to decide which system to put on-line or how much risk to allocate a given sector/market? I have no answer. I suspect nobody does either.

adamant
Roundtable Knight
Roundtable Knight
Posts: 118
Joined: Mon Aug 25, 2008 1:20 am
Location: Norway

Post by adamant » Thu Nov 13, 2008 11:42 am

Not to be a kiss-ass - but I am simply in awe of the amount of knowledge that can be extracted from this forum.

LeviF
Roundtable Knight
Roundtable Knight
Posts: 1428
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF » Thu Nov 13, 2008 12:08 pm

Yup. Its a refreshing sanctuary compared to a place like elitetrader.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Thu May 07, 2009 8:50 am

AFJ Garner brought up this same idea recently (using a mechanical system to trade futures, but only taking the long trades while skipping the short trades), in this message: viewtopic.php?p=36338&highlight=#36338 . He said
I have much the same reservations about trading short. It is true that my system has profited (just) from trading short over time thanks to the exceptional periods like that we have just had. However, I have recently been testing a LTTF system which produces very similar measures of goodness without the need for trading short, which I rather like. I don't like adding barely profitable systems just for the sake of straightening the equity curve and share the fear that such systems can easily tip over into severe negative performance.
For those who may be considering such a plan, please allow me to inquire: Will you also skip the short trades in currency futures? Will you trade currencies from the long side only?

It seems to me that currency futures are, to a good approximation, perfectly symmetric between long and short. To go short "MP" futures is to bet that the dollar will rise against the Mexican Peso; to go long "MP" is to bet that the Mexican Peso will rise against the dollar. Going short one is identical to going long the other. There is no difference between "long" and "short". And if you trade the cross rate futures (as I do), you have the option of betting that the Pound will rise against the Yen (by going long "SY" futures), or betting that the Yen will rise against the Pound (by going short "SY"). Disregarding the dollar entirely.

What is gained by declaring that you will bet on currency moves in one direction but not the other?

LeviF
Roundtable Knight
Roundtable Knight
Posts: 1428
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF » Thu May 07, 2009 9:22 am

sluggo wrote:What is gained by declaring that you will bet on currency moves in one direction but not the other?
Nothing I say.

AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2040
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner » Thu May 07, 2009 12:48 pm

I am guilty of neglect and ommission in my earlier post: no, I agree several hundred percent with what Sluggo says and my system will trade currencies short as well as long.

LeviF
Roundtable Knight
Roundtable Knight
Posts: 1428
Joined: Mon Dec 22, 2003 12:24 pm
Location: Des Moines, IA
Contact:

Post by LeviF » Thu May 07, 2009 1:40 pm

I wonder why exchanging my dollars for yen & yen for dollars, is any different than exchanging my dollars for cotton & cotton for dollars, etc...

rabidric
Roundtable Knight
Roundtable Knight
Posts: 243
Joined: Mon Jan 09, 2006 7:45 am

Post by rabidric » Thu May 07, 2009 1:49 pm

given the all-round love expressed in this thread for sluggo and the roundtable, should he get his own special category, above that of "roundtable knight"? 8)

AFJGarner too... :wink:

AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2040
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner » Thu May 07, 2009 2:08 pm

rabidric wrote:given the all-round love expressed in this thread for sluggo and the roundtable, should he get his own special category, above that of "roundtable knight"? 8)

AFJGarner too... :wink:
Tee hee hee. The fact is that Sluggo has taught me a great deal over the years and for that I am grateful. He once told me that information is a "trade" and that I should provide information to others if I expected to receive any from them.

I have tried to give back a little in my postings on this Forum and if these have been of any use at all to Sluggo or any other forum member, then I have achieved my object.

sluggo
Roundtable Knight
Roundtable Knight
Posts: 2986
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo » Thu May 07, 2009 2:39 pm

Yes it is true: I hold AFJ Garner in the highest esteem. He makes valuable contributions here (and elsewhere), again and again, with clarity and wit and good cheer. I fully expect his forthcoming book will be insightful and revealing and -- the highest praise of all -- scrupulously accurate.

As for the frivolous blather about me, balderdash. I'm just an enthusiastic Blox customer (bought 3 licenses so far) and user community member.

+SLUGGO+

Turtle40
Roundtable Knight
Roundtable Knight
Posts: 201
Joined: Wed Oct 19, 2005 1:53 pm
Location: Guernsey, Channel Islands

Post by Turtle40 » Thu May 07, 2009 6:21 pm

Sluggo your modesty is touching, but I and many others I'm sure, really appreciate your posts. You clearly have a depth of knowedge and understanding of trading which helps makes this forum the great place it is.

I read each and every post of yours-yes you definately deserve "elevation" above knighthood status!

Post Reply