INVESTIGATION OF THE HERDING AND CONTRARIAN BEHAVIOUR OF INVESTORS

,


Introduction
Investor behavior is playing an increasingly important role in analyzing changes in financial markets. A lot of research is done to find out what key factors and what causes influence certain investor financial decisions, also how investor decisions based on their mood or opinion affect investors' individual investment performance and the overall financial market atmosphere. The earlier performed research shows that investor behavior is an important element in understanding financial market volatility and predicting its causal links. It has been observed that one of the main factors influencing investors' decisions is the opinion formed by investors about specific financial instruments. Most investors are exposed to prevailing market views and make investment decisions by monitoring what the majority of investors are going to do. Such market participants ignore other market signals and try to replicate the actions of the majority of investors. Such phenomenon is called herding behavior. However, there is another side where investors disagree with the majority and make decisions based on a different approach from the majority of investors, in order to achieve the set investment goals. These two paradigms of investor behavior are widespread and have a significant impact on financial market fluctuations. For this reason, the performed research focuses on examining the behavioral patterns of these two groups of investors.
In order to make efficient use of their available financial resources, every investor should be able to accurately predict future changes in the financial market. Given that both the methods and the market itself are constantly changing objects, including the fact that investor behavior in financial markets is also constantly changing, the search for the most appropriate forecasting method is a never-ending process and still very relevant. Therefore, monitoring investor behavior and the investor perception that determines it can be one of the tools that can contribute to the development of an effective forecasting method. Investor opinion, or in other words, investor sentiment, can be analyzed in a variety of ways. But one of the most accurate methods and the most appropriate artificial intelligence algorithms based on the functions of artificial neural networks have been selected for this study. The use of these methods in the analysis of investor sentiment has not been extensively studied, for this reason the study of investor behavior is practically useful.
The aim of the research is to determine which pattern of investor behavior is more in line with real changes in the prices of financial instruments.
To achieve the goal of the research, the following tasks have been set: 1. To perform the analysis of scientific literature on the topic of investor behavior; 2. To examine the main methods of measuring and analyzing the herding behavior of investors; 3. To estimate price forecasts for selected financial instruments using the deep learning method; 4. To perform the classification of social network records related to the financial instruments in question, using the sentiment classification algorithm; 5. To determine how the forecasts, investor sentiment data and the opinion formed on social networks correspond to the real changes in the prices of the selected financial instruments; 6. To determine which pattern of investor behavior better corresponds to the real changes in the prices of selected financial instruments.
The following research methods have been applied: analysis and generalization of scientific literature, prediction using deep learning algorithm, sentiment classification method, data mining using Tweet Sentiment Visualization tool, data systematization and graphical representation of results, comparative analysis of results.
The structure of the paper is as follows. Section 1 presents the literature review on the topics of investor behaviour, decision-making, investor sentiment, and herding behaviour. Section 2 deals with the methodology of the research based on technical indicators, deep learning algorithms, and sentiment scores. Section 3 describes the results of the research. Conclusions of the paper provide the generalization of the obtained results and future research directions.

