<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Analyzing stock market data values with soft sets decision making model</article-title>
      </title-group>
      <contrib-group>
        <aff id="aff0">
          <label>0</label>
          <institution>Hubert Lechowicz, Kamil Pierzchała Faculty of Applied Mathematics Silesian University of Technology Gliwice</institution>
          ,
          <country country="PL">Poland</country>
        </aff>
      </contrib-group>
      <fpage>5</fpage>
      <lpage>9</lpage>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>All of the data needs to be prepared for calculations.
Chronological order of entries is required, as it is the most
important rule. In the case when it is not obeyed, methods
used and described below won’t be able to make any sensible
prediction, due to their very nature.</p>
      <p>A theory of decision making processes is mostly based on
artificial intelligence models. Data on the input is divided
into classes among which comparisons are made. Classifiers
and prediction methods are very often done by the use of
neural networks. Where very often probabilistic models are
used as predictors [1], while also hybrid compositions with
other artificial intelligence are used ie. for system positioning
[2]. In recent year very high popularity in data science is
achieved by soft sets. These are models of decision making
systems where rules over data samples are related to the data
structure. One of the first approaches to define a soft set
theory was proposed in [3]. This idea started many interesting
research both on theoretical aspects and practical applications.
In [4] was presented how to use a soft set theory for group
compositions. Article [5] presented a new composition of this
approach to extend the idea of fuzzy sets. Now the theory
of sots sets is composed with probabilistic approaches to
strengthen decision making processes [6]. Among important
applications of soft sets we can present medical processes
evaluation [7].</p>
      <p>In this article we have used a theory of soft sets to compose
a market data classifier. In our approach a data from market
stock is collected to compose a relation table over which we
have used our soft set model to help on sell/buy decisions.
c 2019 for this paper by its authors. Use permitted under Creative
Commons License Attribution 4.0 International (CC BY 4.0)</p>
      <p>It is an open source, python library which provides
welloptimized, data structures for the data analysis in python
programming language. It is used to envelop data in
dataframe structure. The web repository of this library is present at
pandas.pydata.org/pandas-docs/. Implemented solution works
in according to flowcharts presented in figure 1.</p>
    </sec>
    <sec id="sec-2">
      <title>C. Expert knowledge</title>
      <p>Set of rules which derivatives from actual knowledge on the
subject. Usually, it is defined by an expert in the relevant field.
Here it is based on through read of financial statement analysis
books and guides. Rules are used to evaluate the current state
in the current moment. It is not a mathematical algorithm used
for calculations of some sort, but an evaluation of the output
in decision model.</p>
    </sec>
    <sec id="sec-3">
      <title>D. Decision model</title>
      <p>Composed of the expert’s knowledge rules, made into
simple mathematical equations. Deliberately it’s intended to
provide a suitable prediction of the most profitable decision.
Three different elements are joint together, their aggregated
output is the one that is the actual value, on which prediction
is based. These elements, are: Stochastic Oscillator, Moving
Average Convergence / Divergence, and Relative Strength
Index. Mostly refereed to, by shortened names: SO, MACD,
RSI.</p>
      <p>Machine learning and especially the sophisticated issue of
output classification has come up with a confusion matrix,
more often, called error matrix. It is a definite table layout
which allows visualization of an algorithm’s performance.
Each and every matrix row represents the predicted class
instances while each and every column represents the actual
class instances. It’s called like that, due to the matrix making
it easy to see whether the system is confusing two classes
or not. That being said, the simplest description would be a
genuine type of contingency table, that consists of just two
dimensions ("actual" and "predicted"), and very same sets of
"classes" in both dimensions.</p>
    </sec>
    <sec id="sec-4">
      <title>F. Soft sets</title>
      <p>Simplification of fuzzy set, used to when working on data
with uncertainty in a parametric manner. The mathematical
description of it, and simplified model is described in the next
section.</p>
      <sec id="sec-4-1">
        <title>III. MATHEMATICAL DESCRIPTION</title>
        <p>
          Soft sets: Simple definition of soft sets is (F; A) is named
a soft set over U , where F is a described as:
(
          <xref ref-type="bibr" rid="ref1">1</xref>
          )
        </p>
        <p>Figure 2 describes a following scenario. U is the group
