Algorithmic and Mechanical Forex Strategies | OneStepRemoved

  • Articles
  • Sophisticated Web Sites
  • Automated Trading
  • Testimonials
  • Contact

Further Proof That Backtesting Results Don’t Guarantee Future Performance

November 18, 2013 by Andrew Selby Leave a Comment

In theory, it makes perfect sense that fundamental changes in markets over time could cause systems that had an edge to become unprofitable. However, because we generally backtest systems all the way up to the current time, encountering a system with a dramatic change like this is not common.

Matt from Don’t Fear The Bear recently came across a system that gave him the opportunity to test two different time periods. The system he discovered was written and backtested in 2009. At that point everything looked great, but as you will see that did not continue to be the case. Matt was able to replicate the previous backtesting results testing over the previous time period, but the results moving forward were drastically different.

Matt shows us a system that performed one way up through 2009 and then produced inverse results ever since.

Matt shows us a system that performed one way up through 2009 and has produced inverse results ever since.

Here is how Matt came across those posts:

I was browsing my twitter feed this week and saw a couple old Quantifiable Edges posts (hereand here) linked to by @PsychTrader.

The two posts were written in mid-2009 and detail a simple weekly strategy that uses the relative performance of the S&P 500 and Nasdaq indexes to time the market.

They showed how investing in the SP 500 or Nasdaq  when Nasdaq has been outperforming (based on 10 week relative performance) has generally beat out buy and hold.

Matt decided to test how a simple system that held either QQQ or cash depending on whether QQQ was either outperforming or underperforming the SPY would fare. He tested two different versions. The first version held QQQ when it was outperforming the SPY and cash when it was not. The second version held QQQ when it was underperforming the SPY and cash when it was not.

Here is what Matt found:

First let’s look at the period from 1999 (inception of QQQ) to the end of 2008.

The strategy to invest in QQQ when it underperformed SPY got crushed during the bear markets and just treaded water during the bull market.

The inverse strategy did much better and held its ground through bull and bear period alike.

Interestingly, the strategies flip-flopped starting in 2009:

The strategy that sucked big time before has been steadily rocketing higher while the formerly better strategy has been treading water.

I guess this is just another example of strategies being turned on their head at the market’s whim.  This is one I’ll be keeping tabs on going forward.

As you can see, this weekly QQQ strategy makes logical sense and would be  fairly easy to trade. The only problem is that you wouldn’t know which version to trade moving forward. This further stresses the point that backtesting results do not guarantee future performance!

Filed Under: Test your concepts historically Tagged With: backtest, qqq, simple system, SPY, weekly system

SPY Crisis Strategy Questions

October 14, 2013 by Shaun Overton Leave a Comment

Ed wrote me an email asking how he can trade the SPY Crisis Strategy. He likes the idea, but the problem is that his account balance is too small. He was under the impression that he can only participate with a futures account.

That was true several years ago. Luckily, the brokers have wised up and offer traders many more options. SPY is the ETF based on the S&P 500. ETFs are technically “Exchange Traded Funds”, but you can think of the SPY as a stock. You would place SPY trades in the same way that you buy or sell any stock in your brokerage account. Wikipedia offers a great ETF explanation if you’re new to the concept.

The returns that I posted for the strategy assumed that you were trading SPY without leveraged. If you’re a forex or futures trader, there are a few options available:

Forex traders can inquire if their broker offers index CFDs, especially if you want to trade the idea from MetaTrader. A CFD stands for “Contract For Delivery”, but don’t worry. Your broker has no desire or interest to make deliveries on oil or the S&P 500 CFDs. CFD is a legalistic creation where the broker promises to deliver the object traded on a certain date. In reality, the contract is perpetually rolled 2 days into the future. The position allows you to hold the spot price of the S&P 500 without needing to purchasing any stocks or resorting to the futures market.

The best option for futures traders are the e-minis (Symbol: ES). You should trade the front month contract for all signals. This is certainly the most efficient way to trade the idea. The only reason I stuck with the ETF is that I don’t have to dive into messy backtesting assumptions with continuous contracts and rolling open positions.

