Abstract
The purpose of this chapter is to present how Ordered Fuzzy Numbers (OFNs) can be used with financial high-frequency time series. Considering this approach the financial data are modeled using OFNs called further ordered fuzzy candlesticks. Their use allows modeling uncertainty associated with financial data and maintaining more information about price movement at an assumed time interval than compared to commonly used price charts (e.g., Japanese Candlestick chart). Furthermore, in a simple way, it is possible to include the information about volume and the bid-ask spread. Thanks to the well-defined arithmetic of OFNs, one can be used in technical analysis or to construct models of fuzzy time series in the form of classical equations. Examples of an ordered fuzzy moving average indicator and ordered fuzzy autoregressive process are presented.
You have full access to this open access chapter, Download chapter PDF
Similar content being viewed by others
1 Introduction
High-frequency financial data are observations on financial variables such as quotations of shares, futures, or currency pairs, quoted daily or at a finer timescale. Data containing the most complete knowledge about quotations of the financial instrument are prices corresponding to each single transaction made on this instrument. They are at the same time the data of the highest possible frequency called ultra-high-frequency data or simply tick-by-tick data.
High-frequency financial data possess unique features absent in data measured at lower frequencies, and analysis of these data poses interesting and unique challenges to econometric modeling and statistical analysis [16]. Analysis of tick-by-tick data is very difficult, among others, due to the very large number of observations, irregular spacing between observations, occurrence price patterns, and long-lived dependencies. For various reasons, high-frequency data may contain erroneous observations, data gaps, and even disordered sequences. Moreover, Lo and Mackinlay consider that the financial market is a complex, nonstationary, noisy, chaotic, and dynamic system but it does not follow a random walk [7]. The main reason is that a huge amount of information is reflected in the financial market. The main factors include an economic condition, political situation, traders’ expectations, catastrophes, and other unexpected events. Thus one can conclude that stock market data should be considered in the framework of uncertainties.
Making investment decisions based on observation of each single quotation is very difficult or even impossible. Therefore a large part of investors very often use price chart analysis to make decisions. The price charts (e.g., the Japanese Candlestick chart) are used to illustrate movements in the price of a financial instrument over time. Note that in using the price chart, a large part of the information about the process is lost; for example, using the Japanese Candlestick chart with daily frequency, for one day, we know only four prices (i.e., open, low, high, and close), while in this time the price has changed hundreds of times. In spite of this, Japanese Candlestick charting techniques are very popular among traders and allow for achieving more than average profits. More details about the Japanese Candlesticks and trading techniques based on them can be found in [12].
In our previous papers [8,9,10] we showed how we can use fuzzy logic, that is, Ordered Fuzzy Numbers (OFNs) defined in Chap. 4 (see also [1,2,3, 5, 13, 14]), to model uncertainty associated with financial data and to keep more information about price movement. The idea, construction methods, and an example of an application of ordered Fuzzy Candlesticks are specifically recalled in this work. In addition some new concepts are also presented.
2 Ordered Fuzzy Candlesticks
Generally, in our approach, a fixed time interval of financial high frequency data is identified with Ordered Fuzzy Numbers and it is called ordered Fuzzy Candlestick (OFC). The general idea is presented in Fig. 10.1. Note that the orientation of the OFN shows whether the ordered Fuzzy Candlestick is long or short. Information about movements in the price are contained in the shape of the f and g functions. In this sense, functions f and g do not depend directly on the variable tick but depend on the relationship between the parameters A and B. In the following sections the details of constructing the ordered Fuzzy Candlestick are presented.
Previous works listed two cases of construction of ordered Fuzzy Candlesticks. The first assumes that the functions f and g are functions of predetermined type; moreover, the shapes of these functions should depend on two parameters (e.g., linear). Then the ordered Fuzzy Candlestick for a given time series can be defined as follows.
Definition 1
Let \(\{X_t:t\in T\}\) be a given time series and \(T = \{1,2,\ldots ,n\}\). The ordered Fuzzy Candlestick is defined as an OFN \(C = (f,g)\) that satisfies the following conditions 1–4 (for a long candlestick) or \(1^\prime \)–\(4^\prime \) (for a short candlestick).
- 1.:
-
\(X_1\le X_n\).
- 2.:
-
\(f:[0,1]\rightarrow \mathbb {R}\) is continuous and increasing on [0, 1].
- 3.:
-
\(g:[0,1]\rightarrow \mathbb {R}\) is continuous and decreasing on [0, 1].
- 4.:
-
\(S_1 < S_2,\ f(1) = S_1,\ f(0) = \min \limits _{t\in T}X_t -C_1,\ g(1) = S_2\) and g(0) is such that the ratios \(\displaystyle {\frac{F_g}{A}}\) and \(\displaystyle {\frac{F_f}{B}}\) are equal.
- \(1^\prime .\) :
-
\(X_1 > X_n\).
- \(2^\prime .\) :
-
\(f:[0,1]\rightarrow \mathbb {R}\) is continuous and decreasing on [0, 1].
- \(3^\prime .\) :
-
\(g:[0,1]\rightarrow \mathbb {R}\) is continuous and increasing on [0, 1].
- \(4^\prime .\) :
-
\(S_1 < S_2,\ f(1) = S_2,\ f(0) = \max \limits _{t\in T}X_t + C_2,\ g(1) = S_1\) and g(0) is such that the ratios \(\displaystyle {\frac{F_f}{A}}\) and \(\displaystyle {\frac{F_g}{B}}\) are equal.
In the above conditions the ordered Fuzzy Candlestick center (i.e., added interval) is designated by parameters \(S_1,\,S_2\in \left[ \min _{t\in T}{X_t}, \max _{t\in T}{X_t} \right] \) and can be computed as different kinds of averages (e.g., arithmetic, weighted, or exponential). \(C_1\) and \(C_2\) are arbitrary nonnegative real numbers that further extend the support of fuzzy numbers and can be computed, for example, as the standard deviation or volatility of \(X_t\). The parameters A and B are positive real numbers that determine the relationship between the functions f and g. They can be calculated as the mass of the desired area with the assumed density (see Fig. 10.1). Numbers \(F_f\) and \(F_g\) are the fields under the graph of functions \(f^{-1}\) and \(g^{-1}\), respectively.
Example 1
Trapezoid OFC
Suppose that f and g are linear functions in the form:
then the ordered Fuzzy Candlestick \(C = (f,g)\) is called a trapezoid OFC, especially if \(S_1 = S_2\) where it can also be called a triangular OFC.
Example 2
Gaussian OFC
The ordered Fuzzy Candlestick \(C = (f,g)\) where the membership relation has a shape similar to the Gaussian function is called a Gaussian OFC. It means that f and g are given by functions:
where, for example, \(z = 0.99x + 0.01\).
The procedure of determining the parameters of the function f and g is shown in Algorithm 1 and the examples of realizations of trapezoid and Gaussian ordered Fuzzy Candlesticks are presented in Fig. 10.2.
The second case of construction of ordered Fuzzy Candlesticks assumes that the functions f and g are defined in a similar way to the empirical distribution in the statistical sciences and called an empirical OFC. The calculation procedure of an empirical OFC is shown in Algorithm 2, whereas the example of realizations is presented in Fig. 10.3.
3 Volume and Spread
3.1 Volume
In technical analysis the prices are by far the most important. However, another piece of important information about price movement is volume. Volume is the number of entities traded during the time period under study. It is used to confirm trends and chart patterns. Any price movement up or down with relatively high volume is seen as a stronger, more relevant move than a similar move with weak volume [11].
In the case of ordered Fuzzy Candlesticks, adding extra information about volume is very easy, enough to calculate the parameters A and B using the density associated with volume or for empirical OFC, and enough to calculate the empirical distribution using prices repeated by volume times. The example of ordered Fuzzy Candlesticks without and with volume information are presented in Fig. 10.4.
3.2 Spread
A spread (bid-ask spread) is simply defined as the price difference between the highest price that a buyer is willing to pay (bid price) for an asset and the lowest price that a seller is willing to accept to sell it (ask price). It is important to remember that spreads are variable, meaning they will not always remain the same and will change sporadically. These changes are based on liquidity, which may differ based on market conditions and upcoming economic data. In an over-the-counter market, dealers act as market makers by quoting prices at which they will buy and sell a security or currency. In this case, the spread represents the potential profit that the market maker can make from this activity, and it’s meant to compensate it for the risk of market making. On the other hand, it is a cost for traders.
In the case of ordered Fuzzy Candlesticks, it is possible to add extra information about the bid-ask spread by calculating the parameters \(S_1\), \(C_1\) and \(S_2\), \(C_2\), using the bid price and ask price, respectively. The examples of ordered Fuzzy Candlesticks without and with spread information are presented in Fig. 10.5.
4 Ordered Fuzzy Candlesticks in Technical Analysis
4.1 Ordered Fuzzy Technical Analysis Indicators
Ordered Fuzzy Candlesticks are Ordered Fuzzy Numbers, hence, thanks to their well-defined arithmetic [1, 4, 13] can be used to construct a fuzzy version of technical analysis indicators such as the simple moving average.
The classical simple moving average (SMA) with order s at a time period t is given by formula
where \(X_t\) is the observation (real) at a time period t (e.g., closing prices).
Now, the ordered fuzzy simple moving average (OFSMA) with order s at a time period t is also given by formula (10.3) but the observations \(X_t\) are OFC at a time period t. Figure 10.6 shows the results of realization of classical (line with xcross symbol) and ordered fuzzy (triangle symbols) simple moving average with order equal to 14 for the dataset covering the period of 80 days from 02-03-2016 till 02-06-2016 of quotations of EUR/PLN. Figure 10.6 also shows the ordered fuzzy simple moving average defuzzification by the center of gravity operator (line with circle symbol). In technical analysis the moving average indicator usually is used to define the current trend. Notice that the ordered fuzzy moving average determines the current trend by orientation of the ordered Fuzzy Candlesticks: if orientation is positive then then the trend is long, else the trend is short. The process of fuzzification of the other technical indicators can be done by analogy.
4.2 Ordered Fuzzy Candlestick as Technical Analysis Indicator
The method of construction of ordered Fuzzy Candlesticks can be used directly as a technical analysis indicator by doing the calculation of OFC over a moving window of observations (ticks). The size of the window can be defined as the number of observations (e.g., last 100 ticks) or the time (e.g., last 10 min). Figure 10.7 shows the results of realization of empirical ordered Fuzzy Candlesticks as a technical indicator with window size equal to 15 min for the dataset covering the period of 1 hour from 3 PM till 4 PM of 02-06-2016 of quotations of EUR/PLN.
Indicators are used as a secondary measure to the actual price movements and add additional information to the analysis of securities. Indicators are used in two main ways: to confirm price movement and the quality of chart patterns, and to form buy and sell signals. The most common type of indicators is called oscillators and they fall in a bounded range. Oscillator indicators have a range, for example, between zero and 100, and signal periods where the security is overbought (near 100) or oversold (near zero). In a simple way the indicator based on ordered Fuzzy Candlesticks can be presented in the form of an oscillator by applying normalization. An example of empirical ordered Fuzzy Candlesticks as an oscillator indicator is presented in Fig. 10.8.
5 Ordered Fuzzy Time Series Models
Thanks to the well-defined arithmetic of OFNs, it is possible to construct models of fuzzy time series, such as an autoregressive process (AR), where all input values are OFC, and the coefficients and output values are arbitrary OFNs, in the form of classical equations, without using rule-based systems.
The classical autoregressive model \((\text {AR}(p))\) is one where the current value of a variable, depends only upon the values that the variable took in previous periods plus an error term [15]. In the presented approach, an ordered fuzzy autoregressive model of order p, denoted \(\text {OFAR}(p)\), in a natural way is fully fuzzy \(\text {AR}(p)\) and can be expressed as
where \(\overline{X}_{t - i}\) are the ordered Fuzzy Candlesticks at a time period t, \(\overline{\alpha }_i\) are fuzzy coefficients given by arbitrary OFNs, and \(\overline{\varepsilon }_t\) is an error term.
Estimation of OFAR(p) Model
The least squares method is proposed for the estimation of fuzzy parameters \(\overline{\alpha }_i = (f_{\alpha _i},g_{\alpha _i})\) in the \(\text {OFAR}(p)\) model and one is defined using a distance measure. The measure of the distance between two OFNs is expressed by the formula:
where \(\Vert \,\cdot \,\Vert \) is a metric induced by the \(L^2\)-norm. Hence, the least squares method for \(\text {OFAR}(p)\) is to minimize the following objective function,
Forecasting Using the OFAR(p) Model
Forecasts of the \(\text {OFAR}(p)\) model are obtained recursively in a similar way as for the classical \(\text {AR}(p)\) model. Let t be the starting point for forecasting. Then, the one-step-ahead forecast for \(\overline{X}_{t+1}\) is
The result of the forecast is an Ordered Fuzzy Number, which includes three kinds of predictions:
6 Conclusion and Future Works
In this chapter, the representation of financial data using the concept of the ordered Fuzzy Candlestick is described. The ordered Fuzzy Candlestick holds more information about the prices than the classical Japanese Candlestick. Moreover, it is also possible to include information about the volume and spread. Based on well-defined arithmetic of Ordered Fuzzy Numbers, the proposed approach enables us to build the technical analysis indicators and the fuzzy financial time series models in the simple form of classical equations. It allows reducing the size of models compared to models based on fuzzy-rule-based systems. For future work, our approach can be extended by adding the concept of fuzzy random variables, which can allow for the simulation of models and their application in many other areas of financial engineering.
References
Kosiński, W.: On fuzzy number calculus. Int. J. Appl. Math. Comput. Sci. 16(1), 51–57 (2006)
Kosiński, W., Prokopowicz, P., Rosa, A.: Defuzzification functionals of ordered fuzzy numbers. IEEE Trans. Fuzzy Syst. 21(6), 1163–1169 (2013). doi:10.1109/TFUZZ.2013.2243456
Kosiński, W., Prokopowicz, P., Ślȩzak, D.: Drawback of fuzzy arthmetics - new intutions and propositions. In: Proceedings Methods of Aritificial Intelligence, pp. 231–237 (2002)
Kosiński, W., Prokopowicz, P., Ślȩzak, D.: On algebraic operations on fuzzy numbers. In: Kłopotek, M.A., Wierzchoń, S.T., Trojanowski, K. (eds.) Intelligent Information Processing and Web Mining: Proceedings of the International IIS: IIPWM’03 Conference held in Zakopane, Poland, June 2–5, 2003, pp. 353–362. Springer, Berlin (2003)
Kosiński, W., Prokopowicz, P., Ślȩzak, D.: Ordered fuzzy numbers. Bull. Pol. Acad. Sci. Ser. Sci. Math. 51(3), 327–338 (2003)
Kosinski, W., Wilczynska-Sztyma, D.: Defuzzification and implication within ordered fuzzy numbers. In: Fuzzy Systems (FUZZ), 2010 IEEE International Conference on Computational Intelligence. pp. 1–7. IEEE (2010)
Lo, A.W., MacKinlay, A.C.: Stock market prices do not follow random walks: evidence from a simple specification test. Rev. Financ. Stud. 1(1), 41–66 (1988)
Marszałek, A., Burczyński, T.: Financial fuzzy time series models based on ordered fuzzy numbers. In: Pedrycz, W., Chen, S.M. (eds.) Time Series Analysis, Modeling and Applications: A Computational Intelligence Perspective, pp. 77–95. Springer, Berlin (2013)
Marszałek, A., Burczyński, T.: Modelling financial high frequency data using ordered fuzzy numbers. In: Rutkowski, L., Korytkowski, M., Scherer, R., Tadeusiewicz, R., Zadeh, L.A., Zurada, J.M. (eds.) Artificial Intelligence and Soft Computing: 12th International Conference, ICAISC 2013, Zakopane, Poland, June 9–13, 2013, Proceedings, Part I, pp. 345–352. Springer, Berlin (2013)
Marszałek, A., Burczyński, T.: Modeling and forecasting financial time series with ordered fuzzy candlesticks. Inf. Sci. 273, 144–155 (2014). http://www.sciencedirect.com/science/article/pii/S0020025514003107
Murphy, J.: Technical Analysis of the Financial Markets: A Comprehensive Guide to Trading Methods and Applications. New York Institute of Finance Series, New York Institute of Finance (1999). https://books.google.pl/books?id=5zhXEqdr_IcC
Nison, S.: Japanese Candlestick Charting Techniques: A Contemporary Guide to the Ancient Investment Techniques of the Far East. New York Institute of Finance (2001). https://books.google.ie/books?id=rbn8NeXOYV4C
Prokopowicz, P.: Flexible and simple methods of calculations on fuzzy numbers with the ordered fuzzy numbers model. In: Rutkowski, L., Korytkowski, M., Scherer, R., Tadeusiewicz, R., Zadeh, L., Zurada, J. (eds.) Artificial Intelligence and Soft Computing. Lecture Notes in Computer Science, vol. 7894, pp. 365–375. Springer, Berlin (2013). doi:10.1007/978-3-642-38658-9_33
Prokopowicz, P.: Analysis of the changes in processes using the kosinski’s fuzzy numbers. In: Ganzha, M., Maciaszek, L., Paprzycki, M. (eds.) Proceedings of the 2016 Federated Conference on Computer Science and Information Systems. Annals of Computer Science and Information Systems, vol. 8, pp. 121–128. IEEE (2016). doi:10.15439/2016F140
Tsay, R.S.: Analysis of Financial Time Series. Wiley Series in Probability and Statistics. Wiley-Interscience, Hoboken (N.J.) (2005). http://opac.inria.fr/record=b1127642
Yan, B., Zivot, E.: Analysis of high-frequency financial data with s-plus. Working Papers UWEC-2005-03, University of Washington, Department of Economics (2003). http://EconPapers.repec.org/RePEc:udb:wpaper:uwec-2005-03
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.
Copyright information
© 2017 The Author(s)
About this chapter
Cite this chapter
Marszałek, A., Burczyński, T. (2017). Ordered Fuzzy Candlesticks. In: Prokopowicz, P., Czerniak, J., Mikołajewski, D., Apiecionek, Ł., Ślȩzak, D. (eds) Theory and Applications of Ordered Fuzzy Numbers. Studies in Fuzziness and Soft Computing, vol 356. Springer, Cham. https://doi.org/10.1007/978-3-319-59614-3_10
Download citation
DOI: https://doi.org/10.1007/978-3-319-59614-3_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-59613-6
Online ISBN: 978-3-319-59614-3
eBook Packages: EngineeringEngineering (R0)