Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Utworzenie nowego systemu rozmytego
- fis = mamfis('Name', 'Sygnał do kupna');
- % Dodawanie zmiennych wejściowych
- fis = addInput(fis, [0 100], 'Name', 'FearAndGreed');
- fis = addInput(fis, [0 100], 'Name', 'RSI');
- % Dodawanie zmiennej wyjściowej
- fis = addOutput(fis, [0 100], 'Name', 'BuySignal');
- % Dodawanie funkcji przynależności dla Fear and Greed
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [0 0 15 30], 'Name', 'very_low');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [15 30 45 60], 'Name', 'low');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [45 60 75 90], 'Name', 'medium');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [75 90 105 120], 'Name', 'high');
- fis = addMF(fis, 'FearAndGreed', 'trapmf', [105 120 135 150], 'Name', 'very_high');
- % Dodawanie funkcji przynależności dla RSI
- fis = addMF(fis, 'RSI', 'trapmf', [0 0 10 20], 'Name', 'very_low');
- fis = addMF(fis, 'RSI', 'trapmf', [10 20 30 40], 'Name', 'low');
- fis = addMF(fis, 'RSI', 'trapmf', [30 40 50 60], 'Name', 'medium');
- fis = addMF(fis, 'RSI', 'trapmf', [50 60 70 80], 'Name', 'high');
- fis = addMF(fis, 'RSI', 'trapmf', [70 80 90 100], 'Name', 'very_high');
- % Dodawanie funkcji przynależności dla BuyDecision
- fis = addMF(fis, 'BuySignal', 'trimf', [0 25 50], 'Name', 'very_low');
- fis = addMF(fis, 'BuySignal', 'trimf', [25 50 75], 'Name', 'low');
- fis = addMF(fis, 'BuySignal', 'trimf', [50 75 100], 'Name', 'medium');
- fis = addMF(fis, 'BuySignal', 'trimf', [75 100 125], 'Name', 'high');
- fis = addMF(fis, 'BuySignal', 'trimf', [100 125 150], 'Name', 'very_high');
- %fis = addRule(fis,'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)');
- %
- % Dodawanie reguł
- rules = {
- 'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)'
- 'If FearAndGreed is very_low and RSI is low then BuySignal is high (1)'
- 'If FearAndGreed is very_low and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is very_low and RSI is high then BuySignal is low (1)'
- 'If FearAndGreed is very_low and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is low and RSI is very_low then BuySignal is very_high (1)'
- 'If FearAndGreed is low and RSI is low then BuySignal is high (1)'
- 'If FearAndGreed is low and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is low and RSI is high then BuySignal is low (1)'
- 'If FearAndGreed is low and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is medium and RSI is very_low then BuySignal is high (1)'
- 'If FearAndGreed is medium and RSI is low then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is medium then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is high then BuySignal is medium (1)'
- 'If FearAndGreed is medium and RSI is very_high then BuySignal is low (1)'
- 'If FearAndGreed is high and RSI is very_low then BuySignal is medium (1)'
- 'If FearAndGreed is high and RSI is low then BuySignal is medium (1)'
- 'If FearAndGreed is high and RSI is medium then BuySignal is low (1)'
- 'If FearAndGreed is high and RSI is high then BuySignal is very_low (1)'
- 'If FearAndGreed is high and RSI is very_high then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is very_low then BuySignal is low (1)'
- 'If FearAndGreed is very_high and RSI is low then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is medium then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is high then BuySignal is very_low (1)'
- 'If FearAndGreed is very_high and RSI is very_high then BuySignal is very_low (1)'
- };
- fis = addRule(fis, 'If FearAndGreed is very_low and RSI is very_low then BuySignal is very_high (1)');
- fis = addRule(fis, 'If FearAndGreed is very_low and RSI is low then BuySignal is high (1)');
- fis = addRule(fis, 'If FearAndGreed is very_low and RSI is medium then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is very_low and RSI is high then BuySignal is low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_low and RSI is very_high then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is low and RSI is very_low then BuySignal is very_high (1)');
- fis = addRule(fis, 'If FearAndGreed is low and RSI is low then BuySignal is high (1)');
- fis = addRule(fis, 'If FearAndGreed is low and RSI is medium then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is low and RSI is high then BuySignal is low (1)');
- fis = addRule(fis, 'If FearAndGreed is low and RSI is very_high then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is medium and RSI is very_low then BuySignal is high (1)');
- fis = addRule(fis, 'If FearAndGreed is medium and RSI is low then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is medium and RSI is medium then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is medium and RSI is high then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is medium and RSI is very_high then BuySignal is low (1)');
- fis = addRule(fis, 'If FearAndGreed is high and RSI is very_low then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is high and RSI is low then BuySignal is medium (1)');
- fis = addRule(fis, 'If FearAndGreed is high and RSI is medium then BuySignal is low (1)');
- fis = addRule(fis, 'If FearAndGreed is high and RSI is high then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is high and RSI is very_high then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_high and RSI is very_low then BuySignal is low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_high and RSI is low then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_high and RSI is medium then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_high and RSI is high then BuySignal is very_low (1)');
- fis = addRule(fis, 'If FearAndGreed is very_high and RSI is very_high then BuySignal is very_low (1)');
- % Wyświetlanie konfiguracji systemu
- fis
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement