|
Many software systems that incorporate automated back
testing offer limited capability for defining and combining decision
rules, and usually have very rigid inference rules. For example,
triggering a buy when some indicator crosses a certain threshold. TekView
Explorer uses a more flexible methodology called fuzzy logic that rates the
degree an indicator is above or below a threshold and combines that rating with
others to draw conclusions.
The
ratings range from 0 to 1.0 and in fuzzy logic jargon is know as the
"membership" in a fuzzy logic function. A family of related membership functions is called a fuzzy
set which characterize the indicator value. An example of a simple two function
set is shown below.
One function describes membership in the "negative" set and the
other in the "positive" set. This example shows how a variable value of .2 results
in the outputs where the confidence (i.e., membership) in the statement “MACD is
Negative” is roughly .26 and confidence in the statement “MACD is Positive” is about
.7. In fuzzy logic the .2 input value is called a "crisp" value and the
memberships "fuzzy" values.
Another departure from traditional set theory in the way
unions (OR's) and intersections (AND's) are calculated. The probabilistic AND used
in traditional theory is the result of multiplication of memberships. So the
results of a long series of AND's approaches zero, even if all independent
probabilities are high. In fuzzy logic the result of an intersection is the
minimum of the joined AND's and so results in selection of the minimum value
in the collection (which may be zero, but is not near zero just because of the number of
conditions combined). Similarly, probabilistic OR membership is the probability
of A plus the probability of B minus the probability of A and B, which
approaches 1, whereas the results of a fuzzy union is the maximum membership of
the union. In practice both probabilistic and fuzzy joins are used.
Fuzzy logic rules take the form of IF x THEN y where the x
condition is known as antecedent and the y as the consequence. An example that
mimics the buy/sell rules of a moving average crossover might be:
IF MACD
Is Positive THEN Signal Is Buy.
The antecedent can also express multiple conditions. For
example:
IF MACD
Is Low AND MACDh Is Positive AND
NOT Stochastic %K Is Low THEN Signal Is Buy
The combining of the memberships of each of the elements in the
antecedent (unions and intersections) results in the confidence in
the consequence.
The last step in the inference process is to “defuzzify” fuzzy values back into
a single crisp value. This is done through another set of fuzzy functions.
The process
is essentially the reverse of fuzzification as it generates a value that is the
weighed result of the membership values. Fuzzy logic practitioners have devised
several methods of defuzzification.
One of the most common, the MaxMean method, returns the mean value of the function with the maximum
membership. In the example shown below it would be the average of the area
shaded green. Another, the Centroid method, returns the center-of-gravity of
both the green and red shaded areas taken together. The Centroid method
produces a smoother response, which is why it is commonly used in control
systems. However, the two methods will usually produce similar results in a
decision support application.
|