Literature review
Classical financial theories are based on the assumption that investor behavior in the market is rational. However, research confirms that investors feel various emotions, misunderstand information and are affected by other irrational factors that determine their choices when making investment decisions in conditions of uncertainty and risk . With the expansion of financial markets and interest in investing, many theories have emerged that help the investor to develop successful investment strategies, but most of them are based on the assumption that the investor's decisions in the market are rational. Much modern research provides reason to believe that classical financial models and theories cannot reliably explain market price dynamics and the behavior of financial market participants. Classical financial theories cannot be applied effectively because the behavior of investors is irrational, influenced by various psychological factors and does not meet the assumptions of classical theories . Studies have shown that an investor in an uncertain situation is not able to analyze all the information and all the factors, so he is forced to use different methods or simply behaves randomly due to the limited time to make a decision (Barber & Odean, 2013). One of the main factors in making a random decision is that an individual uses insufficient information to draw conclusions or ignores important information knowing that he or she does not have enough time to analyze all available and relevant information. The investor understands and evaluates the result obtained in each case differently based on the level of risk available to him. It means that he makes decisions based on a separate assessment of each action when assessing the overall risk of the actions taken and is not inclined to assess the overall result (Baker & Ricciardi, 2014). Thus, the loss of funds in a single operation overshadows the threat of a greater loss in a number of transactions and the investor thus attaches greater importance to an action that is less important than their totality.
One of the main principles of the prospect theory is that the investor focuses more on the value of the amounts gained or lost than on the final result, and that investors experience a greater emotional burden by incurring losses than by making the same amount of profit (Lim et al., 2013;Ryu et al., 2017). According to this theory, investors focus more on the amounts they can gain or lose than on the end result of the investment. The prospect theory is also related to the declining marginal utility, according to which the large amount earned first will give the investor a much greater sense of pleasure than the second exactly the same (Mak & Ip, 2017). Some examples of investors' irrational behavior were described as early as the 19th century. The herding effect was one of the first factors of irrational behavior that researchers observed and investigated its influence on decision-making. Gustave Le Bon's book, The Psychology of the Crowd, in 1895 highlighted the fact that, as part of a group, individuals begin to think collectively, and this thinking forces them to behave not individually but as other people. Under conditions of uncertainty, when a limited amount of information is available, the only good option for an investor to make a decision may seem to be to monitor and simulate the behavior of other market participants, i. e. follow the example of the majority. Such investor behavior in the financial market leads to speculative information bubbles, various anomalies and mass hysteria (Lapanan, 2018).
The analysis of the works of various authors (Danarti et al., 2020;Shankar & Shashidhara, 2019) and their research results revealed that all the factors that determine the irrational behavior of investors can be divided into two groups: -Cognitive factors. These factors are related to the investor's misperception of reality and incorrect assessment of the available information and the real situation. The stereotypical thinking thus formed leads to wrong decisions. -Emotional factors. Such factors occur to most investors because they are determined by the characteristics of human nature. As the situation becomes more complex and its uncertainty grows, it becomes difficult for investors to adequately understand and assess reality, and they begin to look for ways to simplify the current situation. Such simplifications created by investors hinder adequate decisions, as useful information is discarded and irrelevant information is valued. Kahneman and Tversky in 1974 found that investors predict the values of unknown variables based on available information, whereas it is important to determine what changes are likely in the future when making a decision under conditions of uncertainty (Barber & Odean, 2013). The application of probability theory requires an understanding of complex mathematical formulas, having certain knowledge and skills, and the ability to process large amounts of data. A person begins to rely on a basic set of heuristic methods that help him make a decision using only the limited information he has, and simplifies the whole process. He begins to use his experience, intuition, and stereotypes.
Many authors (Barber & Odean, 2013;Bikas & Kavaliauskas, 2010;Kariofyllas et al., 2017;Pascual-Ezama et al., 2014) single out the main situations that lead to incorrect evaluation of information and then irrational decision making. The reason for such situations is prejudice, errors and superficial evaluation of information. The first situation arises when investors overestimate the information available. The second situation is when an investor misuses probability theory models and mathematical statistics formulas to assess the reliability and significance of new information (Mak & Ip, 2017). The third situation is when the description of the event or the provision of any information about it affects its assessment. It can be observed that if the investor has a preconceived notion about the assessed event, he gives insufficient significance or even ignores the newly received information, which contradicts his formed perception.
In the last decades of the XXth century, financial professionals have increasingly come to terms with a situation in which market phenomena could not be explained on the basis of classical theories alone. It has been found that individuals are influenced by preconceived notions, stereotypes, various perceptual illusions, information processing errors and emotions when making investment decisions. Clearly, these facts are inconsistent with rational behavior, which is based on classical models, and therefore the science of behavioral finance emphasizes such key features of irrational behavior that characterize the modern investors (Barber & Odean, 2013;Ryu et al., 2017;L. Zhou & Huang, 2019): -Investors often do not choose a passive portfolio management strategy, they actively buy and sell securities, sometimes using outdated or insignificant information, relying on unreliable expert advice, misusing market future prices forecasting methods and not paying enough attention to diversifying existing investment portfolios. -Investors do not apply the principle of maximum expected utility when valuing risky transactions. Investors are often biased in their assessment of the specifics of results that meet their expectations, as they face the fear of losing, incurring losses and overestimating their goals. -Investors are engaged in forecasting expected results of indefinite size, form probability and statistical models in the short term, which cannot be the basis for the use of mathematical statistics or probability theory. -Investors can make any financial decisions depending on what tasks they have set and according to what strategy they are investing. When choosing between long-term and short-term investments, investors randomly decide whether to invest in stocks or bonds, and no classical theory can predict this. -Investors sometimes under-react to changes in the market or vice versa, give them too much weight due to their inherent conservatism or exposure to representativeness. This determines changes in the amount of profits received by investors and changes in the prices of financial assets. Irrational investor behavior becomes more pronounced as the uncertainty of the situation and the risk of action increase, regardless of the investor's age, education or experience. When the situation is not clear and there is uncertainty, they all behave in the same way and make the same mistakes, which are called investor biases.
The investor's behavior in the financial market is greatly influenced by the emotional characteristics of his character, which are unavoidable in certain situations, especially when a decision has to be made in a very short time. Such psychological factors are widely studied in the scientific literature (Alrabadi et al., 2018;Andersen et al., 2020;Baker & Ricciardi, 2014;Rezaei & Elmi, 2018) and are identified as investor biases. They seek to explain why an investor behaves in one or another way in different situations. The main biases influencing investor decisions are: -Overconfidence. A situation where an investor overestimates his abilities, has too much confidence in his opinion and creates the illusion that he knows best and controls the consequences of decisions. This bias usually occurs when an investor manages to make a large profit and then it inspires more confidence in his own strength because he thinks that the result is due to his knowledge and abilities (Baker & Ricciardi, 2014). -Cognitive dissonance. This phenomenon is described as a mismatch between two investor cognitions, which can be defined as any element of knowledge, such as: attitude, emotions, beliefs, or behavior. It occurs when a person receives information that clearly contradicts the information he already has, then he feels discomfort and tells himself a new truth in order to avoid it (Feldman & Lepori, 2016). -Illusion of control. This bias appears when an investor believes he can influence uncontrollable phenomena.
The more information an investor has, the greater the illusion of control he experiences (Chhapra et al., 2018). -Conservatism. This bias occurs when investors are reluctant to adjust or revise their estimates even after receiving new and significant information (Rezaei & Elmi, 2018). -Representativeness. Investors tend to give certain changes, reports or information more importance or a greater degree of probability than they are actually worth. An investor may not notice truly noteworthy events and continue to waste time on irrelevant information, which will negatively affect his investment decisions (Andersen et al., 2020). -Confirmation. It is a tendency for the investor to interpret the available evidence in a way that confirms or is consistent with his views or beliefs. The investor pays less attention to evidence that refutes his view or is inconsistent with it (Rezaei & Elmi, 2018). -Anchoring. It is a human tendency to attach to certain reference points called an anchor. When the investor focuses on such aspects, he may give less importance to long-term trends (Pahlevi & Oktaviani, 2018). -Framing. An investor expecting some specific framework creates the illusion of certainty, thus creating choices that cannot be explained on the basis of rationality. Investors are more likely to use positive frames than negative ones, as the latter are always associated with losses (Rezaei & Elmi, 2018). -Optimism. Excessive optimism stems from overconfidence and includes the belief that future events are more likely to be positive than realistic. When an investor is overly optimistic, he does not evaluate forecasts and the situation realistically, he thinks the result will be only positive (Chhapra et al., 2018;Pahlevi & Oktaviani, 2018). In addition to the above-mentioned biases, other biases such as hindsight, loss aversion, self-control, endowment, self-attribution, ambiguity aversion, and others are distinguished. Other authors (Tekce et al., 2016;Ye et al., 2020;L. Zhou & Huang, 2019) mention other deviations in investor behavior in financial markets in addition to the biases listed above. One of them is the lack of diversification. Risk is poorly distributed, invested in a small number of assets, which leads to an increase in their riskiness. This is due to recklessness and underestimation of investments. Another factor is that investors tend to sell profitable positions too quickly and keep loss-making positions too long. This is a common phenomenon in financial markets as investors avoid taking losses, so they hold unprofitable positions and expect their value to rise. Also, investors in profitable positions are in a hurry to sell, for fear of losing profits. Another factor is related to the orientation of investors towards short-term investments and the prioritization of already known assets (Feldman & Lepori, 2016). They can make deals at a very unfavorable moment or react too sensitively to bad or good news. Investors are more likely to choose stocks that are in the home market because they are better known.
The authors (Beer & Zouaoui, 2012;Yang & Wu, 2019;G. Zhou, 2017) mention in their works that irrational decisions by investors and changes in their moods cause market price bubbles, unusual price fluctuations, and market anomalies. Thus, the mood of investors is also a very significant factor that influences the actions of investors. The more complex the situation, the stronger the influence of emotions and moods on actions. The dependence of investor behavior on their mood in the science of financial behavior is called investor sentiment. It is important to emphasize that investor behavior in the financial market is greatly influenced not only by the biases listed above, but also by an individual's personal characteristics, such as: age, gender, relationships with other people (Mak & Ip, 2017;Ryu et al., 2017).
Over time, the investor's personal characteristics change, so his decisions and their nature also change, as investors gain more experience, their expectations and goals change, also risk perception, and tolerance to it. All financial market participants have a significant influence on each other, thus shaping the behavior of a group of investors or, in other words, a herd.
Herding behavior is a common phenomenon in financial markets and is defined in quite different ways. Chhapra et al. (2018) describes the behavior of a group of investors as a process in which investors imitate each other's actions and make financial decisions based on the opinion of other investors, actions taken and market trends. As a result of this simulation of each other's actions, investors behave in the financial markets in a similar way, and this is called herding. Arjoon and Bhatnagar (2017) believe that herding behavior arises from an investor's inherent desire to belong to some group or community. According to Park and Kim (2017), such behavior is driven by deliberate copying of the actions of investors who achieve better investment results, Satish and Padmasree (2018) explain that the reason is investors seeking to reduce uncertainty or compensate for missing knowledge, and Calderon (2018) suggests that investors do so in an effort to reduce investment risk and expect to follow the example of other investors to reduce the likelihood of potential losses. Rezaei and Elmi (2018) identify the lack of experience as the main reason for the emergence of herding behavior.
The financial behavior of a group of investors is divided into two theoretical models (Economou et al., 2018). The first model is when herding results from the deliberate actions of investors in replicating the market. This means that investors monitor the prevailing market trends, actions taken by other investors, analyze the views and opinions of the majority of investors and make decisions based on it. The second model is when herding results from similar information received by investors. In this case, investors use the same sources of information, examine the conclusions and recommendations of specific analysts, perform similar analysis, which, giving the same results, form certain principles of investor behavior. Other authors (Park & Kim, 2017;Yao et al., 2014) divide herding behavior into rational and irrational.
Herding has a major impact on investors' decisions, but at the same time, it also affects the entire financial market very strongly. Calderon (2018) argues that herding behavior may be a major cause of adverse market phenomena such as: growth in speculative investment, formation of market bubbles, or anomalies. Lim et al. (2013) emphasize that herding can lead to the ignorance or loss of valuable information, the accumulation of irrelevant information, complicate investor decision-making, and increase the likelihood of irrational actions. Chakravarty and Ray (2020) note that on the positive side, herding behavior can help the market grow. The pace of this market volatility is determined by the strength of herding behavior, which usually depends on direct communication between market participants. This is highly dependent on the quality of the information available to the investors whose actions are being tracked. However, a review of the scientific literature has shown that the authors are more likely to highlight the negative consequences of herding behavior. For this reason, identifying and analyzing herding in financial markets is a crucial task to avoid these negative effects. One of the tools for identifying herding behavior is measuring and analyzing investor sentiment.
Investor sentiments in the behavioural finance are examined as a separate theory determining investors' decisions. Investor sentiment theory explains how investors' beliefs are formed, how investors' sentiment influences their investment decisions, and how this affects the entire financial market (He et al., 2019). People are emotional by nature, so often their moods and emotions become the basis for taking particular action in all life situations, including investing. When an investor is in a bad mood, he is more prone to a pessimistic view of the future, while those who are in a good mood, on the contrary, are optimistic, that is, they are more likely to see positive market developments and expect favorable events. When an investor is optimistic, he will be more willing to take risks when investing than being in a bad mood. Investors cannot completely distance themselves from emotions, even if they try to make decisions based on models of technical analysis, they still have to make certain assumptions to determine a specific value (Bouteska, 2019;Ren et al., 2019).
According to Pandey and Sehgal (2019), the overall level of investor optimism and pessimism or social sentiment changes over time. When the market is bullish, investors are more inclined to think optimistically, and when the market is bearish, they are more pessimistic. Kaustia and Rantapuska (2016) note that a pessimistic or optimistic mood can prevail in the financial market at any point in time. Since changes in optimism and pessimism affect changes in the market price of financial instruments, it can be argued that the market price of an asset does not reflect its value, but the psychological state of the market as a whole, which constantly fluctuates. Fluctuating investor mood in the financial market is defined as investor sentiment. The positive sentiments held by investors reflect their optimistic attitude towards changes in the market, while the negative sentiments of investors express investors' pessimistic forecasts and negative attitudes towards market volatility. When the market reaches its peak and when it reaches the bottom, understanding and analyzing investor sentiments can help predict changes in the prices of financial instruments and identify the herding behavior. One of the main methods of measuring the sentiment of investors, which helps to analyze the herding behaviour in the financial market, is the calculation of the open position ratios, textual analysis of various sources and classification of sentiments.

