SPY: Using a market environment filter to decide how to trade

This post is about how to use the previously (link) discussed and build market environment filter for switching between two indicators and decide when to trade long or short.  While we will come up with a decent strategy my main focus is to guide you through the thought process of how to build a trading system.

Strategy objectives and background

  • Trade the SPY (ETF of the S+P500 index) long / short.
  • Outperform  the SPY (buy and hold)
  • Annual growth rate twice as high as max draw down (intraday).


  • Strategy testing ~ 11 years  (2000 – today)
  • SPY not adjusted for cash dividend.
  • 100% equity per trade (compound returns)


I’m going to use DVO and DVI as my only tools for timing the SPY. Both indicators are from David Varadi. DVO is a short-term mean reversion indicator. DVI is an intermediate term indicator signaling overbougth / oversold conditions. While both indicators are a great tool for the savvy trader, their real power comes into play when combining them (and this is what this post is about). Now the fun stuff begins. We will analyze how the indicators do within the various market environments.

Long – Trades

The table has four columns for each of the Market environment filters

  • High Trend: TSI > 1.7, High Volatility ATRrank > 50 (HTHV)
  • Low Trend: TSI < 1.7, High Volatility ATRrank > 50 (LTHV)
  • High Trend: TSI > 1.7, Low Volatility ATRrank < 50 (HTLV)
  • Low Trend: TSI < 1.7, Low Volatility ATRrank < 50 (LTLV)

and a fifth column showing the performance without any filter. The explanation of the KPIs used can be obtained here (link).

Short – Trades

Initial thoughts

  • DVO is generally performing better in volatile market
    • long: LTHV or HTHV or HTLV
    • short: LTHV
  • DVI does better in trending markets (intermediate trend cycle is more dominant than short-term cycle).
    • long: HTLV or  HTHV
    • short: LTLV or HTHV

In the next post we will look at how the combined long/short strategy performed.

- Frank

About these ads


  1. Hi Frank,

    How do the returns look if you filter only by HT/LT and HV/LV. Does the combination of the two readings actually improve the returns?

    Have you thought of running these tests on more than one index? 11 years of the S&P is rather limited don’t you think? What about the Nikkei 225, FTSE 100, NASDAQ, Dax and Hang Seng etc?

    David’s indicators that you have used, are they proprietary?

    Keep up the good research

    • Hello Derry,

      I do test my SPY mean-reversion strategy usually on 10-12 years of history. Haven’t done any testing on other time series. Let me know your results in case you do it, THX.

      You can get the DV indicator suite over at
      Please do understand that I’m not associated with DVindicators.


    • Derry, I am not sure about the volatility filters (ATR, HV) as I did not find such significant improvements. Maybe I am doing something different (and then wrong). But the TSI is for sure a great filter for all mean reversion strats on the long side. Not short and depending on the market different thresholds makes sense. Dax, Hang Seng, etc.. Bund for example behaves different. I test with backadjusted futures data from CSI.
      Thanks for the great research Frank.

      • Hi Lantama,

        Thanks for your feedback. The purpose of the post(s) has been on why to have such a filter and what to consider when building one. The volatility filter “example” isn’t the best one, but you certainly want to consider volatility as a second dimension.


  2. Hi Frank,

    All of these indicators are also provided in ETF Rewind nightly as well for those more interested in a subscription model. We are coming out with live calcs presently as well should you wish to publish this note.


    Good work as usual.

    My best,


  1. [...] help you building better trading systems. First the ME filter has been discussed and defined. In a second post we looked at the various indicators and how these performed under different [...]

  2. […] engineering-returns.com […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 306 other followers

%d bloggers like this: