Discussion of article "An Introduction to Fuzzy Logic"

 

New article An Introduction to Fuzzy Logic has been published:

Fuzzy logic expands our boundaries of mathematical logic and set theory. This article reveals the basic principles of fuzzy logic as well as describes two fuzzy inference systems using Mamdani-type and Sugeno-type models. The examples provided will describe implementation of fuzzy models based on these two systems using the FuzzyNet library for MQL5.

The mathematical theory of fuzzy sets and fuzzy logic itself originated back in 1965. Its founding father was a Professor Lotfi Zadeh from the University of Berkeley, who first introduced both concepts in his article "Fuzzy Sets" in the Information and Control journal. This mathematical instrument allowed to introduce fuzzy concepts, that anyone could use, to exact science like mathematics, and laid the foundation for fundamentally new methods of problem solving on the basis of soft computing. All these innovations, when utilized properly, can greatly facilitate the process of solving classification problems, creating expert systems as well as building neural networks.

However, the practical application of fuzzy logic did not just stop there, in fact, this mathematical instrument has become predominantly used in automatic control theory. This can be further linked to the emergence of another new concept — fuzzy model, which is a particular case of a mathematical model.

Example:

Let's define a linguistic variable called "Age". By definition, "Age" is a period, a step towards development and growth of a human, animal, plant. The minimum value of this variable is 0, which means that a man is not even a year old. As a maximum value 80 is set up. Depending on the person's age we can give him the following assessment: "newborn", "young", "middle-aged", "old", "senior" etc. This list can accommodate a fairly large number of items. It will be a term set for our linguistic variable and its elements will be terms.

The figure below shows an example of the fuzzy variable "Age", which has only three terms set up: "Young," "Middle-aged,","Old." Each of these terms has its own membership function.

Fuzzy set "Age"

Author: MetaQuotes Software Corp.

 

Interesting. Of course it's interesting to learn how to calculate the number of tips. But it would be more useful if you could give a simple example from our field. For example, a simple Expert Advisor based on stochastics or RSI. Using fuzzy variables "overbought"/"oversold" to generate Buy/Sell signals and show the result. It would be possible to add and explain the concepts of "strongly", "slightly", etc. Probably it would help many people in determining how useful this direction is.

The statement in the article that there can be as many inputs and outputs as you like is not true at all. In practical problems, when the number of input variables is more than 5, big problems arise. It is recommended to break the problem into smaller ones.

For solving regression and classification problems what fuzzy logic systems are used?

Otherwise, as a very initial stage of mastering this field is useful.

Good luck

 
Vladimir Perervenko:

But it would be more useful if you could give a simple example from our field. For example, a simple expert based on stochastics or RSI. Using fuzzy variables "overbought"/"oversold" to generate Buy/Sell signals and show the result. It would be possible to add and explain the concepts of "strongly", "slightly", etc. Probably it would help a lot of people in determining how useful this direction is.

I used a library for MQL4 and just on the basis of simple RSI.

The article uses triangulation and trapezoidal membership functions. But I liked the Bilateral Gaussian and Bell-shaped belonging functions better. They seemed more flexible to me.

As an example, the dependence of RSI readings and take profit size was tested.

 
Alexander Fedosov:

I used the library for MQL4 and just on the basis of simple RSI.

Maybe then you can write an article on the application of fuzzy logic in trading?
 
Rashid Umarov:
Maybe you could write an article on the application of fuzzy logic in trading?
I could. I had such an idea because the theory of fuzzy sets applied to MQL4 is interesting.
 
Alexander Fedosov:
You can. I had such an idea because the theory of fuzzy sets applied to MQL4 is interesting.

The theory of fuzzy sets proposed by (L. A. Zadeh, 1965) is the basis for many methods, including fuzzy logic methods. The application of fuzzy logic assumes that youknow some rules of correspondence between fuzzy variables and the target that can be used. Getting these rules is the main problem. I don't mean elementary cases like "If "oversold" Then "buy" etc.

