Dead Turtles

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.
rabidric
Roundtable Knight
Roundtable Knight
Posts: 243
Joined: Mon Jan 09, 2006 7:45 am

Post by rabidric »

Chris67 wrote: its a bugger that some groups like meat
carnivores eh?! :roll: :D

but to paraphrase the well known australian natural philosopher Michael Dundee:

"You can live off it , but it trades like shit!" :)
Ag Trader
Contributing Member
Contributing Member
Posts: 5
Joined: Mon Jun 27, 2011 12:30 am

Post by Ag Trader »

Garner,

I purchased your article yesterday and enjoyed the read. It did leave me a little puzzled on one subject though. Could you elaborate on sector and portfolio risk? Thanks for the help!
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

Max Sector Risk: 10%
Max Total Risk: 40%
If you are fully loaded (ie the risk to stop levels of all positions in the portfolio is 40%) and all positions simultaneously hit their stop level and you exit the positions at that level, then you will lose 40% of the portfolio by value. A $100m portfolio will be reduced to $60m.

Sector risk depends on how you define sectors. If one of your sectors is "Grains", max sector risk of 10% means that you will not allow the combined risk on "Grains" to exceed 10% of the value of the entire portfolio. Risk is defined as the difference between the current market price and the stop level.
stopsareforwimps
Roundtable Knight
Roundtable Knight
Posts: 199
Joined: Sun Oct 10, 2010 1:47 am
Location: Melbourne Australia

Post by stopsareforwimps »

AFJ Garner wrote:For the sake of completeness here is Turtle 1970 to end 1990. Again using the same settings as in the article except for the end date of the test.
Anthony would you be so kind as to post a table of the data that this graph is based on? I would like to do a version adjusted for inflation. Without adjusting for CPI the 1980s and 1990s systems such as turtles looked better than they were.

Thanks,
Tim J
stopsareforwimps
Roundtable Knight
Roundtable Knight
Posts: 199
Joined: Sun Oct 10, 2010 1:47 am
Location: Melbourne Australia

Re: Dead Turtles

Post by stopsareforwimps »

AFJ Garner wrote: As I stated in the article, main parameters used were as follows:...
Could you clarify one point about the parameters of the modified turtle system?

The original system had a rule which stated "ignore entry signals if the previous signal in that market produced (or would have produced) a winning trade. If a trade is skipped, enter after a 55-day high or low to avoid missing major moves."

It seems that no analog to this rule exists in the modified system, but I could not find any explicit statement of this. My impression is that this rule is removed and replaced by the filter based on the long term trend. Is this correct?
Chris67
Roundtable Knight
Roundtable Knight
Posts: 1052
Joined: Tue Dec 16, 2003 2:12 pm
Location: London

Post by Chris67 »

Stopsareforwimps - I get a feeling your analysis / assumptions are going down the wrongh path for adjusting historical returns for inflation
In my HO the returns are neither better or worse when adjusted for inflation - they are exactly what they are - expressed as a % and inflation doesnt make any difference ?
Surely if there was rampant inflation for example in the 1980's then you would have invested more in the system ? as USD woudl have been cheaper / easier to find i.e. a million dollars would have really been $2 Mill ? - i would simply look at the percentage returns as the best indicator of the systems performance
If you want to persist with adjusting for inflation then make sure you adjust every other comparible number for inflation too i.e. more trading capital / stock market returns would need to be adjusted down as a comparison as well as dividends and the return on all other investments that were possible - its a really difficult way or analysing investment returns surely
Just my 2 cents worth - maybe Im missing something
What I would say is that potentially you could analyse the turtle system as a system that would make a greater % return in an inflationary environment as prices are moving quicker and to more extreme levels ?
Look at the 1990's and early 2000's when all teh great "experts" were claiming inflation is dead forever more - and maybe thats why % returns tail off ? what happens when we get the return of absolute rampant inflation which is just around the corner ?
Anyway good luck with what your doing
C
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Re: Dead Turtles

Post by AFJ Garner »

stopsareforwimps wrote:
AFJ Garner wrote: Is this correct?
Correct. No such rule used.
stopsareforwimps
Roundtable Knight
Roundtable Knight
Posts: 199
Joined: Sun Oct 10, 2010 1:47 am
Location: Melbourne Australia

Post by stopsareforwimps »

Chris67 wrote:Stopsareforwimps - I get a feeling your analysis / assumptions are going down the wrong path for adjusting historical returns for inflation
You make some very good points.

I agree it is quite tricky adjusting for inflation. My intention in this case was mainly to adjust the results curves to avoid falling prey to the money illusion. See the picture for an obvious example of the difference this can make. You can make money and actually be worse off. As an old guy this is very real to me because I remember the 1970s vividly.

It may seem that if you are comparing two strategies, then adjusting for inflation is pointless because they are both subject to the same adjustment. This is indeed true for the compound returns, but is not necessarily true for other attributes such as the Sharpe ratio, maximum draw-down, and the lake ratio. The stock market draw-down in the 1970s was much worse when you take inflation into account.

This raises the question of how to measure inflation. Some people prefer to measure in gold. Here is an interesting graph of the Dow measured in ounces of gold:

http://www.stocks-for-beginners.com/ima ... -price.jpg

(By the way what an ominous looking graph. It seems to show an unstable system with ever-more-violent gyrations. It doesn't *look* like a happy ending is ahead.)

Inflation makes a lot of things more complex. Just valuing a company is more difficult because book value is based on historical prices. It also makes trading strategy more complex.

I do actually use inflation in my stock market timing strategies. If a market was up 2% but inflation in that time was 3% I consider that market to be down. It is not too hard to do this because there are accumulation indexes that are easy to adjust for inflation. As an inhabitant of a small country I also need to think about currencies as well.

With futures it is more difficult - all the cash flows and capital amounts need to be individually adjusted for inflation according to when they happen. Leverage complicates things further. I have not gotten my head around all this yet. With inflation at 3% it is probably not essential to do this now and I have not done it.

You mention the possibility that rampant inflation is nigh. It is disconcerting that the Fed is printing all this money. Perhaps this is going to produce massive inflation. However we seem to be in a balance sheet recession much as Japan had from the late 1980s until recently. In such a situation printed money just sits in bank computers and does not produce inflation. Once the balance sheet deficits are resolved, then inflation can take off again. At *that* point unless the Fed withdraws the TeraBucks we might get high inflation again and have to adjust our strategies. See "The Holy Grail of Macroeconomics: Lessons from Japans Great Recession" by Richard C. Koo - this book changed my thinking on economics.

The commodity price increases of the past 8 years are usually thought of as inflation but maybe that's not the best description. As vast new supplies of trained labor and their equally vast savings enter the global market the prices of labor and capital relative to land (including commodities) are falling. This is arguably an adjustment of relative prices, rather than vanilla inflation as such. (See "The great wave - price revolutions and the rhythms of history" by David Hackett Fischer for more on this general theme).
Attachments
Australian stock market adjusted for inflation
Australian stock market adjusted for inflation
all_ords_adj_for_inflation.png (31.26 KiB) Viewed 13613 times
Chris67
Roundtable Knight
Roundtable Knight
Posts: 1052
Joined: Tue Dec 16, 2003 2:12 pm
Location: London

Post by Chris67 »

Stopsareforwimps

Great points - thanks for sharing - and all very interesting

There is one area where I think you are loiteing around the edge of a massively important point at present that most market participants havent got their heads around and could be of crucial importance in teh next few years
All the "inflation is dead for evermore" propoenets of the last decade have based their analysis on globalisation and the cheap labor and production costs available all over the globe - let me ask you - how long do you think that is going to last ? My guess is that its already changed
No longer are people going to sit in sweat shops in India, China and other so called "developing countries" effectively producing things for nothing so that Western economies can consume them all at cheap prices and push up U.S retail sales numbers to make idiot American economists believe that their economy is growing on anything other than the total bubble it actually is !!

So if we have a level playing field and all global production costs are the same - the only difference comes down to productivity and global export competitiveness - and this is where Europe and the U.S fall off the edge of a cliff. With their fascination for "workers rights" human rights, union practises etc the West hasnt got a chance in teh next decade - so this means that their economies are on teh verge of falling off a cliff as they cannot actually make / do anything and they dont export anything. The only exception is Germany but they have a whole world of shit to deal with right now that will grag them down for the next 25 years.
The Net Net when you cut through all the noise - is that the U.S Equity market - looking ahead about 10 years is somewhere between 50-80% over-valued as are most European stock markets
What you are seeing is the beginning of a massiove sea change in Global power and most of teh idiots you see on CNBC talking about p/e ratios offering great value at current levels havent even begun to work it out yet - to be honest they couldnt devlop an intelligent line of thinking / put 2 and 2 together - or have an "out of teh box idea" if you stuck a gun in their mouths
Its truly incredible how people "still" cannot see whats coming !!!
Best
C
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

The other major problem with inflation is taxation. Tax is based on nominal gains and so greatly worsens the after tax return in an inflationary environment. Or do most tax authorities now inflation adjust gains? I am out of touch. Trying to build inflation in to a trend following model seems like rather a difficult concept: you are better off making a nominal gain out of a trade than no gain at all. And inflation in a global environment means that it is difficult to escape its effects.

On currencies, you could of course re-base each instrument into your home currency so that its historic, current and future gains and losses are magnified or lessened by the day by day currency effect. A USD gain in a given instrument may become an AUD loss and re-basing may cause your TF model not to take a long position in that instrument where a non-currency adjusted price series would have led to the taking of a long position.

But of course currency still affects you even if you leave the price series un-adjusted: a Yen gain or loss is still magnified or lessened by the FX rate between the Yen and your home currency.

The MSCI website is a rather good place to look at the differences this can make. Their indices are expressed in USD, Euro and local currencies and, as can be imagined, the differences in a given index expressed in a different currency can be alarming. They publish a very detailed explanatory booklet on the calculation of the indices.

On currencies, my personal preference would be to leave instruments denominated in the currency they trade in but to keep the balance of the account not needed for margin in a broadly based basket of currencies. I do not do this currently but have been thinking hard about the matter. Of course, there will be times when your home currency far outpaces the basket on the upside and you are disadvantaged but the long term effect may be beneficial and cause one to sleep more easily at night.

Construction of the basket is a whole topic in itself. Rather like the argument against market cap weighting for stock investment, do you really want the great majority of your assets in USD or Yen or whatever? Or would you prefer a more equal weighted approach?
sluggo
Roundtable Knight
Roundtable Knight
Posts: 2987
Joined: Fri Jun 11, 2004 2:50 pm

Post by sluggo »

I have introduced inflation into a couple of mechanical systems that are trading right now with real money, taking real risk. The general idea is fairly simple: wherever a hard-dollar number appears in the system, replace that by an inflation adjusted dollar number. Without revealing the secret specific details used in these actual systems, this concept could possibly be applied in a few ways
  • Volatility filters: if volatility (however you measure it) is < $1000* for a one-lot trade, reject this entry signal. Likewise if volatility is > $4000* for a one-lot trade, don't enter
  • Small account filters: If risk-to-stop of this entry signal is too large for a $100,000 account*, reject this trade no matter the size of your account at the moment.
  • Position sizing constants: wherever position size computations contain a hard dollar number, adjust it for inflation. Including commissions and slippage, of course.

*Perhaps $today = $base * (inflation coefficient) ^ (timetoday - basetime)
stopsareforwimps
Roundtable Knight
Roundtable Knight
Posts: 199
Joined: Sun Oct 10, 2010 1:47 am
Location: Melbourne Australia

Post by stopsareforwimps »

AFJ Garner wrote:Construction of the basket is a whole topic in itself. Rather like the argument against market cap weighting for stock investment, do you really want the great majority of your assets in USD or Yen or whatever? Or would you prefer a more equal weighted approach?
I try to match my holdings to my expected future consumption. To the extent that some of my future consumption is Martin Randall tours I need some holdings in GBP. As most of my consumption is local I think it makes sense to have a bias to my local currency. On the other hand a friend of mine, who came here a while back from the then chaos of Argentina, advises me to treat living in any country as a temporary situation - things can go bad quickly and you need to be in a position to move on if need be. If you accept that, a basket would be better.

I treat each asset in hedged (to AUD) and unhedged form for trend following purposes. That is, I treat the hedged and unhedged forms as separate investments. Thus I am currently slightly long SP500 hedged and short the unhedged form.

The admirable Jarrod "Investing by the Numbers" Wilcox discusses some of these issues in "International Investing. The Dutch Investor's Perspective" available for purchase at http://papers.ssrn.com/sol3/papers.cfm? ... t_id=77350.

BTW I have finally ordered your book. Looking forward to reading it.
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

I know Martin Randall and his wife. You certainly need a penny or two to travel with Martin!
Bounty
Senior Member
Senior Member
Posts: 33
Joined: Tue Jun 19, 2007 8:59 am

New Turtle System

Post by Bounty »

You said:
AFJ Garner wrote:

Code: Select all

IF (order.IsEntry != TRUE) THEN
	IF (FindString(order.executionType, "Stop") != -1) THEN
'		order.Reject( "So called stops are not honored" )
	ENDIF
ENDIF
	
Sluggo reminded me today that the 3rd line of the Can Fill Order Script of the Thermal BBBO RM Blox needs to be "commented out" for a sytem such as the Donchain which uses stops. For anyone trying to duplicate my results using the Blox suggested above, this change is vital.
How can this be modified for those of us that don't have Builder?
dantes
Roundtable Knight
Roundtable Knight
Posts: 128
Joined: Sun May 08, 2011 1:40 pm

Post by dantes »

Dear Anthony -

Thanks for such an interesting post.

Would you mind sharing some more detail around how many sectors you're using for your backtest, and how you defined them?

I have been trying to replicate your results and I'm under the impression sector rules/definitions play quite a big role.

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

Post by AFJ Garner »

Here are the sectors used for the test:

Bonds
Currencies
Grains
Energy
Interest Rates
Meats
Metals
Notes
Other
Softs
StockIndices

I included around 106 assorted futures from these sectors.
dantes
Roundtable Knight
Roundtable Knight
Posts: 128
Joined: Sun May 08, 2011 1:40 pm

Post by dantes »

Hi Anthony,

Thanks for your reply.

I'm using the settings you suggested on a portfolio of 116 futures with the following sectors:
Bonds 16
Energy 8
Currencies 18 - both USD and non USD crosses
Grains 10
Stock Indices 25
Interest Rates 9
Meats 3
Metals 13
Softs 14

I get however results that are quite different (see attached):
27.83% CAGR
1.05 MAR
1.32 Annual Sharpe
26.4% Max DD
15.8 longest DD
3,431 trades

Quite puzzling why results are so different with same time period (1970->2010), same settings and (reasonably) similar portfolios?
(I'm running the volume-unconstrained simulation, i.e. assuming I can trade as many contracts as I want)

Any insight would be greatly appreciated, as I've been tinkering with this for a while without getting even close to your results...

Have a nice weekend.

Dantes
Attachments
Settings.jpg
Settings.jpg (72.02 KiB) Viewed 12926 times
Results.jpg
Results.jpg (37.88 KiB) Viewed 12929 times
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

Try toggling the "earn interest " button on and off. Set slippage to something low like 7%, roll slippage to 3.5%, commission to something low like $7.

If I were you I would not be worrying myself too much about all this. I am sure that by now you realise the tiniest alteration in some forgotten setting or area of the coding or data file can dramatically affect the results. I can almost guarantee that you would not achieve these results going forward, especially the MAR. I am afraid I must emphasize yet again that back testing usually involves a great degree of hindsight and curve fitting - we paint the picture we want to see. It is unlikely to work out so very rosy in practice. The risk levels are extremely high in the test I ran and by a few deft changes I can easily twirl the max DD back up to a far more realistic 30 to 60%!

Take one ridiculously small element you may not even have considered: the order in which trades are presented to the risk manager. This can make a dramatic difference. I can imagine that you are using the standard procedure: orders will be presented to the risk manager as per the futuresinfo.txt file. See another post I recently wrote about this. Experiment with changing the order: try some sort of "order of goodness" - rank by positive momentum for instance. Try random ordering using the built in TB random function.

viewtopic.php?t=9003&highlight=rank

Perhaps the greatest use of threads like these is to hone one's detective skills. "Lies, damn lies.......and back testing". My message to you is this:

Do not be seduced by ultra attractive test results. Do not imagine someone else has found the philosopher's stone. Assume the worst and go for realism over idealism.
dantes
Roundtable Knight
Roundtable Knight
Posts: 128
Joined: Sun May 08, 2011 1:40 pm

Post by dantes »

Anthony - thanks for the feedback and again for posting the model, which led me to questioning some important assumptions.

Looking also at this other post on MAR ratios for reporting CTA's, one also gets a good picture of what is actually achievable in the real world vs backtesting:
viewtopic.php?t=8778&highlight=measure+correlation[url]

This opens the door for asking if Max DD is so important after all.

I.e.: if you invest with me for the long run and I deliver say 20% annualized returns after fees for 15yrs, does it really matter if I along the way I have a 12-month 30% DD?
AFJ Garner
Roundtable Knight
Roundtable Knight
Posts: 2071
Joined: Fri Apr 25, 2003 3:33 pm
Location: London
Contact:

Post by AFJ Garner »

Let me give you a concrete example. Look at the back test of Aberration on a small 26 futures portfolio from 1995 to 2003. It all looks very enticing over a long track record.
Attachments
Ab1.JPG
Ab1.JPG (68.33 KiB) Viewed 12753 times
Post Reply