of real estates taken under consideration. E is the group of
parameters. Each and every single element of E is a word
or a sentence. E = expensive; beautiful; wooden; cheap; in
the green surroundings;. Therefore, defining a soft set would
be pointing out expensive estates, beautiful estates, and so
on. The soft set (F; E) describes the “attractiveness of the
estates” to the general customer. Shown below, soft sets are
used as presented in Figure 3. They perform the role of
the actual decision model. Aggregating the values of the
MACDboolean, SOboolean, RSIboolean outcomes in the Sum
column. The decision is listed in the Decision column. These
three columns have Boolean in their names, as they take only
three different values 1; 0; 1. or just 1; 1. Theoretically
speaking, these values are not strictly Boolean, but since they
represent positive state, negative state and unknown state, it
was shortened to positive state, negativity of positive state and
unknown state. Which sums up to just two values, just like
Boolean values.</p>
        <p>Relative Strength Index (RSI):</p>
        <p>Technical indicator made to show the ups and downs of a
stock, based on the closing prices of an n window length. It is a
momentum oscillator, describing the magnitude and velocity of
price movements. Momentum as rate of the rise or fall in price.
RSI calculates momentum as the highercloses=lowercloses.
The stronger the positive changes the higher RSI is. The
stronger the negative changes the lower RSI is. The RSI
F : A ! P (U )
That being said, a soft set over U is a family of subsets of the
universe U . For 2 A F( ) may be considered as the set of
c-approximate elements of the soft set (F; A)
provides signals telling brokers to buy while security or
currency is oversold and vice-versa to sell while it is being
overbought.
where:
n = 14 - window length
AverageGain - Sum of gains over the past n periods;
AverageLoss - Sum of loss over the past n periods;
Stochastic Oscillator (SO):
%K = 100</p>
        <sec id="sec-4-1-1">
          <title>CloseP rice(actual)</title>
        </sec>
        <sec id="sec-4-1-2">
          <title>M axP rice(n)0</title>
        </sec>
        <sec id="sec-4-1-3">
          <title>M inP rice(n)0</title>
        </sec>
        <sec id="sec-4-1-4">
          <title>M inP rice(n)0</title>
          <p>%D = 100</p>
        </sec>
        <sec id="sec-4-1-5">
          <title>CloseP rice(actual)</title>
        </sec>
        <sec id="sec-4-1-6">
          <title>M axP rice(m)0</title>
        </sec>
        <sec id="sec-4-1-7">
          <title>M inP rice(m)0</title>
        </sec>
        <sec id="sec-4-1-8">
          <title>M inP rice(m)0</title>
          <p>
            n = 14 - window length
m = 3 - short window length
CloseP rice - Close price from the actual period;
(
            <xref ref-type="bibr" rid="ref3">3</xref>
            )
(
            <xref ref-type="bibr" rid="ref4">4</xref>
            )
          </p>
          <p>M axP rice - Maximum price over the past n periods;
M inP rice - Minimum price over the past n periods;</p>
          <p>SO functions as indicator of momentum that exploits
support and resistance levels. Word stochastic allude to the
current price in comparison to its price range over time
period. SO tries to foretell price turning points by comparison
of security closing price to its price range. Simplifying it
looks for the range between an low and high price during
time period. Afterwards security’s price is expressed as a
percentage ranging from 0 to 100. Meaning lower limits of
the range over the time period covered, and higher limits
over the time period covered. Idea is that prices happen to
have tendency to near the extremes of the recent range before
turning points. What is actually considered an alert or set-up,
is when %D happens to be in an extreme zone and diverging
from the price action. Signal itself is happening when the
faster %K crosses the %D. Extreme zones are below 20 and
above 80.</p>
          <p>Moving Average Convergence / Divergence (MACD):
Trading indicator developed for technical analysis of stock
prices. Gerald Appel created it in the 1970s. It is goal is to
describe changes in the direction, strength, momentum, and
trend duration in a stock’s price. A group of three time series
made from past data, most often the closing price. These three
are: the proper series , the "signal" series ( "average") , and
lastly the "divergence" series (difference between the previous
ones.) The series is calculated as the difference between a
short period exponential moving average, and a longer period
exponential moving average of the price series. The average
series is an exponential moving average of the MACD series
itself. Therefore this indicator stems from three parameters,
which are the time constants of the three exponential moving
averages. Usually their values are measured in days.</p>
          <p>By comparing exponential moving averages of different
