Fig. 11.1
figure 1

NASDAQ Composite index quotations from 2006 to 2016

1 Introduction

In comparison to existing methods, more accurate forecasting methods can be obtained using a rule-based forecasting (RBF), a technique combining data extrapolation [7, 13, 14, 25, 26, 43,44,45], time series [28, 29, 44, 45], and elements of expert systems [5,6,7, 22, 23, 34, 37, 46]. The four most important methods of extrapolation were used: linear regression, random walk, and Brown’s exponential smoothing, as well as Holt’s exponential smoothing. In order to create rules some information from the literature, surveys, and knowledge of several experts was adapted [17, 19,20,21, 36, 38, 39]. The rules were calibrated using 80 time series. In contrast, the validation needed another 40 series. In the opinion of the authors, RBF has been successfully applied by combining domain expertise with statistical methods. This has been confirmed by many studies in the recent literature, where rule-based forecasting is a fast-growing technology. It is worth mentioning a few examples from a very comprehensive literature such as M. Adya, J.S. Armstrong, and F. Collopy [1,2,3, 8, 9], who publish in the International Journal of Forecasting, a magazine that inspires other authors associated with the RBF methods. In this chapter time series of index data were preliminarily fuzzified [30, 33] to check the proposed methods of detecting trends [18]. Trends identified in the sequence of literals are then used to develop trend prediction rules. Therefore fuzzy logic [12, 13, 16, 35] was used to develop linguistic data input. Data for the study were quotations of the Nasdaq Composite index from the years 2006–2016. Figure 11.1 shows the data in an illustrative manner. Table 11.1 contains Nasdaq index data for a single trading day. Daily data are: opening, maximum, minimum, and closing values as well as the percentage change as compared to the day before. These five values are replaced by the linguistic values. Table 11.1 shows both the linguistic values and index quotations.

Table 11.1 Selected historical NASDAQ Composite index. The dataset covers the time period from November 1, 2016 to November 30, 2016

2 Application of OFN Notation for the Fuzzy Observation of NASDAQ Composite

Data from November this year for the NASDAQ Composite are presented in Table 11.1. Quotations are given in a widely used format for this type of time series. Subsequent letters of the alphabet represent values for consecutive trading days. Figure 11.2 shows an OHLC (open, high, low, close) chart of the Nasdaq Composite index for one month. The graph shows the following attributes for each of the daily quotations: opening, closing, highest, and lowest value. These attributes, along with the change parameter are shown in Table 11.1. In addition, decrease in quotation is marked in red and increase is marked in black. Positions A, B, and C in Fig. 11.2 show a decrease in quotations on specified days. Another four quotations-D, E, F, G-show an increase in the value of the Nasdaq Composite. A very large spread between the minimum and maximum value, and between the opening and closing are on H; these are decreasing quotations. This is followed by increases to date S with only two days of drops (J and N) in the range. Point P is interesting, because the opening value is virtually level with the closing value, despite some fluctuations of the Nasdaq Composite value during the trading day. It is essential that P be located near the top of the local peak. Then visualizations T and W demonstrate declines from the local peak. As the chart above may not be unambiguous in terms of the trend interpretation the authors introduce the logic of Ordered Fuzzy Numbers [14, 24, 30] in order to interpret the quotations. Table 11.2 shows the OFN characteristic points with the Nasdaq Composite quotation parameters as listed in Table 11.2.

Fig. 11.2
figure 2

Nasdaq Composite OHLC chart for the period of November 1, 2016 to November 30, 2016 (based on www.stockcharts.com).

Table 11.2 Characteristic points
Table 11.3 Example of positively directed OFN number for the Nasdaq index
Fig. 11.3
figure 3

Graphically displayed positively directed OFN number and its characteristic points as used for the Nasdaq Composite

Fig. 11.4
figure 4

Graphically displayed change parameter positive value as used in the Nasdaq Composite OHLC chart

Figure 11.4 is an OHLC chart with Nasdaq index parameters. In the considered single day there has been an increase in quotations. The translation of data from Fig. 11.4 on the OFN is presented in Table 11.3. The resulting fuzzy number is interpreted graphically in Fig. 11.3. The arrow of fuzzy numbers is directed towards increasing values symbolizing the positive direction of the OFN and reflecting an increase in the quotations.

Fig. 11.5
figure 5

Graphically displayed negatively directed OFN and its characteristic points as used for the Nasdaq Composite

Fig. 11.6
figure 6

Graphically displayed change parameter negative value as used in the Nasdaq Composite OHLC chart

Figure 11.5 shows the fuzzy number stretched on the same values as in Fig. 11.3. However, the direction of the OFN here is the opposite. Chart 2.6 depicts the decrease in quotations for a single day of trading. It should be noted that the equivalent of the index’s downward movement is a negative direction of the OFN (Fig. 11.6).

3 Ordered Fuzzy Number Formulas

Nasdaq Composite index values \(R_1 \div R_m\) relate to a single trading day. Fuzzy observation in OFN notation is performed on a set of R. The observation is for one dependent and four independent attributes. For each day the number \(\mathbb {R}_i\in \left\{ R_1 \div R_m\right\} \) is created of the four required values. Symbols of time are, respectively, \( t_i \), the day of the measurement, whereas \( t_{OPEN} \), \( t_{MIN} \), \( t_{tMAX} \) i \( t_{CLOSE} \) are, respectively, quotations of opening, minimum, maximum, and close value (Table 11.4).

Definition 1

On a given day \(t_i\), the set forming fuzzy observation of the Nasdaq Composite index, is provided as

$$\begin{aligned} \mathbb {R}/t_i \in \{ \mathbb {R}^{(0)}/t_{OPEN}, \; \mathbb {R}^{(1)}/t_{MIN}, \;\mathbb {R}^{(1)}/t_{MAX}, \; \mathbb {R}^{(0)}/t_{CLOSE} \} \end{aligned}$$
(11.1)

where

$$\begin{aligned} t_{CLOSE}>\{t_{MIN},t_{MAX} \} >t_{OPEN} \end{aligned}$$
$$\begin{aligned} f_{\mathbb {R}}(0)<f_{\mathbb {R}}(1)<g_{\mathbb {R}}(1)<g_{\mathbb {R}}(0) \end{aligned}$$
Table 11.4 Example of a negatively ordered OFN as an interpretation of the Nasdaq index

The OFN arrangement (order) is synonymous with the measurement time of t movement intensity, where \(t\in \left\{ t_{OPEN}, t_{MIN}, t_{tMAX}, t_{CLOSE} \right\} \). The measurements must be performed in a specific order. The OFN order in Fig. 11.3 is the direction of index changes for one trading day. The default direction of OFN \(\mathbb {R}\) is positive (Fig. 11.2).

Lemma 1

$$\begin{aligned} {\mathbb {R}_{positive}}=\left\{ \begin{matrix} {\mathbb {R}_{CLOSE}}\le {\mathbb {R}_{OPEN}} \\ {\mathbb {R}_{OPEN}},{\mathbb {R}_{MIN}},{\mathbb {R}_{MAX}},{\mathbb {R}_{CLOSE}} \\ {f_{\mathbb {R}}}(0), {f_{\mathbb {R}}}(1),{g_{\mathbb {R}}}(1),{g_{\mathbb {R}}}(0) \end{matrix}\right. \end{aligned}$$
(11.2)

and the opposite case is

$$\begin{aligned} {\mathbb {R}_{negative}}=\left\{ \begin{matrix} {\mathbb {R}_{CLOSE}} > {\mathbb {R}_{OPEN}} \\ {\mathbb {R}_{CLOSE}},{\mathbb {R}_{MAX}},{\mathbb {R}_{MIN}},{\mathbb {R}_{OPEN}} \\ {f_{\mathbb {R}}}(0), {f_{\mathbb {R}}}(1),{g_{\mathbb {R}}}(1),{g_{\mathbb {R}}}(0) \end{matrix}\right. \end{aligned}$$
(11.3)

The NASDAQ was launched in the 1970 s and was the first fully electronic securities trading system in the world. The stock market traded shares of companies mainly related to modern technology (IT). The Nasdaq Composite is one of the three major US indices, next to the Dow Jones Average and the S&P500 [47,48,49,50]. As for 2016, listed on the NASDAQ are approximately 3,000 companies, including Apple, Google, Microsoft, and Intel. The Nasdaq composite index is an aggregate of the common stocks listed on the NASDAQ stock market. The formula for aggregating fuzzy observation of subaggregate \( S_m \) for n component companies of the index is as follows.

Definition 2

Fuzzy observation of index Nasdaq Composite at the time \(t_i\) is a set of

$$\begin{aligned} s_m=\sum _{i=1}^n \begin{pmatrix} \mathbb {R}_{positive} &{}&{} \mathbb {R}_{negative}\\ \mathbb {R}\cdot w_i &{}|&{} -\mathbb {R}\cdot w_i \end{pmatrix} \end{aligned}$$
(11.4)

where \( n\le 3000\) and \(w_i \in \{w_1,\cdots w_n\} \) is a vector of the individual companies’ impact, default \(w_i = 1\).

The weight of each company in the index is

$$\begin{aligned} P_j=\frac{\mathbb {R}_j* w_j}{\sum _{i=1}^{m} \mathbb {R}_i * w_i}* 100\% \end{aligned}$$
(11.5)

where \(j\in [1,m]\)

Definition 3

If a subaggregate Sm of the Nasdaq Composite aggregate with a certain number n of (e.g., sector-related) companies has a different direction of the OFN from the direction of the main index, then it can be assumed that it is a predictor of trend change. This includes the rule:

$$\begin{aligned} \begin{array}{r} \mathbf {IF}\; NasdaqComposite \;is \;positive \;\mathbf {AND} \;S_m \;is \;negative \;\\ \qquad \qquad \mathbf {THEN} \;Possible \;change \;is \;true \end{array} \end{aligned}$$
(11.6)

4 Conclusions

Investing in the stock market is associated with high risk. This is due to the lack of ideal solutions for the analysis of market data and predictions in short- and long-term changes in indices, major stock market indicators. Processes occurring on the stock markets have nonlinear chaotic characteristics, making it difficult to study them. The technical analysis often uses expert knowledge and expert rules to detect and use recognizable trends [43]. One can base investment strategy on trends that will bring profits during the boom and limit losses when a market is in decline. Expert knowledge and rules can be transferred to digital form. Currently, there are many methods for identifying trends on the stock exchange [16, 50]. Many of them are unattractive due to their complicated structure. An interesting alternative to describing the phenomenon of the trend is the application of fuzzy numbers and fuzzy logic [4, 10, 11, 31, 32]. The chapter presents Ordered Fuzzy Numbers, which use five specific index parameters as well as index analysis methods to identify the occurrence of a trend. Ordered Fuzzy Number notation made it possible to replace up to five attributes (open, close, high, low, change) describing the index quotes with a single OFN. In addition, the use of OFNs lets one quickly detect changes in the trend, which is very important in short-term investments. The authors previously proposed similar solutions based on research WIG20 [16]; there are also other works on similar solutions and financial investment [27, 28]. The authors intend to carry out further research in this area in order to find more versatile and accurate prediction models to identify market trends.