From Regime Switching to Fuzzy Logic -SP500

In the previous post I showed how one can implement “regime” switching to create a strategy that switches between a mean-reverting and a momentum sub-strategy.

Can we do something similar (or better) using Fuzzy Logic?

  Here’s the setup: (here for some Fuzzy Logic backround)

We create a basic membership function for the RSI(2) indicator: “Low”, Medium” and “High”
We create a basic membership functions for the Correlation* indicator: “Low”,”High”.

We implement these rules:
1.//mean revert – LOW Autoccorelation
IF “rsi” is  “Low” AND “autocorrel” is “Low”, “Action”, 1 ; //Buy
IF “rsi” is “High” AND  “autocorrel” is “Low”, “Action”, -1 ; //Sell

//MOM – HIGH Autocorrelation
IF “rsi” is “Low” AND “autocorrel” is “High”, “Action”, -1 ; //Sell
IF “rsi” is “High” AND “autocorrel” is “High”, “Action”, 1 ;  //Buy

Here’s the Equity:

As with Regime switching we can use Fuzzy Logic to solve the problem of using one strategy for trading pre- and post-2000 SP500. Furthermore, we have more robust and less specific rules to deal with (buy on “Low” RSI rather than Buy=RSI2<30).

*By “Correlation Indicator” I am referring to the  22-day Correlation (see previous post) between the current return and the previous day’s return. In Amibroker Code: 

2 thoughts on “From Regime Switching to Fuzzy Logic -SP500”

  1. Hi Sanz,

    The drawing looks a little smoother with less drawdown. Does the fuzzy logic improve the trade stats such as reducing number of trades, increase average trade gain, etc…?

  2. Hey Crakes,
    Yes. It does improve the stats. I am not posting exact stats since I am not posting the code. Suffice to say that the fuzzy model came up with this type of performance without any effort. You could "tweak" it to perform even better by adjusting membership functions or weights of the rules, etc. The "regime-switching" model uses rules like buy=RSI(2)<30, which are specific and fitted to the data, thus more likely to under-perform. My guess is that in out-of-sample testing (i.e., trading) the fuzzy model should have better chances of surviving.


Leave a Comment