Fuzzy Logic Algorithm example


   I started some experiments with Fuzzy Logic in QuantConnect / Lean.

   Fuzzy Logic makes sense in technical trading, as the variables are considered fuzzy (many-valued logic) with "truth values" between 0 and 1. This is much more adequate for leading with subjective decisions and uncertainity, rather than with crisp values wich are "idealistic". Example, is RSI > 80 High ? What about 89 ? Not high at all ? :)
   Please, find an intro to fuzzy logic in the context of automated trading here

   In this example i used two classic indicators - RSI and Momentum - just for illustration purpose. 
      Many rules can run at the same time, and Linguistic Variables can have several memberships. 
    I am using the Accord.NET frammework Fuzzy Library (installed on LEAN since Machine Learning also from accord was installed):


Feel free to contact me, for questions, or ideation sharing.
Have fun


Update Backtest

Sorry, in the example i wanted to write What about 79 ? Is it not High ? :) No, if our rule is a crisp one - IF RSI > 80. But with memberships, yes, 79 is high. Not so high as 80, but it is still "a lot" high 



Marco, thanks for sharing!

I am cloning the algo and reading a bit more on fuzzy logic, very educational!





I read an interesting implementation that you may use to sophisticate the criteria




Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed