You’ve heard me talk a lot on this blog about building adaptive trading strategies that are capable of “learning” from the markets. Our recently launched YK Strategy takes this approach and so far has done an excellent job adjusting to some very troubled markets.
Last month I posted a framework that we used to build our own adaptive strategies. I received a positive response but also a very consistent request – give us an example.
So in this post I’m going to demonstrate the simplest possible adaptive system I can think of. In the near future, I’m going to follow that up with another looking at how this super simple strategy could be improved on within our framework. Prepare yourself for some geekery…
The graph above shows the US Dollar Index (USDX) in blue and a static strategy for trading the USDX using the S&P 500 that I wrote about previously: go long the USDX at today’s close when the S&P 500 closes below its 2-day simple moving average (SMA) today and short at today’s close if it closes above. Results above assume frictionless trading.
Note how after 2003 there was a seismic shift in this USDX/S&P 500 relationship – the static strategy was turned on its head and suddenly, the opposite rules were as effective as the original ones.
Now let’s apply a super simple adaptive concept to the strategy above.
Create a rolling 1-year moving average of the daily returns of the static strategy. When the moving average is positive, trade the strategy as shown, and when it’s negative, trade the opposite rules. A geek note: to ensure that the strategy can’t “peek” into the future, make sure you’re basing each day’s direction on the previous day’s moving average.
Because of the length of the lookback period, I’m going to add one tiny bit of sophistication – use an exponential moving average (rather than an arithmetic one) to ensure more recent data is more heavily weighted. The results (original static strategy in blue, new adaptive strategy in red)…
The new adaptive strategy stumbled a bit as it responded to the shift in the USDX/S&P 500 relationship, but clearly it (eventually) successfully evolved. Some stats…
A couple of important notes.
First, my selection of a 1-year exponential MA was completely arbitrary. It was the first thing to come to mind and I ran with it. Tinkering would produce significantly better results.
Second (and this is a “thinker”) – it’s important to realize that the reason the adaptive concept worked was that over the entire test the USDX/S&P 500 relationship had an impact on USDX returns. It didn’t so much matter what that impact was (because as we saw, it shifted in a big way) – it’s only important that there was some sort of impact.
Stay tuned for Part III. The test I’ve done in this post was very simplistic. In Part III I want to take this simple strategy and talk about how it could be improved upon within our adaptive framework. More to follow.
Happy Trading,
ms
To stay up to date with what’s happening at the MarketSci Blog, we recommend subscribing to our RSS Feed or Email Feed.
Filed under: Evolving Markets, Trading Strategies, US Dollar & Currencies | 13 Comments






Michael,
Wow, thanks for this post! Your previous post gave me some great ideas and this post helped me know I was on the right track. I look forward to post #3!
Best,
Josh
Brilliant – I love the concept and simple example!
Thanks for fine example.
In general, isn’t your adaptive approach the same as using a good trading formula that is re-optimized continuously for best-fit parameters?
I have long toyed with this idea using Amibroker (AB). AB allows optimizing/backtesting a routine and then using the resulting equity line to optimize a second routine to “reverse” trades as the initial trades begin to fail.
Great post. For some reason this idea escaped me for a long time. I think it was a situation of over analyzing the situation & missing a simple answer to the problem.
It would seem that this concept would would well with the system you developed for gold to be long @ night & short during the day. If I remember right, that system had a large shift in profitability during the testing period.
Regards,
Eric
RE to Paul: interesting question re: “is this the same as constantly reoptimizing for best-fit parameters”…
In the case of the example above, yes, it’s similar in spirit.
In the case of YK I would say no because with YK we introduce the concept of “confidence”. Recall my original post on adaptive strategies where I talked about the light switch vs the dimmer. The strategy above is a light switch – it’s either one way or the other. With YK it’s a dimmer – each day I want the strategy to tell me how confident it is in its analysis and then scale the allocation (from 0-100%) based on that confidence.
Great comment.
michael
RE to Eric – conceptually, yes, this concept I think would be very powerful on the gold daytime vs overnight observation we talked about here: http://marketsci.wordpress.com/2008/07/22/gold-is-nocturnal-too-sometimes/
The problem would come in execution. Whereas the strategy above could be applied to leveraged funds (meaning no slippage or transaction costs), the gold strategy would require intraday vehicles and frequent trading. Would it still be worth the while? I don’t know…very possible though.
Another great comment…I hadn’t even thought about the gold post, but it fits well with this concept that “it doesn’t matter what the impact is, just that it has an impact”.
michael
Michael – I wonder how much transaction costs would impact the long night & short day type system. I think one could put a t-test or something together that would say ‘given factors a & b, this trade has a high expected value inn excess of slippage costs’. I don’t know what those factors are yet, but I believe there could be some value gained from some simple themes such as ‘does it matter if we are in an uptrend or not?’ or ‘does recent volatility impact the results or not’. Also, one may be able to use some adaptive logic such as ‘only trade the top 25 stocks using the long night & short day system, as determined by the past two months results’ or something similar. I trade futures so the transaction costs are minimal for frequent trades.
I am currently experimenting with variable position sizing (similar to what you mention ) based on some statistics & common traits learned from past trades.
Here is a good post on execution @ the open & close:
http://puppetmastertrading.com/blog/2008/08/01/execution-quality-at-the-open-close/
I would welcome the opportunity to collaborate on any of these concepts/ideas with you.
Regards,
Eric
RE to Eric – agreed, agreed, agreed with your comments re: if transaction/slippage is a concern, tune the model is exclude those trades with low confidence. Let me finish a couple of things on my plate and then i’m going to dig into the gold idea. More to follow…
michael
Mike and Eric-
I’m entering this overnight/intraday discussion late, but I’ve been fiddling with this using Amibroker. There are many common stocks and some ETFs that consistently have overnight moves opposite to their intraday moves. Look at PZD for example (wish I could attach a png image). The overnight is almost always up while the intraday is down. If the volume were there at open and close (it is marginal), trading such issues would be very profitable.
Micheal just reading some posts while it snows outside yesterday and I really started thinking about what you are talking about here. On a simplistic level isn’t the adaptive system you describe here and throughout your blog just trading the equity curve? Correct me if I am wrong but it seems to me that if a system isn’t working and you switch from going long with margin to just going going long without margin or short (whatever the rules are) then that would be derived from the equity curve.
I don’t know if you are aware of this forum on elitetrader but it is an excellent one. It talks about when and how to activate/deactivate a trading system with all kinds of opportunities to use your “dimmer switch” concept.
http://www.elitetrader.com/vb/showthread.php?s=&threadid=36083&perpage=6&pagenumber=1
Eric
Btw I am not the author of the thread
RE to Eric: thanks for the link – will take a look.
At a very, very simplistic level, yes, we’re trading the equity curve.
But we’re also doing much more beyond that – a lot of which I’ve talked about on this blog (accounting for volatility of returns, de-trending predictions, removing outliers, etc.)
Enjoy your snowy reading day.
michael
I think you just gave me a clue as to how to improve my “Agosto Index” (using UUP to trigger buys of DOG) if the relationship goes from inverse correlated one to positive correlation.
Thanks