Methodology
The aim of this study is to link investor behavior to possible numerical real and projected market data. The change in the prices of 10 financial instruments per week was chosen to measure the financial market. Predictions for the same instruments were obtained using technical indicators and a deep learning algorithm. These predictions represent the rational thinking of the investor. The rational behavior of the investor in this study is represented by the ratio of positions held by investors and sentiments in social networks (Figure 1). Different financial instruments from different markets have been selected for the study, such as the foreign exchange market, the cryptocurrency market, the commodities market and the stock market, in order to be able to evaluate investor behavior as widely as possible. Selected instruments are: exchange rates of Euros and United States of America Dollar (EUR / USD), Great Britain Pound and US dollar (GBP / USD), Euros and Great Britain Pound (EUR / GBP), Australian Dollar and Japanese Yean (AUD / JPY), Euros and Japanese Yean (EUR / JPY) currency pairs, gold (XAU / USD), silver (XAG / USD), French stock index (FRANCE 40), United States of America stock index (US 500), BITCOIN cryptocurrency. All evaluations are performed twice: on 26 October 2020 and on 02 November 2020.
Technical indicators. In most cases, investors make decisions using technical indicators. For the study, we selected a simple moving average with a normal 14-day period and Bollinger bands with a 14-day period and 2 standard deviations in both directions to limit the band. Technical indicators analyze past data and apply a variety of statistical econometric methods to describe signals. Deep learning prediction. The Matlab deep learning algorithm based on LSTM was chosen for the research (Math-Works, n.d.-a): Deep Learning (DL) is a field of machine learning that is the smallest and most complex learning method in the overall hierarchy of Artificial Intelligence (AI) (Tang et al., 2018). During the operation of the LSTM algorithm, it is selected which of the analyzed data should be left, learned and saved, and which should be removed from the process. In this way, important information is transmitted in a long sequence and a final result is obtained, which in this work is understood as a prediction of the analyzed data. To assess the accuracy of this forecasting model, a measure of RMSE (Root Mean Squared Error, RMSE) error is calculated. The advantage of this criterion is that by raising the value obtained by squaring, large deviations are further highlighted. Consequently, it is important that the resulting error is as small as possible in order to obtain the most accurate forecasting model. If the RMSE is zero, then the actual and predicted values completely coincide (Boulemtafes et al., 2019). The algorithm provides several financial instrument prices forecasts ahead. The first forecast and the trend for the whole week are used for further analysis of the study (Figure 2).
Open position ratios. Investor sentiments or open position ratios in the financial market are assessed and measured in various ways. Each investment platform has its own methodologies, which are used to measure what proportion of their clients have buying positions and what have sales positions. This ratio is expressed as a percentage and therefore reflects the views of the majority and minority of investors. Such data is constantly updated, the results change periodically depending on the opinion of investors. The ratio of the positions held by investors is provided for each financial instrument separately in order to measure the sentiments of each specific instrument.
Investor holdings are taken from the free access websites of OANDA, Daily FX and Finance Attitude. OANDA (OANDA, n.d.) has a large number of clients, both individual investors and legal entities from around the world, so the results of the investor position ratio are extensive, updated daily every 20 minutes. OANDA provides a table of positions held by investors in 16 currency pairs. Daily FX (Daily FX, n.d.) is a free news and research website that is one of the leading sources on the currency, commodities, and stock index trading community. Daily FX provides IG Client Sentiment data, which shows the percentage of investors in buy and sell positions and provides market signals for a specific financial instrument. The signal provided has three types: bull, bear or mixed market.
Finance Attitude (FinanceAttitude, n.d.) is a website that provides the latest financial, economic and business knowledge and the results of various analyzes performed by qualified analysts or independent experts. Finance Attitude, like the sources mentioned above, provides data on investors' positions in the financial market, which is updated daily every 30 minutes. This page shows the sentiments of investors in as many as 55 currency pairs. Sentiment scores from social media. The prevailing opinion on social media about individual financial instruments can influence investor behavior. The purpose of the textual analysis is to determine the sentiments of the records in question, i.e. to determine which investors evaluate a particular financial instrument positively and which in a negative way. Data from people's posts selected for textual analysis is collected from the social network Twitter using a self-developed Tweet Sentiment Visualization tool that is freely available online. The Matlab classification algorithm, which is based on machine learning, is used to classify posts from the social network Twitter sentiments. Basic principles according to which the algorithm performs classification (MathWorks, n.d.-b) are: 1. A dictionary of English word sentiments is used, which is divided into two sets: positive words and negative words. 2. The algorithm compares the words of each Twitter post with the words in the dictionary of sentiments and gives each post a score from -1 to 1, which reflects which part of the words has a positive rating and which part has a negative rating. 3. Calculate the average of the estimates for the whole set of records about one financial instrument, it is called the sentiment score. All of the methods listed above were selected for suitability for the investor behavior survey. The methods of technical analysis, deep learning, investor positions, and textual analysis are very different in nature, but their properties and functions complement each other and are used to achieve the purpose of the study and to obtain the expected results.