periods, the moving average convergence / divergence series
has the ability to indicate changes in the trend of a stock. As
many claim divergence series are a very acute indicator, they
can notice subtle shifts in the stock’s trend.</p>
          <p>Since based on moving averages, it is inherently a lagging
indicator. As a metric of price trends, the moving average
convergence / divergence is less useful for stocks that are not
trending (trading in a range) or are trading with erratic price
action.</p>
          <p>
            EM A =
p0 + (1
1 + (
            <xref ref-type="bibr" rid="ref1">1</xref>
            )p1 + (
            <xref ref-type="bibr" rid="ref1">1</xref>
            ) + (
            <xref ref-type="bibr" rid="ref1">1</xref>
            )2p2
)2
          </p>
          <p>+ (1
+ (1</p>
          <p>
            )N pN
)N
(
            <xref ref-type="bibr" rid="ref5">5</xref>
            )
          </p>
        </sec>
      </sec>
      <sec id="sec-4-2">
        <title>EMA is the exponential moving average</title>
        <p>2
= N+1
p0 – last value
p1 – value day-before p0
pN value from day N
N – number or periods</p>
        <p>
          M ACD = EM A(N = 12)
EM A(N = 26)
(
          <xref ref-type="bibr" rid="ref6">6</xref>
          )
MACD is calculated from the quick and slow EMA difference.
singalline = EM A(N = 9; values = M ACD)
(
          <xref ref-type="bibr" rid="ref7">7</xref>
          )
Signal-line is created from the calculated on MACD values,
with 9 day span.
        </p>
        <p>
          Output = M ACD
signalline
(
          <xref ref-type="bibr" rid="ref8">8</xref>
          )
The actual output is calculated as an difference between
MACD and signal-line
        </p>
        <p>In order to test the model, data is required. NYC stock
exchange market provided McDonalds stock prices from the
2013 to 2017. Model provided with data, after few seconds
returns decision in an output, in order to check whether his
suggestions would make profit, evaluation needs to take place.
By checking the stock closing price from the next day, it is
possible to see if decision made in day N would make profit
(or loss) on day N + 1. Comparison of output received from
the model, and the price from the N + 1 day takes place
in error matrix. With 1075 days total in the data set, model
provided 256 profitable sell predictions and 354 profitable buy
decisions. Therefore, more then 50% of the suggestions made
by model brought profit. In order to understand what happened
, why the rest of the data got labeled incorrectly, some statistics
need to be calculated. Although, it’s better then a coin toss by a
small margin, it has capability to become even more accurate.
Formulas are shown below (see 9,10,11,12).</p>
        <p>recall =
precision =</p>
        <p>T P
F N + T N</p>
        <p>T P</p>
        <p>T P + F P
accuracy =</p>
        <p>
          T P + T N
T P + F P + T N + F N
(
          <xref ref-type="bibr" rid="ref9">9</xref>
          )
(10)
(11)
2T P
f 1score = 2T P + F P + F N (12)
Statistics calculated are shown in figure 5.
        </p>
        <p>As shown in figure 4, scoring 57% (f1 score) at accuracy,
means that the model is slightly better then a simple coin
toss. Using just three technical indicators, on the stock values
of the biggest food company on the world, %57 is a great
score. Improving the model with more technical indicators,
more sophisticated expert knowledge would allow the model
to score even higher.</p>
        <p>Simplified flowchart of the model presented in Figure 5
covers the model in the simplest way, without crunching any
numbers.</p>
        <p>Stock market analysis demanding as it is, proven to be
