What does it mean?

    Fuzzy Logic foundation was set up in the late sixties and came from an ordinary fact: real world in which we are living is far from Boolean logic (true or false, 0 or 1) so liked by western people for so many years. Between black and white colors, there are a lot of Grey colors.
One principle of fuzzy logic consists in dividing the input range of a variable between several subspaces (fuzzy subsets) to which a symbolic name is attached: « black », « dark Grey », « medium Grey », « light Grey », « white »... if we attempt to describe a continuous spectrum going from black to white.
For each of these subsets a « membership function » is defined which specifies how a Grey color belongs to a fuzzy subset. These are the gradual transitions of membership functions between neighboring subsets that gave this technique the so called fuzzy qualifier.
Here also, behind this apparently simple way to state a problem to be solved, come into play algorithms that run fuzzy rules on input data and compute output parameters. These algorithms are not fuzzy at all. They are based on a strong mathematical theory whose foundation is due to Prof. Lofti Zadeh (Berkeley).
One of the main interests of this theory is that many parameters can be taken into account since no mathematical modeling is required. This applies in the plant control area, but also for forecasting, decision support and risk scoring.

  • NeuroFuzzy Logic
    Rules and fuzzy sets are optimized by training strategies originated from neural network theory. We can then talk about « NeuroFuzzy ». This is the frame of SAFIR-X. (SirTrade is the application of SAFIR-X NeuroFuzzy to the specific problem of trading systems.)

Return to top

    Technical analysis is in itself a fuzzy concept.
Because the perfect rules that may drive any market are not known (and never will be as for physical and chemistry) the task of the technical analyst is to find an interpretative way to discover the beginning and the end of a trend as soon as it seems to appear.
All the information available are the price related information (including volume and Open Interest).
Several techniques are trying to modify the original data series into more readable components.
This is often to displace the problem, but sometimes the information becomes more obvious to the technical trader.

    It’s in this sense that such indicators as RSI, DMI, Stochastics and hundred of other derived data series have been devised since the advent of calculators and computers.
Combining these indicators or interpreting their results is often a cumbersome and deceptive task, as you may find a logic to use them properly.
And the combinations are so numerous that it’s impossible to test everyone without being never tired, less attentive during the research period.
But what a human being is not always ready to do, a computer will do it without any claim. Do not forget to supply only electrical power and data to analyze.

Back to fuzzy logic now:
Indicators above like RSI were devised with two levels (overbought-OB / oversold-OS), splitting the range of the RSI indicator into three domains:

RSI>70 è overbought.

RSI<=70 and RSI >=30 è neutral.

RSI<30 è oversold.

Any technical analyst that tried a system based on RSI and that tried to optimize the above levels has been told that sometimes 30/70 level works, sometimes 25/65, sometimes other values.
More, for a given value set, it’s easy to see that a microscopic variation of the RSI level above or below the OB/OS level would have produced a better result.

In fact, too much precision when using an indicator compared to a given level could bring very unstable results.

Here we can see the benefit of fuzzyfying the RSI indicators:
As for the gray scale example above, using only three fuzzy domains for the RSI will allow to this oscillator to be overbought, partially overbought and neutral, neutral, partially neutral and oversold, oversold, according to the position of the triangular domains (with a continuous variation due to overlapping of fuzzy domains) as shown on figure below:

Fuzzy logic and fuzzy sets  Fuzzy sets and indicators
Click on the above thumbnail image to get the full picture.   

Figure 1: Three domains RSI fuzzy variable (before training).
Click on the above thumbnail image to get the full picture.

Return to top

If we consider a trading system based on several indicators, one may apply the fuzzyfication to each one.
The main problem will be now to determine the number of fuzzy domains, to locate the fuzzy domains, even to modify their shapes in order to get the best results.
All this tedious task will be done for you when training the fuzzy predictor by using internal neural networks especially designed for this task.
One may see above how will look like the same RSI fuzzy sets after some special training done by Safir-X :

Figure 2: Three domains RSI fuzzy variable (after training).
Click on the above thumbnail image to get the full picture.