In my article "Selection and evaluation of predictors for machine learning models" one of the approaches to selecting predictors is to apply Rough Set Theory and its extension Fuzzy Rough Set Theory. (Fuzzy Rough Set Theory). They allow inducing (extracting) rules from a data set. The article is on validation. If there is interest in describing the use of approximate set theory more broadly, I will prepare an article.

If you have a ready example of using fuzzy logic or fuzzy sets in Expert Advisor, of course publish the article. I think it will be interesting for many people.

Good luck

 
Vladimir Perervenko:

The application of fuzzy logic assumes that youknow some rules of correspondence between fuzzy variables and the target that you can use. Obtaining these rules is the main problem.

This is the whole problem, that you need to be competent in two areas at once: the application area for which all this stuff is designed and experience in the application of fuzzy sets.

That is why there is such a low interest to the topic, because specialists competent only in one of the fields often cannot master the second one. Both require considerable experience.

However, in machine learning, where beginners naively believe that the algorithm "will sort everything out by itself, all you need to do is to learn how to feed it with data", it turns out that the user has to sort it out. That is, it is often easier to formalise the problem by oneself, after which the use of machine learning algorithms makes no sense and becomes superfluous.

 
Vladimir Perervenko:

If you have a ready example of application of fuzzy logic or fuzzy sets in an Expert Advisor, of course publish an article. I think it will be interesting for many people.

Good luck

In process.
 
Yury Reshetov:

This is the whole problem that you need to be competent in two areas at the same time: the application area for which all this stuff is designed and experience in the field of fuzzy sets application.

That is why there is so little interest in the topic, because specialists competent only in one of the areas often cannot master the second one. Both require considerable experience.

However, in machine learning, where beginners naively believe that the algorithm "will sort everything out by itself, all you need to do is to learn how to feed it with data", it turns out that the user has to sort it out. That is, it is often easier to formalise the problem by oneself, after which the use of machine learning algorithms makes no sense and becomes superfluous.

Here, on the site, there is enough information to understand the basics of applying fuzzy logic to trading. For this purpose, there are libraries for implementation in Mql4-5.

It is true that the algorithm always produces something when setting the input and output terms. But, I think that a big role is played by a clear and maximum detailed description of these fuzzy variables by membership functions. The more precisely the fuzzy sets are described, the more valid the result will be. This article describes examples based on the simplest triangular and trapezoidal membership functions. But this is the simplest realisation, and it is possible to make more complex, flexible and accurate. And the output result will be corresponding.

 
Alexander Fedosov:

There is enough information on this site to understand the basics of applying fuzzy logic to trading. There are also libraries for implementation in Mql4-5.

It is true that the algorithm always produces something when setting the input and output terms. But, I think that a big role is played by a clear and maximum detailed description of these fuzzy variables by membership functions. The more precisely the fuzzy sets are described, the more valid the result will be. This article describes examples based on the simplest triangular and trapezoidal membership functions. But this is the simplest realisation, and it is possible to make more complex, flexible and accurate. And the output result will be corresponding.

What about the rules? Let's have a look at the article.

Good luck

 
Yury Reshetov:

This is the whole problem that you need to be competent in two areas at the same time: the application area for which all this stuff is designed and experience in the field of fuzzy sets application.

That is why there is so little interest in the topic, because specialists competent only in one of the areas often cannot master the second one. Both require considerable experience.

However, in machine learning, where beginners naively believe that the algorithm "will sort everything out by itself, all you need to do is to learn how to feed it with data", it turns out that the user has to sort it out. That is, it is often easier to formalise the problem by oneself, after which the use of machine learning algorithms makes no sense and becomes superfluous.

I agree.

But one should keep experimenting.

Good luck

PS. By the way, I've been meaning to ask you for a long time. Would you like to transfer your product written in Java to R language? Then it would be possible to try it in "battle" on MT4.

So, thoughts aloud