Research
Understanding investor behavior and being able to anticipate their future actions is an integral part of successful investment in all financial markets. The study focuses on two paradigms of investor behavior: herding behavior, where investment decisions are made following the views of the majority and actions are taken on that basis; contrarian behaviour when decisions are made contrary to those of the majority. The study aims to link the manifestation of these different paradigms in investor behavior with the change in prices of different investment instruments and the opinion of investors in social networks.
Data on investor behavior under the selected instruments are taken from three Internet sources: OANDA, Daily FX, Finance Attitude. The data measures how many investors have long and how many have short positions as a percentage. Investor behavior data are compared to real price changes over time, price changes projected through deep learning, and public opinion pulled from the social network. The study takes two different time periods. The overall results of the investor behavior survey are presented in Table 1. The results presented show that the prediction and classification results obtained during the study are very diverse and ambiguous.  The forecasting of the prices of selected financial instruments using in-depth learning showed that the forecasting method used is not reliable, as only half of all forecasts corresponded to real changes.
The results of the classification of entries in social networks related to the selected financial instruments showed that in most of the cases examined, the sentiments of the majority of the entries corresponded to the real direction of the change in the prices of the selected financial instruments. Consequently, exactly the same proportion of records with opposite sentiments, which accounted for the smallest share of all records, corresponded to real price changes. This means that, just like the forecasting method mentioned above, this classification method cannot pinpoint the direction of the price change and does not specify which way of investor opinion is more reliable. Repeating the results in the next time period (Table 2) did not provide any new information.
Different sources assessing investors' positions present quite different results for investors' positions under the financial instruments in question. In both periods, according to an OANDA source, most investors predicted an increase in the prices of all the financial instruments in question. According to all sources of investor positions, that is, according to OANDA, Daily FX and Finance Attitude, there were more cases when investors opposed to the majority were right about future price changes. Therefore, when assessing the results of sentiments in general (Figure 3), it can be said that the forecasts of the investors who are contrarian to the majority are more accurate.
Summarizing the results of the research on investor behavior, it can be stated that it is not more reliable to make investment decisions based on the forecasts of the majority of investors. Based on the forecasting of prices of financial instruments and classification of social network records, it can be stated that the methods used for these analyzes cannot provide accurate forecasts of price changes, but they can very well serve the investor by combining them with other forecasting methods.