NinjaTrader is a great option regardless of the instrument that you trade. It’ll handle any market that you select: CFD, futures or the ETF.

Filed Under: MetaTrader Tips, Trading strategy ideas Tagged With: CFD, continuous contract, e-mini, etf, forex, futures, S&P 500, SPY, stock

SPY Crisis Strategy

October 11, 2013 by Shaun Overton 3 Comments

Yesterday’s musings on an S&P 500 doji strategy led to a general discussion of stocks and market crises. I promised to analyze a price-moving average cross strategy and to analyze the performance in times of exceptional volatility.

The results are in and they’re exactly what I predicted. I’m shamelessly tooting my own horn on this one – it’s so rare where strategies do exactly what I predicts.

SPY Crisis Strategy Returns

The direction of the returns matches any traders definition of crisis and regular trading periods over the past decade

SPY Crisis Strategy Rules

The trading rules only initiate short trades. No long positions are allowed.

Enter short next bar at market when:
The price crossed and closed below the 20 day SMA on the last closed bar
The trader believes that a crisis environment either currently exists or is about to exist

Exit an open short trade when:
The price crosses and closes above the 20 day SMA on the last closed bar

The position size is equal to a fixed dollar value divided by the current share price. As an example, SPY currently trades at $169.24. If you wanted to control a position size worth $1,000, then the number of shares is the floor of $1,000/$169.24 = 5 shares.

This strategy is intended to be timely for the current trading environment. Based on all of my proposed definitions below, most of the crisis alarm bells are ringing at the moment.

Defining a crisis

The most difficult part of this type of strategy comes from defining a “crisis environment” quantitatively. Crises don’t happen very often by definition, so I don’t think it’s a worthwhile endeavor to try to quantity the crisis bit. That said, a few obvious crisis indicators come to mind based on basic market mechanics.

PE Ratio

The morons on Tout TV (CNBC and company) keep on screaming how cheap stocks are. I’m not a fundamental trader, but the PE ratio contains useful information. Even the most hard core technical analysis buff would agree that companies generating huge positive cash flow and earning growth have to appreciate at some point. The argument isn’t about if that type of stock will rise; it’s just a question of when.

I don’t see how anyone could possibly look at the current PE ratio of 19.3 and argue that stocks are cheap. They aren’t. Stocks are currently very expensive based on a historical comparison.

VIX

VIX is a CBOE benchmark index that allows traders to compare the price of front month options traded on the S&P 500. A more detailed explanation of the VIX is available on Wikipedia if the concept is new. There’s nothing magical about the 20 level. It’s my general experience that most traders consider that number the one to watch. They think of VIX < 20 as "normal" and VIX > 20 as a severe market move.

VIX danger level

Most traders regard a VIX above 20 as a dangerous level.

Put-Call Ratio

Options are effectively leveraged bets on market movements with fixed downside risk. When traders load up on puts, they’re expecting the market to fall. When traders buy more calls, they’re expecting the market to rise.

The put call ratio is simply the number of put contracts traded / the number of call contracts traded. A number > 1 means that more puts were purchased that day than calls, indicating an expectation of a market drop.

Theory has it that short term traders are wrong, making the put call ratio a contrarian indicator. I see the put call ratio as more of a lagging indicator.

ES Put call ratio

When a move is real and already happened, traders react too late and buy protection that they no longer need. The 2008 financial crisis a great example when the ratio spiked to 1.5, a wild number. Just in the past week the ratio went as high as 1.3 before settling back down. The volatility in the number indicates a panicky crowd in my opinion.

Margin debt

Leverage is a two way sword. The theory is that it’s a way to multiply returns by risking debt in the market.

Most traders, and especially retail traders, wind up using leverage as the rope to hang themselves with. Stocks are most commonly purchased with cash among investors. Unlike forex and futures where almost every trader enters a position with leverage, the average retail stock trader enters a position using only the cash present in his account.

An increased willingness among traders to move from cash to margin debt is typically a sign of froth, bubble fever or whatever you want to call it. The chart of margin debt from Business Insider and Zero Hedge show that stocks are currently trading near historical highs.

margin debt business insider

Margin debt Zero Hedge

Conclusion

The 20 day SMA price cross strategy is a great way to run account protection whenever market warning signs are going off. The warning signs may not predict the precise market turning point, but the strategy can function as an effective form of insurance.

The strategy would roughly break even over time if someone were foolish enough to run it that way. Say that you mistime the crisis. Big deal. This type of strategy can run for months without causing irreparable harm to the account.

The signals can run in the background. If you’re only a little bit right with your crisis predictions, the risk reward ratio is massively in your favor. If you’re wrong, the consequences appear to be slow losses that lose a couple of percentage points per quarter. If you’re feeling edgy, I think it’s a great strategy to run in the background to calm your mind.

Filed Under: Trading strategy ideas Tagged With: contrarian, dot com bubble, ES, etf, financial crisis, forex, futures, margin debt, moving average, Put call ratio, risk reward ratio, S&P 500, SPY, stocks, VIX, volatility

SPY and Dojis

October 10, 2013 by Shaun Overton Leave a Comment

Everyone here knows that I’m a fan of the dumbest possible strategy. The less complex that rules are, the easier it is to understand when something inevitably breaks.

The SPY and Doji strategy from paststat most certainly fits the bill. The SPY is the ETF that tracks the S&P 500 index.

They tested a simple idea: does a doji on the SPY contain any predictive value? The short answer is a qualified yes.

The dojis offered no predictive value on their own. However, teaming them up with a 200 period moving average showed much better results. Use the location above or below the moving average showed a clear relationship between profit and loss.

SPY Doji

So am I not touting this to all my readers? The biggest problem with a strategy like this is the sample size: there are only 40 trades in the largest sample. Some of the posted results only analyze the outcomes of 12 trades. That’s not a strategy. It’s hardly an observation, either.

What I do like about the idea is that it hightlights something fundamental about how the stock market works. I always think of it as a pair trade. You buy 1 unit of stock for every X dollars of currency.

You’re really pair trading two asset classes: one is a stock, the other is dollars. The flow of the forex market dominates stocks. A surge in dollar strength almost certainly anticipates a down day in stocks.

The fits and starts of the forex market lead stocks to crawl their way upward. Bull markets last for years and years. Unless you’re counting Fed days, there’s no particular move that dominates in stocks.

SPY Strategy Idea

Contrast that with bear moves and the difference is night and day. Everyone knows about the 1987 crash when the market crashed 22% in a single day. Our more recent crisis in 2008 inflicted similar damage over a period of weeks.

Price crossing the moving average is one of my favorite strategies. It’s dummy proof and I’ve seen it work in several markets, especially forex commodity crosses.

The SMA filter that paststat applied in the doji strategy might just make for a better daily trading strategy altogether. I’d even be tempted to ignore the long trades and take short only signals. A simple filter like the put-call ratio might help filter out the worst of the noise trades.

What I like even more is that it’s a strategy that could apply in today’s market:

  • The stock market is trading on record margins of debt
  • Selling the idea of a crisis isn’t hard with the potential US default looming

We’ll have to take a look at this in more detail tomorrow.

Filed Under: Trading strategy ideas Tagged With: default, doji, dollars, forex, leverage, moving average, SMA, SPY

FREE trading strategies by email

Trending

Sorry. No data so far.

Archives

  • Dominari
  • How does the forex market work?
  • Indicators
  • MetaTrader Tips
  • MQL (for nerds)
  • NinjaTrader Tips
  • Pilum
  • QB Pro
  • Stop losing money
  • Test your concepts historically
  • Trading strategy ideas
  • Uncategorized
  • What's happening in the current markets?

Translation


Free Trading Strategies

Privacy PolicyRisk Disclosure

Copyright © 2023 OneStepRemoved.com, Inc. All Rights Reserved.