These snapshots were produced by an other software (Safir X Workshop )

The last operation is to combine the fuzzy variables to obtain a rule decision tree that will bring the answer to any case that could be encountered.
This is what is called a rule base.
This second tedious task is also done by the internal neural networks.
It’s better for you that the machine work on this task.

For example, let us see how looks like a rule base using only four inputs: ADX, RSI, ADX difference (dADX) and DMIPlus - DMIMinus (DMIdiff) used to predict the signal value.
ADX features 5 fuzzy domains (L,M3,M2,M1,F) and the other inputs have only three domains (F, M,L).
This yields to a maximum of 9 x 3x 3 x 3 x 3 = 729 rules as shown (partially) in the example below.

The maximum of rules is always the product of the number of domains (fuzzy sets)

for all (n) inputs variables.

n

Nb_rules = P (nb_fuzzy_sets)i

i=1

Fuzzy sets and fuzzy rules decision tree
Click on the above thumbnail image to get the full picture.

 

Return to top

Of course, these rules have been learned from the examples provided for training.

Safir-X / SirTrade2000 has no serious limitations for the number of inputs, number of fuzzy sets, length of training files and size of the rule base.

This means that you may build zillions of combinations, but the best fuzzy rule base will be often simpler than this (otherwise there is a risk of overfitting, although overfitting is more difficult with NeuroFuzzy logic than with other techniques like Neural Networks).
Training time could be also without limitation...

The only thing that could be known for sure with this software is the following:

If your inputs describe the problem you want to solve with it, it will find a valid solution.

You may always keep in mind that the NeuroFuzzy logic scheme acts as close as possible a human expert would do when faced with the same problems and the same data.
Our own research showed frequently that a few inputs (around 5) and a good fuzzy set choice (some inputs [driving inputs] need more fuzzy sets than others - 5 being a median value), can yield to very acceptable results with a short training time.
You may do your own research and make your own opinion: This software is also made for that.
There are too numerous problems and indicators to give definite hints.

With the automatic search that optimize the number of fuzzy sets for each variable, you will be able to find quickly if you need 5 fuzzy sets for a given input or 25.
We previously stated that one or more inputs need more fuzzy sets than others (they are considered as the main branches) of the decision tree).
In the rule base example detailed below, the ADX indicator was doing this « driving task ».

This is the reason why we present here below the sample rule base artificially separated by a blank space between the different fuzzy sets (L, M3, M2, M1 and F) of the ADX input.

One may think that some rule could never be fired according to the inputs that you choose:

For example, if input1 is a 20 period RSI and input2 a 20 period stochastic, it’s obvious that the rule where premises are:

IF input1= L and input 2 = F THEN...

will probably never occur because the RSI and stochastic values are very close. (these two oscillators can’t be generally overbought (L) and oversold (F) in the same time.
In this case, the rules will appear "unknown" to the system (lowering the reliability measure discussed below).
Same applies for rules never encountered during training.
A measure of the learned rules has been added to Safir-X / SirTrade2000, and available in TradeStation too:
This is called the « reliability ». Reliability ranges from 0 to 1.
The maximum value means that all the theoretical rules have been learned during training.
Also, several rules may be fired together due to the overlapping of fuzzy sets (see figure 1 and 2), according to the considered values of the associated indicator.
These rules are activated proportionally to the membership value (the y coordinate of the considered fuzzy set shape for a given value of the related input).
It’s beyond the scope of this presentation to explain fuzzy logic, but you may know that there are other mathematical functions performed to interpret the raw values of the inputs (crisp values) into a trading signal.
These operations are known as « fuzzification » and « defuzzyfication ».
They act respectively on inputs, before the fuzzy operators that define how the rules combine themselves, and after this step (to get back the crisp output value).
Once trained, the fuzzy rule base looks like this (partial view):

Return to top

IF

ADX=L

AND

RSI=L

AND

dADX=L

AND

DMIdiff=L

THEN

Signal=L1.44

IF

ADX=L

AND

RSI=L

AND

dADX=L

AND

DMIdiff=M1

THEN

Signal=L0.78

IF

ADX=L

AND

RSI=L

AND

dADX=L

AND

DMIdiff=F

THEN

Signal=L0.43

IF

ADX=L

AND

RSI=L

AND

dADX=M1

AND

DMIdiff=L

THEN

Signal=L1.15

and so on

IF

ADX=M3

AND

RSI=L

AND

dADX=L

AND

DMIdiff=L

THEN

Signal=L1.37

IF

ADX=M3

AND

RSI=L

AND

dADX=L

AND

DMIdiff=M1

THEN

Signal=L0.22

IF

ADX=M3

AND

RSI=L

AND

dADX=L

AND

DMIdiff=F

THEN

Signal=L-0.65

IF

ADX=M3

AND

RSI=L

AND

dADX=M1

AND

DMIdiff=L

THEN

Signal=L1.59

and so on

IF

ADX=M2

AND

RSI=L

AND

dADX=L

AND

DMIdiff=L

THEN

Signal=L0.69

IF

ADX=M2

AND

RSI=L

AND

dADX=L

AND

DMIdiff=M1

THEN

Signal=L2.06

IF

ADX=M2

AND

RSI=L

AND

dADX=L

AND

DMIdiff=F

THEN

Signal=L-0.47

IF

ADX=M2

AND

RSI=L

AND

dADX=M1

AND

DMIdiff=L

THEN

Signal=L0.46

and so on

IF

ADX=M1

AND

RSI=L

AND

dADX=L

AND

DMIdiff=L

THEN

Signal=L0.55

IF

ADX=M1

AND

RSI=L

AND

dADX=L

AND

DMIdiff=M1

THEN

Signal=L-0.48

IF

ADX=M1

AND

RSI=L

AND

dADX=L

AND

DMIdiff=F

THEN

Signal=L0.40

IF

ADX=M1

AND

RSI=L

AND

dADX=M1

AND

DMIdiff=L

THEN

Signal=L2.62

and so on

IF

ADX=F

AND

RSI=L

AND

dADX=L

AND

DMIdiff=L

THEN

Signal=L-0.29

IF

ADX=F

AND

RSI=L

AND

dADX=L

AND

DMIdiff=M1

THEN

Signal=L-1.80

IF

ADX=F

AND

RSI=L

AND

dADX=L

AND

DMIdiff=F

THEN

Signal=L0.10

IF

ADX=F

AND

RSI=L

AND

dADX=M1

AND

DMIdiff=L

THEN

Signal=L-1.24

and so on

 


  • Do not focus on the complexity of what is above:

Safir-X / SirTrade2000 is designed to handle automatically all these features for you.
This is the reason why you will not see all this information that is far beyond our main goal: to build automatically a trading system from inputs sets that you are supposed to know quite well, as it’s the main domain that you need to focus on.

These explanations were only to show how this product works in the background when you use it.
You will just have to watch the result of the trading systems (Performance Summary and Equity Curve) evolving during the training process.
It is enough to use it with confidence, and the main information that is observed on the trading system currently building is all appearing, like if you were in TradeStation.

Once the rule base set up, and the best system saved according to your choice, you may apply the fuzzy trading system within TradeStation using the fuzzy description file (*.FZB files).
The fuzzy description file contains all the information about your fuzzy variables, fuzzy sets, and rule base generated from these fuzzy sets after training.
TradeStation is now able to apply the NeuroFuzzy rules to your indicator set on any data series, generate real-time orders like with any system that you may have devised by your own, but the full process will take less time to SirTrade!

Back to the Assistant for Expert Traders page (neurofuzzy logic financial application)

Back to the SirTrade 2000 page (TradeStation neurofuzzy logic and real-time training)

Return to top


 

Technical

One principle of fuzzy logic consists in dividing the input range of a variable between several subspaces (fuzzy subsets) to which a symbolic name is attached: « black », « dark Grey », « medium Grey », « light Grey », « white »... if we attempt to describe a continuous spectrum going from black to white.

One of the main interests of this theory is that many parameters can be taken into account since no mathematical modeling is required. This applies in the plant control area, but also for forecasting, decision support and risk scoring.