Conclusions
The chosen research methodology allowed to combine and compare different approaches to the financial market: -changes in the market can be estimated with a numerical historical data, -changes in the market due to the prevailing opinion, -market changes are driven by investor behavior. Numerical methods of technical analysis presented different coincidences of price changes: a moving average of only 20% and the Bollinger bands of 70%. The best match between the changes in the prices of financial instru-ments and the forecast prices was shown by the deep learning algorithm (80%), apparently because the pur-pose of this code is forecast.
Investor behavior is a key factor in examining financial market volatility. One of the main phenomena of investor behavior that has a significant impact on investors and their decisions is herding behavior. There are many reasons for this investor behavior, but the consequences are usually negative for both investors and the financial market. For this reason, there is a need to be able to identify and measure herding behavior. The main unit of measurement that helps to describe the attitude of a group of investors is the ratio of investor positions.
The analysis of the data on the positions held by investors helped to make sure that herding could have a negative impact on investment results, as the opinion of the majority of investors is less in line with changes in the prices of financial instruments in the market. The classification of entries in social networks showed that the expression of opinion in social networks reflects the opinion of the social networking community but it cannot be related to the opinion of investors.
The research can help investors to analyze and apply data on investor sentiment, to provide knowledge about the relationship between investor behavior and financial instruments in financial markets. The study could be extended to other forecasting methods in addition to the methods used, by exploring the deep learning algorithm for more accurate forecasting, including more sources of investor position data and social networking records to make the results even more accurate and specific.

Disclosure statement
The authors declare no conflict of interest.