• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

SanzProphet

DYI Investing, Quant tools and thoughts on the market

  • Start Here
  • Crypto Management
  • About
  • Contact
  • Disclaimer

From Regime Switching to Fuzzy Logic -SP500

September 19, 2013 by sanz prophet 2 Comments

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:

 Conclusion:
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: 
Dayreturn=ROC(C,1);
AutoCor=Correlation(Dayreturn,Ref(Dayreturn,-1),22);

Filed Under: contrarian, fuzzy logic, momentum, SPY

Reader Interactions

Comments

  1. Crakes says

    September 20, 2013 at 6:22 pm

    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…?

    Reply
  2. Sanz Prophet says

    September 20, 2013 at 10:44 pm

    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.

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Keep in touch

Managed Crypto Funds

via TokenSets.com

Categories

Archives

Footer

RSS Portfolios from Logical-Invest.com

  • Bond ETF Rotation Strategy: Low-volatility portfolios for smart investors from Logical Invest
  • BUG Permanent Portfolio Strategy: Quantitative investment models from Logical Invest
  • Crypto & Leveraged Top 2 Strategy: Risk-adjusted investment portfolios from Logical Invest
  • Dow 30 Strategy: Quantitative investment models from Logical Invest

Pages

  • About
  • Contact
  • Disclaimer
  • Start Here

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2023 · @SanzProphet.com· Log in