possible for models like one presented in this issue. Soft
sets are a great choice if expert knowledge and broad choice
of parameters is available. That being said, some facts must
be taken into consideration. Plenty of different elements put
,
,
pressure on the stock market. Working just on the price values,
is a very narrow way of analysis. Although at the first glance
it is all about numbers, there is more to it then covered in this
model.</p>
      </sec>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>F.</given-names>
            <surname>Beritelli</surname>
          </string-name>
          , G. Capizzi,
          <string-name>
            <given-names>G. L.</given-names>
            <surname>Sciuto</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Napoli</surname>
          </string-name>
          , and
          <string-name>
            <surname>M.</surname>
          </string-name>
          <article-title>Woz´niak, “A novel training method to preserve generalization of rbpnn classifiers applied to ecg signals diagnosis,” Neural Networks</article-title>
          , vol.
          <volume>108</volume>
          , pp.
          <fpage>331</fpage>
          -
          <lpage>338</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>M.</given-names>
            <surname>Woz</surname>
          </string-name>
          <article-title>´niak and D. Połap, “Hybrid neuro-heuristic methodology for simulation and control of dynamic systems over time interval,” Neural Networks</article-title>
          , vol.
          <volume>93</volume>
          , pp.
          <fpage>45</fpage>
          -
          <lpage>56</lpage>
          ,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>D.</given-names>
            <surname>Molodtsov</surname>
          </string-name>
          , “
          <article-title>Soft set theory-first results</article-title>
          ,
          <source>” Computers &amp; Mathematics with Applications</source>
          , vol.
          <volume>37</volume>
          , no.
          <issue>4-5</issue>
          , pp.
          <fpage>19</fpage>
          -
          <lpage>31</lpage>
          ,
          <year>1999</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>H.</given-names>
            <surname>Aktas</surname>
          </string-name>
          ¸ and
          <string-name>
            <surname>N.</surname>
          </string-name>
          <article-title>Çag˘man, “Soft sets and soft groups,” Information sciences</article-title>
          , vol.
          <volume>177</volume>
          , no.
          <issue>13</issue>
          , pp.
          <fpage>2726</fpage>
          -
          <lpage>2735</lpage>
          ,
          <year>2007</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>F.</given-names>
            <surname>Feng</surname>
          </string-name>
          ,
          <string-name>
            <given-names>X.</given-names>
            <surname>Liu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Leoreanu-Fotea</surname>
          </string-name>
          , and
          <string-name>
            <given-names>Y. B.</given-names>
            <surname>Jun</surname>
          </string-name>
          , “
          <article-title>Soft sets and soft rough sets,”</article-title>
          <source>Information Sciences</source>
          , vol.
          <volume>181</volume>
          , no.
          <issue>6</issue>
          , pp.
          <fpage>1125</fpage>
          -
          <lpage>1137</lpage>
          ,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>F.</given-names>
            <surname>Fatimah</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Rosadi</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R. F.</given-names>
            <surname>Hakim</surname>
          </string-name>
          , and
          <string-name>
            <given-names>J. C. R.</given-names>
            <surname>Alcantud</surname>
          </string-name>
          , “
          <article-title>Probabilistic soft sets and dual probabilistic soft sets in decision-making,”</article-title>
          <source>Neural Computing and Applications</source>
          , vol.
          <volume>31</volume>
          , no.
          <issue>1</issue>
          , pp.
          <fpage>397</fpage>
          -
          <lpage>407</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>J.</given-names>
            <surname>Hu</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Pan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Yang</surname>
          </string-name>
          , and
          <string-name>
            <given-names>H.</given-names>
            <surname>Chen</surname>
          </string-name>
          , “
          <article-title>A group medical diagnosis model based on intuitionistic fuzzy soft sets</article-title>
          ,” Applied Soft Computing, vol.
          <volume>77</volume>
          , pp.
          <fpage>453</fpage>
          -
          <lpage>466</lpage>
          ,
          <year>2019</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>P. K.</given-names>
            <surname>Maji</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Biswas</surname>
          </string-name>
          ,
          <article-title>and</article-title>
          <string-name>
            <given-names>A.</given-names>
            <surname>Roy</surname>
          </string-name>
          , “
          <article-title>Soft set theory,”</article-title>
          <source>Computers &amp; Mathematics with Applications</source>
          , vol.
          <volume>45</volume>
          , no.
          <issue>4-5</issue>
          , pp.
          <fpage>555</fpage>
          -
          <lpage>562</lpage>
          ,
          <year>2003</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>D.</given-names>
            <surname>Pei</surname>
          </string-name>
          and
          <string-name>
            <given-names>D.</given-names>
            <surname>Miao</surname>
          </string-name>
          , “
          <article-title>From soft sets to information systems</article-title>
          ,” in
          <source>2005 IEEE international conference on granular computing</source>
          ,
          <source>vol. 2</source>
          . IEEE,
          <year>2005</year>
          , pp.
          <fpage>617</fpage>
          -
          <lpage>621</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>