;
This web site and all of its contents Copyright © 2002 Peer Science LLC. All rights reserved

Stock Market Rulebase Demonstration

Shown below are two sets of rules, one using fuzzy variables, the other using the "equivalent" non-fuzzy, or "crisp", rules. These rules advise whether you should consider a covered call strategy in buying a particular stock based on the PEG ratio, the price of the stock, and the ratio of the next month's call option price to the current price of the stock. If you don't know what that means, that's okay. There are thousands of ways to select stocks; this is just one of them.

The crisp rules make binary (0/1) recommendations, while the fuzzy rules make decisions using continuous values between 0 and 1. So, in the example, when a rule premise says "IF peg is <= 1..." and the value of peg is 1.01, the premise will evaluate to false. If the value of peg is only slightly lower, say 0.99, the premise evaluates to true. This behavior does not make intuitive sense, as the decision should not be so sensitive to a small change. Fuzzy systems fill this inadequacy by evaluating rules in a more smooth, continuous way. The idea of peg being under or over 1.0 is divided into fuzzy regions, called fuzzy sets, that have smooth borders. For example, look at the definitions for under1 and over1 in the graph below. To view the other fuzzy sets for this demonstration, click here.

Fuzzy Rules

<rule name="Rule1">
IF call_option_price is over10percent 
       AND stock_price is medium
       And peg is under1
       THEN covered_call is recommended
</rule>
<rule name="Rule1a">
IF call_option_price is over10percent 
       AND stock_price is low
       And peg is under1
       THEN covered_call is recommended
</rule>
<rule name="Rule2">
If stock_price is high
       Then covered_call IS not_recommended
</rule>
<rule name="Rule3">
if stock_price is low
       AND peg is under1
       THEN stock_recommendation = buy
</rule>
<rule name="Rule4">
stock_recommendation is hold;
</rule>
<rule name="Rule5">
if peg is over1 
       then covered_call is not_recommended
</rule>
<rule name="Rule6">
If call_option_price is under10percent
       then covered_call is not_recommended
</rule>

Non-Fuzzy (Crisp) Rules

<rule name="Rule1">
IF call_option_price > 0.1 
       AND stock_price > 20
       and stock_price <= 80
       And peg <= 1
       THEN covered_call is "recommended"
</rule>
<rule name="Rule1a">
IF call_option_price > 0.1 
       AND stock_price is <=20
       And peg is <= 1
       THEN covered_call is "recommended"
</rule>
<rule name="Rule2">
If stock_price > 80
       Then covered_call IS "not_recommended"
</rule>
<rule name="Rule3">
if stock_price <= 20 AND peg <= 1
       THEN stock_recommendation = buy
</rule>
<!-- Rule4: stock_recommendation is hold
 Rule4 conflicts with Rule3.
 Replace it with the next 3 rules to avoid conflicts
-->
<rule name="Rule4a">
if stock_price > 20
        and stock_price <= 80
        and peg is <= 1 
        then stock_recommendation is "hold"
</rule>
<rule name="Rule4b">
if stock_price is > 80 and peg <= 1
        then stock_recommendation is "hold"
</rule>
<rule name="Rule4c">
if peg > 1
        then stock_recommendation is "hold"
</rule>
<rule name="Rule5">
if peg > 1
       then covered_call is "not_recommended"
</rule>
<rule name="Rule6">
If call_option_price <= 0.1
       then covered_call is "not_recommended"
</rule>
        
Enter values below and select a set of rules to run.
Call Option Price / Stock Price:
Stock Price:
PEG: