10
Received: November 30, 2017 49 International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06 Short-Term Stock Market Fuzzy Trading System with Fuzzy Capital Management Ahmed Tealab 1* Hesham Hefny 1 Amr Badr 1 1 Computer Science Department, Institute of Statistical Studies and Research, Cairo University, Giza, Egypt * Corresponding author’s Email: [email protected] Abstract: Forecasting financial market indices became a necessary operation for investors’ decisions in order to get the maximum return of investments. The complex behavior of the stock market requires development of forecasting systems. This work proposes a short-term stock fuzzy decision system using a novel trading strategy based on mixture of technical indicators. Fuzzy logic is applied for both trading rules definition and portfolio management. The selected stock market technical indicators for designing trading rules consist of commonly used indicators and new developed one. That is based on daily candlestick information produces short and long entry signals. The proposed system is tested using the Athens Stock Exchange data. The results are compared to classical non-fuzzy systems in addition to latest fuzzy approaches. The proposals performance produced less losses and better profits. The results demonstrate that the fuzzy logic is promising in portfolio management with steady upward profit and low losses. However, that deserves more study. Keywords: Prediction, Fuzzy logic, Stock market, Short-term time series. 1. Introduction Stock market has tight relation with countries economic. Finding the best time to buy or sell indices is the main challenge for experts and that requires prediction of market moves. Stock market indices behavior in general is quite noisy, nonlinear, and chaotic by nature [1]. It is not in random moves and can be classified as nonlinear time series with strong relation to previous data [2]. Different factors such as inflation reports, short term interest rate, political events, traders’ expectations, and environmental factors are interpreted in stock prices moves causing market fluctuations which will make forecasting stock prices a difficult task. However, the evolution of technology and computer systems have affected the field of stock market forecasting in a way leads to develop financial forecasting and decision systems [3]. The use of intelligent systems such as neural networks [4], fuzzy logic [5] and genetic algorithms [6] in financial forecasting has several applications. Many technical indicators are being used in stock market prediction producing different results, their types include: Trend, Volume, Oscillators and Volatility indicators. Technical analysts and trading experts use one or more technical indicator in their market analysis and trading strategies. This paper is organized as follows: Section 2 gives a background about related work. Technical analysis, soft computing and decision support systems are explained in Section 3. Section 4 describes Stock market prediction and money management model. Section 5 presents the experimental results. Finally, Section 6 concludes our work with a scope for future work. 2. Background 2.1 Technical indicators and technical analysis Stock investor has to risk purchasing investments to get higher returns. Technical analysis is exploited as stock prices trends forecasting technique by studying historical indices’ data. Thus, according to Efficient Market Hypothesis (EMH)

Short-Term Stock Market Fuzzy Trading System with Fuzzy

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 49

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

Short-Term Stock Market Fuzzy Trading System with Fuzzy Capital

Management

Ahmed Tealab1* Hesham Hefny1 Amr Badr1

1Computer Science Department, Institute of Statistical Studies and Research, Cairo University, Giza, Egypt

* Corresponding author’s Email: [email protected]

Abstract: Forecasting financial market indices became a necessary operation for investors’ decisions in order to get

the maximum return of investments. The complex behavior of the stock market requires development of forecasting

systems. This work proposes a short-term stock fuzzy decision system using a novel trading strategy based on

mixture of technical indicators. Fuzzy logic is applied for both trading rules definition and portfolio management.

The selected stock market technical indicators for designing trading rules consist of commonly used indicators and

new developed one. That is based on daily candlestick information produces short and long entry signals. The

proposed system is tested using the Athens Stock Exchange data. The results are compared to classical non-fuzzy

systems in addition to latest fuzzy approaches. The proposals performance produced less losses and better profits.

The results demonstrate that the fuzzy logic is promising in portfolio management with steady upward profit and low

losses. However, that deserves more study.

Keywords: Prediction, Fuzzy logic, Stock market, Short-term time series.

1. Introduction

Stock market has tight relation with countries

economic. Finding the best time to buy or sell

indices is the main challenge for experts and that

requires prediction of market moves. Stock market

indices behavior in general is quite noisy, nonlinear,

and chaotic by nature [1]. It is not in random moves

and can be classified as nonlinear time series with

strong relation to previous data [2]. Different factors

such as inflation reports, short term interest rate,

political events, traders’ expectations, and

environmental factors are interpreted in stock prices

moves causing market fluctuations which will make

forecasting stock prices a difficult task. However,

the evolution of technology and computer systems

have affected the field of stock market forecasting in

a way leads to develop financial forecasting and

decision systems [3]. The use of intelligent systems

such as neural networks [4], fuzzy logic [5] and

genetic algorithms [6] in financial forecasting has

several applications. Many technical indicators are

being used in stock market prediction producing

different results, their types include: Trend, Volume,

Oscillators and Volatility indicators. Technical

analysts and trading experts use one or more

technical indicator in their market analysis and

trading strategies.

This paper is organized as follows: Section 2

gives a background about related work. Technical

analysis, soft computing and decision support

systems are explained in Section 3. Section 4

describes Stock market prediction and money

management model. Section 5 presents the

experimental results. Finally, Section 6 concludes

our work with a scope for future work.

2. Background

2.1 Technical indicators and technical analysis

Stock investor has to risk purchasing

investments to get higher returns. Technical analysis

is exploited as stock prices trends forecasting

technique by studying historical indices’ data. Thus,

according to Efficient Market Hypothesis (EMH)

Page 2: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 50

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

studying specific technical indicators is enough to

forecast prices moves and trends. Experts use

combination of technical analysis techniques to

forecast market moves by studying market history.

They usually make subjective assessments to the

data before developing their trading strategy; it is a

difficult task and may have contradictory results [7].

Fuzzy models can address these issues.

Most of studies use common technical indicators

derived from Moving Average (MA) such as

Relative Strength Index (RSI) and Stochastic

Oscillator (SO). Successful stock market forecasting

strategies will be adapted by market and won’t be

successful any more. However, using the previous

studied trading rules may give different profitable

results for future periods and continues success is

not guaranteed [8]. Studies found that technical

trading strategies based MA rules won’t yield profit

with time [9].

Distinguishable characteristics of the indicators

determine their profitability according to the market

conditions. Furthermore, most of the common

indicators are calculated for the previous sessions

close price only, while there are other session data

can be considered such as open, high and low price

values. Therefore, it is obvious that there is a need

for new technical indicators choices that are

calculated based on full session data for better

trading decisions based information. Since each

technical indicator is developed for specific purpose,

so combining different indicators may negate each

other resulting in non-desired performance [10].

2.2 Decision support systems

Decision support systems (DSS) have promoted

firstly from simple model-oriented systems to

advanced multi-function entities [11]. There is a

need to find the suitable DSS framework for each

industry [12]. Thus, the financial industry has less

work to be done, in particular, in the stock market

filed. DSS were not advanced enough to fulfill

financial decision takers needs [13]. However, some

studies proposed intelligent decision systems based

on studying the historical and current market data

[14]. Before the exploration of soft computing, most

of studies were focusing on time series analysis such

as ARIMA, ARCH, and GARCH [15]. However,

developing various computational intelligence forms

such as neural network, fuzzy logic and genetic

algorithm to predict stock market prices is needed.

2.3 Soft computing

Soft computing (SC) is the use of inexact and

Figure 1. Fuzzy decision system

uncertain solutions for computationally hard tasks

where there is no known algorithm to achieve

tractability for low cost. Fuzzy logic, artificial

neural network, particle swarm optimization and

genetic algorithms amongst others are the principal

constituents of Soft Computing. Fuzzy logic is

defined by Zadeh [16] as a set of mathematical

principles based on degrees of membership rather

than classical binary logic that is used for

knowledge representation Hybrid neuro-fuzzy

model for stock market prediction [17], recursive

possibilistic fuzzy modeling [18] in addition to the

impact of sentiments from tweets as well as RSS

news feeds using neural network [19] are successful

applications in the real world. These studies resulted

in significant improve in stock market prediction but

without smart fuzzy management methodology.

Thus, it is apparent that a need of an intelligent

system that can precisely and reliably perform

prediction with portfolio management is important

[20].

3. Proposed systems

The proposed system is identified through this

section to explain its intelligent components. Three

decision systems are considered, the first one has

classical strategy. The other two are fuzzy systems,

one of them has only fuzzy rules and the other has

fuzzy rules and fuzzy capital management. Each

system has one or more trading strategy. The trading

strategy used in the proposed systems based on three

indicators, two of them are known technical

indicators and novel developed one.

The process of the fuzzy systems starts by

fuzzifying the received input values them execute

set of predefined IF–THEN-type rules when meet

the reasoning conditions. The system major phases

are (Fig. 1):

A) System architecture and operations definitions:

In this phase the whole system architecture and

fuzzy system communication with the other

system components are defined.

Page 3: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 51

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

B) Fuzzification: The process of transforming

input values into fuzzy sets with assigned

names and membership functions.

C) STFIS rule Base: It is a set of different STFIS

rules, each has an “if - then” structure. “If” part

specifies values of technical indicators and the

“then” part specifies a rating given these values.

D) Defuzzification: In this phase the fuzzy output

signal is transformed into a single number from

predefined range of values and it represents the

final system decision.

3.1 Technical indicators

The technical analysis concerns with the price

movements in the market. Technical analysts

attempt to use tools such as technical indicators,

oscillators and charts to recognize patterns which

can estimate future movement. In this study, a set of

three technical indicators are used, the first one is

the Stochastic Oscillator (SO). SO is momentum

indicator; its value oscillates between 0 and 100

which represents the price of a security relative to

the high/low range over a specific period of time. Its

lines divergences and centerline crossovers can be

used as indicator for overbought or oversold statuses.

The calculations that draw stochastic oscillator lines

are as following:

K =(𝐶𝑡 − 𝐿𝑛)

(𝐻𝑛 − 𝐿𝑛)× 100 (1)

D𝑓𝑎𝑠𝑡 = 𝑆𝑀𝐴(3, K) (2)

D𝑠𝑙𝑜𝑤 = 𝑆𝑀𝐴(3, D) (3)

where 𝐶𝑡 is current price, 𝐿𝑛 and 𝐻𝑛 are the lowest

and the highest close prices in last 𝑛 sessions

respectively. 𝑆𝑀𝐴(𝑛, x) is the simple moving

average of variable x for 𝑛 sessions.

The recommended number of sessions by

experts is 𝑛 = 14 which is the value used in this

research. SO values above 80 reflect overbought

conditions; on the opposite side; values under 20 are

interpreted as indication of oversold conditions. The

central line with value 50 represents neutral market

momentum. In terms of market analysis and trading

signals, SO that moves under 20 up to above 20

level is considered as bullish signal, while SO

moves below 80 level coming from above 80 is

viewed as bearish signal.

The second used indicator in this study is ADX

(Average Directional Movement Index). It measures

the strength of a trend of a financial time series. Its

value based on DI+ and DI− which are the positive

and negative directional indicators respectively. The

indicator value is calculated from the following

formulas:

𝐴𝐷𝑋 =𝐷𝐼+−𝐷𝐼−

𝐷𝐼++𝐷𝐼− (4)

𝐷𝐼+ =Smoothed 𝐷𝑀+

𝑇𝑅 (5)

𝐷𝐼− =Smoothed 𝐷𝑀−

𝑇𝑅 (6)

𝐷𝑀+ = Ht – Ht-1 or 0 if result < 0 (7)

𝐷𝑀− = - (Lt – Lt-1) or 0 if result < 0 (8)

where 𝐷𝑀+ is Plus Directional Movement and 𝐷𝑀−

is the Minus Directional Movement, they determine

the strength of bullish and bearish moves

respectively, TR is the True Range, Ht, Lt current

high and low where Ht-1, Lt-1 are previous high and

low respectively. TR is largest absolute value of

difference between highest and lowest value in n

periods. The recommended number of sessions by

experts is 14 which is the value used in this research.

The ADX generates a signal that quantifies the

strength of an underway trend. Its value ranges

between 0 and 100; ADX values less than 20 refer to

trend weakness while values above 40 indicate trend

strength as a common interpretation that is accepted

among technical analysts.

The third indicator is the MyPivots (MP). MP is

the new proposed indicator to determine market

entry signals. MP is a customization of the

Camarilla Pivot Points (CPP) indicator which

commonly used by daily traders. The CPP lines are

expected to determine intraday support and

resistance levels; suggesting market entry and exit

signals. The previous trading day High, Low and

Close values are the input data for Camarilla

equations to compose the new intraday levels. This

method relies on the principle that the market price,

which is a type of time series, tending to revert back

to its mean value. Additionally, it is a type of trend

following indicator too. It is useful with high

sensitivity of MA based indicators which sometimes

results in some false market entries. However, CPP

is more precise for high volume and volatile stocks.

Simply, these data are used as input parameters for

the CPP equations to generate the new intraday

support and resistance levels as follows:

𝑅6 = (𝐻𝑑−1/𝐿𝑑−1) × 𝐶𝑑−1 𝑅5 = 𝑅4 + (𝑅4 − 𝑅3) × 1.168 𝑅4 = 𝐶𝑑−1 + (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/2 𝑅3 = 𝐶𝑑−1 + (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/4 𝑅2 = 𝐶𝑑−1 + (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/6

(9)

Page 4: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 52

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

where R and S refers to resistance and support levels

respectively; 𝐶𝑑−1, 𝐻𝑑−1 and 𝐿𝑑−1 are Close, High,

Low prices of the previous day respectively, while

PP is the mean value and called Pivot Point line.

The Camarilla based trading strategy is to issue

short position if the market reached up the area

between R3 and R4 aiming the market to reverse

down to PP. On the opposite side is to issue long

position if the market price reached down the area

between S3 and S4, expecting the market to revert

up to PP. Another trading way with Camarilla is to

follow the trend. It is concerned with the price

breakout up of R4 or down from S4 generating

bullish or bearish trend respectively. That will

suggest issuing long position for bullish market and

short position for bearish market trend.

The MP signal is based on two conditions come

from the change in the market strength and

determined by 𝐶𝑃𝑃 values as follows:

𝑀𝑃 =

{

𝐿𝑜𝑛𝑔 𝑖𝑓 𝑆3 ≥ 𝑂𝑡 > 𝑆4

𝑎𝑛𝑑 𝑃𝑃 ≤ (𝐻𝑑−2 + 𝐿𝑑−2)/2,

𝑆ℎ𝑜𝑟𝑡 𝑖𝑓 𝑅4 > 𝑂𝑡 ≥ 𝑅3

𝑎𝑛𝑑 𝑃𝑃 ≥ (𝐻𝑑−2 + 𝐿𝑑−2)/2,𝑁𝑜 𝐸𝑛𝑡𝑟𝑦 𝑖𝑓 𝑜𝑡ℎ𝑒𝑟

(10)

where 𝑂𝑡 is the open value in at time t. In case of

LONG and SHORT signals, their strength will be

estimated using the following formula:

strength =

𝑄 −3 × (𝑂𝑡 − 𝑂𝑡−1)

max_𝑑𝑖𝑓𝑓_𝑂𝑝𝑒𝑛 −

10 × 𝑃𝑃

max_𝑑𝑖𝑓𝑓_𝑃𝑃

−3 × (𝑅𝑎𝑛𝑔𝑒𝑡−1 − 𝑅𝑎𝑛𝑔𝑒𝑡−2)

max_𝑑𝑖𝑓𝑓_𝑅𝑎𝑛𝑔𝑒

(11)

where and max _𝑑𝑖𝑓𝑓_𝑂𝑝𝑒𝑛 , max _𝑑𝑖𝑓𝑓_𝑅𝑎𝑛𝑔𝑒 ,

max _𝑑𝑖𝑓𝑓_𝑃𝑃 are the difference between the

minimum and maximum values of all 𝑂𝑝𝑒𝑛, 𝑅𝑛𝑎𝑔𝑒

and 𝑃𝑃 values respectively in all sessions from 1 to t.

𝑄 is the strength factor which is determined

according the signal type as follows:

𝑄 = {

75 𝑖𝑓 𝑀𝑃 𝑖𝑠 𝐿𝑜𝑛𝑔 25 𝑖𝑓 𝑀𝑃 𝑖𝑠 𝑆ℎ𝑜𝑟𝑡 50 𝑖𝑓 𝑀𝑃 𝑖𝑠 𝑁𝑜 𝐸𝑛𝑡𝑟𝑦

(12)

The strength of long increases as the value of 𝑄 is

lower than 25 and while the higher the value of 𝑄

more than 75 the stronger the short signal.

3.2 Entry rules

Entering the market for long or short position is

based on the output signal of the decision system.

The output signal generated from the combination of

the trading indicators results in Bullish or Bearish

trend. In bullish market prices are expected to rise,

while in bearish market prices are expected to drop.

Therefore, the suggested positions type is

determined based on the type of the output signal;

long position for bullish market and short position

for bearish trend.

In this paper, the results of the decision system

modelling with fuzzy set rules and the classical

(crisp) methods are examined. The fuzzification of

the technical indicators gives the information to

generate trading rules. The crisp system based on

technical analysis only. Additionally, the

performance of the proposed systems are compared

to results obtained by the short-term fuzzy trading

system (STFS) proposed by K. Chourmouziadi [15].

3.2.1. Classical system trading rules

The classical system trading strategy is based on

set of technical indicators which have a range of

frequencies to compose the trading rules. The inputs

are positive integer values of the technical indicators

and the outputs are numeric values (-1: Bearish, 1:

Bullish or 0: No Entry). Specific combination of the

three antecedents indicators inputs mar represents

certain market trend signal. The classical system

output is signal for entering or existing market

signal without strength qualification. Bullish and

Bearish rules are shown in Table 1.

3.2.2. Fuzzy trading rules

The output signals of the decision systems are in

the form of linguistic terms such as Bullish or

Bearish in absence of any type of preciseness.

The imprecise output results in uncertainty of

traders’ decision which can be tolerated by using

fuzzy logic. The experts believe that the market

behavior is interpreted in the trader’s decision

system. However, that may keep producing signals

𝑅1 = 𝐶𝑑−1 + (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/12 𝑃𝑃 = (𝐻𝑑−1 + 𝐿𝑑−1 + 𝐶𝑑−1)/3 𝑆1 = 𝐶𝑑−1 − (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/12 𝑆2 = 𝐶𝑑−1 − (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/6 𝑆3 = 𝐶𝑑−1 − (𝐻𝑑−1 − 𝐿𝑑−1) × 1.1/4 𝑆5 = 𝑆4 − (𝑆3 − 𝑆4) × 1.168 𝑆6 = 𝐶𝑑−1 − (𝑅6 − 𝐶𝑑−1)

Page 5: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 53

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

Table 1. Crisp system rules if 30 <OS<85 & 25 <ADX<55 & S4≤Ot< S3 then 1

elseif 25 <OS<85 & 55 <ADX<100 & S4≤Ot< S3 then 1

elseif 0 <OS<25 & 25 <ADX<55 & S4≤Ot< S3 then 1

elseif 0 <OS<25 & 0 <ADX<25 & S4≤Ot< S3 then 1

elseif 0 <OS<25 & 55 <ADX<100 & S4≤Ot< S3 then 1

elseif 0 <OS<25 & 25 <ADX< 55 & S4≤Ot< S3 then 1

elseif 85<OS<100 & 25<ADX<55 & R3<Ot≤ R4 then -1

elseif 85<OS<100 & 0 <ADX<55 & R3<Ot≤ R4 then -1

elseif 85<OS<100 & 55 <ADX<100 & R3<Ot≤ R4 then -1

elseif 35 <OS< 85 & 25<ADX<55 & R3<Ot≤ R4 then -1

elseif 35 <OS< 85 & 55<ADX<100 & R3<Ot≤ R4 then -1

elseif 85<OS<100 & 25<ADX<55 & R3<Ot≤ R4 then -1

else 0

(a) (b)

(c) (d)

Figure. 2 Fuzzification: (a) MyPivots indicator, (b) SO indicator, (c) ADX indicator, and (d) output signal

based on imprecise inputs. ADX and SO indicators

values between 0 and 100. In MP lines, by

considering R6 is the top value and it is equal to 100

on the 0-100 scale. Thus, the other MP lines on the

0-100 can be found using the following formula:

nLine = 100 × Line/R6 (13)

where nLine is the new MP line’s value on the 0-

100 scale and Line is the real MP value.

Fig. 2 shows the fuzzification of the technical

indicators and output conditions of the proposed

system. The different input values of MP are

classified to three fuzzy sets: LONG (LN) for long

position, SHORT (SH) for short position and WAIT

(WT) for no position or no entry signals. The WAIT

value represents a neutral case for market status

between LONG and SHORT or extreme indicator

values within its range. However, the traders believe

that the market will reverse its position from these

extreme locations (Fig. 2 (a)). The assigned fuzzy

sets to each indicator are different from indicator to

another one; it depends on the indicator output

signal. The SO values vary between 0 and100 has

assigned LOW (LO), MEDIUM (ME) and HIGH

(HI) fuzzy sets for its outputs (Fig. 2 (b)). Similarly,

the ADX indicators low, medium and high output

values are assigned NOTREND (NO), ONTREND (ON) and RISKY (RIS) fuzzy sets respectively. The

high ADX values considered RISKY cause it is

almost come to the end of the trend (Fig. 2 (c)).

Page 6: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 54

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

Table 2. Fuzzy trading rules

OS ADX MP Bullish Bearish

HI ON LN WK WK

HI NO LN WK WK

HI RIS LN WK WK

ME ON LN VS WK

ME NO LN WK WK

ME RIS LN ST WK

LO ON LN VS WK

LO NO LN ST WK

LO RIS LN ST WK

HI ON SR WK VS

HI NO SR WK ST

HI RIS SR WK ST

ME ON SR WK VS

ME NO SR WK WK

ME RIS SR WK ST

LO ON SR WK WK

LO NO SR WK WK

LO RIS SR WK WK

HI ON WT WK ST

HI NO WT WK WK

HI RIS WT WK WK

ME ON WT WK WK

ME NO WT WK WK

ME RIS WT WK WK

L ON W ST WK

L NO W WK WK

L RIS W WK WK

WEAK (WK), STRONG (ST) and VERYSTRONG

(VS) are fuzzy sets with clear meanings; describe

the bullish and bearish outputs (Fig. 2 (d)). For the

generality and simplicity reasons, triangular

membership functions represented all the fuzzy sets.

Table 2 contains defined set of possible

indicators combinations that follow the behavior of

the trading experts in formulating their trading rules.

Consequently, the fuzzy sets of output signals

(bullish and bearish) strength are (WEAK,

STRONG and VERYSTRONG). That is interpreted

in the system entry action to the market with

different recommendation based on the strength

level. The system output signals’ strengths are

STRONG (ST), VERYSTRONG (VS) and WEAK

(WK) for both the Bullish and Bearish signals. The

used fuzzy system is Mamdani [17] with

maximum/minimum based operators. The centroid

method is used in the defuzzification phase.

3.3 Exit conditions

The unpredictability of the after trades market

moves might raise greed or fear emotional states.

Thus, a method that defines market exit conditions

and avoiding instant monitoring to market is

required for any trading system. The setup of stop

threshold conditions (stop-loss and stop-profit) is a

protective step for the established positions to limit

their maximum losses and revenues. Managing both

losses and profits will ensure prudential revenue

from unexpected extreme market moves or turns.

This step will be used to calculate the amount of

money to invest.

The volatility of the market at time of issuing a

position will determine the (stop-loss and stop-

profit) thresholds. However, the ATR (Average True

Range) is used as volatility estimator. ATR is found

for 𝑞 session which is equal to 14 as used with SO

and ADX indicators. The ATR is defined as follows:

𝑇𝑅 = 𝑀𝑎𝑥(𝑀𝑡 − 𝑚𝑡 , 𝑀𝑡 − 𝑐𝑡−1 , 𝑚𝑡

− 𝑐𝑡−1) (14)

where 𝑀𝑡 ,𝑚𝑡 represent the highest, lowest price

values in a session 𝑡 respectilvey, while 𝑐𝑡−1 is close

value of the previous session. In the proposed

system the exit conditions are calculated and

assigned at the position open time. For bullish

market case, the stop-loss is the position open price

minus twice the ATR value. To have balanced and

conservative strategy with Risk/Reward ration 1/1,

the stop-profit will also be the position open price

plus twice the ATR value and vice versa for bearish

market.

4. Money management

In the proposed system the output of the fuzzy

trading rules is the input of the fuzzy capital

management system. The fuzzy trading system is

responsible to decide the amount of money to invest

with a simple risk management strategy. Vince [21]

proposed the optimal-F that provides a method to

calculate the required amount of the investor’s

portfolio to achieve a geometric profits growth. Its

way to evaluate exactly the money to be used in

each trade is a capital percentage that is directly

proportional to the previous winning trades. A

customization has been done to the optimal-F that its

input is replaced by the fuzzy output generated by

the proposed intelligent system.

One approach here is the “fixed fractional

trading” strategy, where an investor wants to risk a

fixed percentage of his current capital for all trades

and investments. The past investments yields affect

the following capital available for investment. To

maximize the Terminal Wealth Relative (TWR) for

a specific trading period we have to calculate the

optimal-F to find required the fraction (f) for that.

Each trading operation 𝑖 has a return factor

𝐻𝑃𝑅𝑖(𝑓) which is a function of the operation result

𝑟𝑒𝑡𝑢𝑟𝑛𝑖 and worst trade ( 𝑑𝑟𝑎𝑤𝑑𝑜𝑤𝑛 ) in the

Page 7: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 55

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

specified trading period. The following equations

calculate the TWR:

𝑇𝑊𝑅(𝑓) = ∏𝐻𝑃𝑅𝑖(𝑓)

2

𝑖=1

(15)

𝐻𝑃𝑅𝑖(𝑓) = 1 +𝑓. (𝑟𝑒𝑡𝑢𝑟𝑛𝑖)

𝑑𝑟𝑎𝑤𝑑𝑜𝑤𝑛 (16)

Therefore, the relative relation between the possible

risk and the expected reward (Risk/Reward) for each

trade means that targeting high profitable trades will

require high optimal value of 𝑓 which is practically

rare. A practical value of 𝑓 can be considered as

percentage of optimal-F. In the proposed system,

partial-F is introduced as 12% of the found optimal-

F as the possible applied 𝑓.

Fig. 3 demonstrates the Risk/Reward relation

curve or the expected gain against the risk assumed.

In the Gaussian curve it is clear that the highest

point of the curve which represents the maximum

expected profit (reward) is at the optimal-F.

Therewith, it is possible to observe that with less

risk, less profit is expected. Partial–F is located on

the left side of the curve at 12% of the optimal-F. The fuzzy trading system determines the range

amount of capital available for investment; it will be

estimated as:

𝑐𝑢𝑠𝑡𝑜𝑚𝑓= 𝑝𝑎𝑟𝑡𝑖𝑎𝑙𝑓

+(𝑠𝑖𝑔𝑛𝑎𝑙 − min _𝑠𝑖𝑔𝑛𝑎𝑙)(𝑜𝑝𝑡𝑖𝑚𝑎𝑙𝑓 − 𝑝𝑎𝑟𝑡𝑖𝑎𝑙𝑓)

𝑠𝑔𝑖𝑛𝑎𝑙𝑟 × 𝑜𝑝𝑡𝑖𝑚𝑎𝑙𝑓

(17)

where signal is the system output (Bullish or

Bearish); min _sginal is the minimum signal value

to trigger a trade (its value is 15); optimalf and

partialf are optimal-F and partial-F respectively;

Figure 3. optimal-F, obtained-F and partial-F

demonstration

sginalr is difference between minimum and

maximum of signals values. After obtaining the

optimal-F, the next step is to calculate the required

number of shares using the following formula:

#𝑠ℎ𝑎𝑟𝑒𝑠 = 𝑝𝑎𝑟𝑡𝑖𝑎𝑙𝑓 +𝑒𝑞𝑢𝑖𝑡𝑦

𝑠𝑡𝑜𝑝𝑙𝑜𝑠𝑠 (18)

where 𝑒𝑞𝑢𝑖𝑡𝑦 is the amount of money available for

investment and 𝑠𝑡𝑜𝑝𝑙𝑜𝑠𝑠 is the market exit

condition value. The above formula (18) output is

estimation to the number of shares required for

purchase without consideration of the share price. In

case that the available money for investment isn’t

enough to cover the required number of shares, the

maximum available number is used. But in the

classical system it uses trading rules with all

available capital for investment in all assigned

positions.

5. Experimental setup

In this research the Metatrader Trader software

(MT4) is used to implement the three trading

systems and to compare their performance for the

same database. To test these systems well, the

criteria of selecting the validation market indices

should include diversity of trends through the

validation period.

The results obtained by K. Chourmouziadis [14]

fuzzy system are used as our benchmark; they

showed better performance than the B&H strategy.

Chourmouziadis [14] proposed a short-term fuzzy

trading system (STFS) with technical based trading

strategy and portfolio management; its fuzzy trading

strategy uses set of appropriate technical indicators.

Wherefore, general index of the Greek (Athens)

stock market (ASE) is the validation data used by

STFS [14]. Therefore, the proposed system in this

research will be tested with the same dataset too

without consideration of the transaction cost.

Chourmouziadis [14] examined his system

separately for bull and bear market periods between

15 November 1996 and 5 June 2012 covering

different world and local economic events and

changes. The ASE demonstrated different behavior

through this period; it shows relatively long periods

of bearish market before turning to a bullish trend

then back to bearish again. It will be good test for

the systems profitability in different situations.

The three decision systems (Fuzzy RC, Fuzzy R,

and Classical) are distinguishable in their using to

the fuzzy logic. Fuzzy RC: is the first system; it is a

fuzzy decision system where fuzzy logic is applied

Page 8: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 56

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

Table 3. Systems performance: Bull markets

Bull Markets, ASE STFS Profit Classic Profit Fuzzy R Profit Fuzzy RC Profit

From To EUR % EUR % EUR % EUR %

15-11-1996 17-09-1999 63630 536.3 58167 481.67 60324 503.24 77863 678.63

01-04-2003 09-03-2009 27364 173.6 23816 138.16 25482 154.82 30144 201.44

09-03-2009 14-10-2009 15027 50.2 12812 28.12 15631 56.31 16903 69.03

Table 4. Systems performance: Bear markets

Bear Markets, ASE STFS Profit Classic Profit Fuzzy R Profit Fuzzy RC Profit

From To EUR % EUR % EUR % EUR %

20-09-1999 31-03-2003 9595 -4.05 6686 -33.14 9047 -9.53 9802 -1.98

01-11-2007 09-03-2009 7383 -26.17 7836 -21.64 6995 -30.05 7850 -21.50

15-10-2009 05-06-2012 4833 -51.67 3456 -65.44 3888 -61.12 5079 -49.21

Table 5. Proposed systems profits and drawdown

Market Periods Classic Fuzzy R Fuzzy RC

FROM TO Profit % DD % Profit % DD % Profit % DD %

15-11-1996 17-09-1999 481.67 -29.08 503.24 -25.30 678.63 -27.10

20-09-1999 20-09-1999 -33.14 -37.25 -9.53 -38.01 -1.98 -30.92

01-04-2003 01-04-2003 138.16 -24.71 154.82 -20.41 201.44 -14.06

01-11-2007 09-03-2009 -21.64 -29.52 -30.05 -26.81 -21.50 -18.32

09-03-2009 09-03-2009 28.12 -22.17 56.31 -18.24 69.03 -11.51

15-10-2009 05-06-2012 -65.44 -23.36 -61.12 -19.75 -49.21 -10.67

on the information part for both the rules and

indicators and on the estimation of the capital to

invest using Eqs. (17) and (18). Fuzzy R: is the

second system; it is also a fuzzy intelligent decision

system but fuzzy logic is used only for the

information part including the rules and technical

indicators. Although, the estimation of the capital to invest

is done using the Partial-F with value equal to 12%

of optimal-F. The third system is a classical trading

system in absence of fuzzy logic in any of its parts.

A drawdown (DD) during a specific recorded period

is a measure in percent of the decline happens in an

investment from peak-to-trough for that period.

Trading systems are run over the validation period

for the selected index (ASE), slippage adjusted and

profits are calculated on the basis of a notional

€10,000 (EUR) of the trading capital. Furthermore,

the largest drawdown is calculated. Drawdown and

trading profit for each trading period are presented

in Table 5. The Fuzzy RC showed better

performance than the Fuzzy R and Classical systems.

The total net profit achieved by the Fuzzy RC

system in bull markets and the losses in bear

markets are the best in comparison to the other

systems (Tables 3 and 4). The profit factor, the

average profit over average loss ratio, performed by

Fuzzy RC system is greater than 1, which resulted in

a profitable trading system for the whole validation

period. Figure (6) shows the performance impact of

the three trading systems and SFTS [14] on the

investment portfolio.

The final results indicate that the Fuzzy RC

produced the best performance with total net profit

€145045.26 (1450.5%). Fuzzy R ended the

validation period with total net profit €59119.25

(491.2%) which is better than classical results with

final profit €22136.3 (221.3%). The STFS [14]

performance is better than the Fuzzy R and classical

systems but less than the Fuzzy RC system and that

might be of the STFS [14] fuzzy capital

management. Therewith, the Fuzzy RC showed

better results in all trading periods than the STFS

[14] including bear and bull markets. Therefore the

importance of a trading system with those properties

resulted in high trading operation (Figs. 4 and 5).

The proposed systems are examined for the

associated maximum drawdown (DD) which is quite

high for each system. In the classical trading system

fewer trades are triggered which result in less profit

and higher DD. But effect of high DD in the Fuzzy

RC trading systems is compromised and over

challenged with much higher profitable trades. The

cumulative performance for ASE index alleviates

the DD effect when the negative trades are not

occurred in different period of profitable trades

(Table 5). The results proved that the Fuzzy RC

trading system is superior in comparison to the other

two systems. It can be considered a very good

trading system as it obtains higher profits and less

risk. Nevertheless the behavior of the Fuzzy R is

slightly better than the classic technique indicating

that the combination of both the fuzzy indicators and

Page 9: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 57

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

Figure. 4 Systems profit in bull marekts periods

Figure. 5 Systems profit in bear marekts periods

Figure. 6 Systems toal profit % for the whole validation

period

the fuzzy capital management has a significant

impact on the Fuzzy RC system performance.

With its intelligent decision, the Fuzzy RC

trading system behaves well when classical system

loses money avoiding high drawdown when the

market goes down. Fuzzy RC performance is

smooth and steady upward during the whole

validation period. These features are quite desirable.

The system produces steady profitability and

robustness under different market conditions.

More attention should be paid to the use of fuzzy

logic in trading systems not only for the indicators

and rules but also for capital management. These

experiments evidence maybe is not enough.

6. Conclusions

Fuzzy logic, by its nature, is a suitable technique

to deal with uncertainty, impreciseness and

vagueness problems; hence trading systems too. In

this research, a short-term fuzzy decision system

with fuzzy technical indicators and fuzzy trading

rules in addition to fuzzy capital management is

proposed. The system trading strategy is based on a

set of known technical indicator and new developed

one. The role of the trading system is to forecast

market moves and to give advice for issuing

positions with exit conditions. Additionally it gives

recommendations on the amount of portfolio to

invest. Therefore it is an important part of the fuzzy

decision system as most of the proposed fuzzy

decision systems in the literature don’t include fuzzy

capital management. Although, there are some

articles proposed capital management from a fuzzy

perspective [20, 22]. The validation of the trading

systems has been done for general index of the

Greek (Athens) stock market (ASE) over a period of

fifteen years. The proposed system showed

substantial performance with overall robust profit

and low drawdown. The achieved results considered

as evidence to encourage using fuzzy decision

systems with fuzzy capital management. It is a

promising techniques and merits further

investigation. Regarding this, the proposed trading

system requires more testing cases to further explore

the system properties. The future work should

include expansion of the experimental setup to cover

independent assets of different sectors over other

time periods. Furthermore it should belong with

different real portfolios.

One of the advantages of trading tools based on

fuzzy logic is the flexibility of controlling the

decisions by the operator. Wherever, future research

should concentrate on bringing this additional

flexibility. That can be done by fuzzifying other

classic trading strategies using the proposed ideas in

this research. This would give us the chance to

validate more the fitness of the proposed technique

here. Nevertheless; an optimization to the technical

indicators parameters can be done using techniques

such as genetic algorithm.

Finally, the use of fuzzy logic can be extended to

implement better risk control mechanism. That may

help in determining the exit conditions with lower

drawdown.

References

[1] R. Balvers, Y. Wu, and E. Gilliland, “Mean

reversion across national stock markets and

Page 10: Short-Term Stock Market Fuzzy Trading System with Fuzzy

Received: November 30, 2017 58

International Journal of Intelligent Engineering and Systems, Vol.11, No.3, 2018 DOI: 10.22266/ijies2018.0630.06

parametric contrarian investment strategies”,

The Journal of Finance, Vol. 55, No. 2, pp.

745–772, 2000.

[2] A. Rahman and S Sasdi, "Random walk and

breaking trend in financial series: An

econometric critique of unit root tests", Review

of Financial Economics, Vol. 17, No. 3, pp.

204–212, 2008.

[3] W. Chiang, D. Enke, T. Wu, and R. Wang, "An

adaptive stock index trading decision support

system", Expert Systems with Applications, Vol.

59, No. 15, pp. 195-207, 2016.

[4] G. Armano, M. Marchesi, and A. Murru, "A

hybrid genetic-neural architecture for stock

indexes forecasting", Information Sciences, Vol.

170, pp. 3-33, 2005.

[5] P. Chang, C. Fan, and J. Lin, "Trend discovery

in financial time series data using a case based

fuzzy decision tree", Expert Systems with

Applications, Vol. 59, No. 15, pp. 195-207,

2016.

[6] A. Tealab, A. Badr, and M. Fakhr, "Automatic

FOREX Market Trading based on Technical

Analysis", Computing and Information Systems

Journal, Vol. 15, No. 1, 2012.

[7] G. Panda, G. Sahoo, and R. Majhi,

"Development and performance evaluation of

FLANN based model for forecasting of stock

markets", Expert Systems with Applications,

Vol. 36, No. 3, pp. 6800-6808, 2009.

[8] B. Malkiel, "Reflections on the Efficient

Market Hypothesis: 30 Years Later", Financial

Review, Vol. 40, pp. 1–9, 2005.

[9] C. Park and S. Irwin, "The Profitability of

Technical Trading Rules in Us Futures

Markets: A Data Snooping Free Test",

http://dx.doi.org/10.2139/ssrn.722264, 2005.

[10] M. Qiu and Y. Song, "Predicting the Direction

of Stock Market Index Movement Using an

Optimized Artificial Neural Network Model",

PLOS ONE, Vol. 11, No. 5, 2016.

[11] E. Berner, Clinical decision support systems,

2nd ed., Springer, Ed. New York, NY: Springer

Science and Business Media, LLC, 2007.

[12] X. Yong, W. Hongwei, and F. Qi, "Electronic

market models for decision support systems on

the Web", Journal of Systems Engineering and

Electronics, Vol. 15, No. 2, pp. 135-141, 2004.

[13] S. Huang, Y. Hung, and D. Yen, "A study on

decision factors in adopting an online stock

trading system by brokers in Taiwan", Decision

Support Systems, Vol. 40, No. 2, pp. 315–328,

2005.

[14] P. Chatzoglou and K. Chourmouziadis, "An

intelligent short term stock trading fuzzy

system for assisting investors in portfolio

management", Expert Systems with

Applications, Vol. 43, pp. 298-311, 2016.

[15] G. Box, G. Jenkins, G. Reinsel, and G. Ljung,

Time series analysis: Forecasting and control,

3rd ed.: Hoboken, NJ: John Wiley & Sons,

2013.

[16] L. Zadeh, "Fuzzy Sets", Information and

Control, Vol. 8, pp. 338–353, 1965.

[17] B. Nair, M. Minuvarthini, B. Sujithra, and V.

Mohandas, "Stock Market Prediction Using a

Hybrid Neuro-fuzzy System", In: Proc. of

International Conf. On Advances in Recent

Technologies in Communication and

Computing, pp. 243 – 247, 2010.

[18] L. Maciel, F. Gomide, and R. Ballini, "Stock

market volatility prediction using possibilistic

fuzzy modeling", In: Proc. of International

Conf. on Computational Intelligence, LA, 2015.

[19] S. Bharathi and A. Geetha, "Sentiment Analysis

for Effective Stock Market Prediction",

International Journal of Intelligent Engineering

and Systems, Vol. 10, No. 3, pp. 146-154, 2017.

[20] H. Kwaśnicka and M. Ciosmak, "Intelligent

Techniques in Stock Analysis", Intelligent

Information Systems, Vol. 10, pp. 195-208,

2001.

[21] R. Vince, Portfolio management formulas, New

York: Willey & Sons, 1990.

[22] C. Lin, "A fuzzy decision support system for

strategic portfolio management", Decision

Support Systems, Vol. 38, No. 3, pp. 383 - 398,

2004.